{"id":"a8c69cc3-1d13-49e0-a182-daa9cb5ad4e7","arxiv_id":"2504.14640","paper_version":1,"verdict":"CONDITIONAL","confidence":"MODERATE","novelty_score":6.0,"correctness_risk":"medium","formal_verification":"none","parameter_count":5,"one_line_summary":"PtTrust pre-trains a sparse autoencoder on LLM hidden states at line boundaries, then trains a small ranker to identify erroneous code lines, reporting state-of-the-art cross-task and cross-language results.","lead":"The paper introduces PtTrust, a two-stage system that reads a code-generating LLM's internal states and flags which generated code lines are likely wrong. It claims to outperform existing uncertainty and probing baselines on line-level error detection across tasks and languages.","discovery_kind":"new_method","skeptic_critique":{"model":"deepseek-v4-flash","headline":"Length-ranked training labels in §3.3 align with the token-weighted Top-K metric, so a length-only baseline is needed before the SOTA claim is credible.","rationale":"The reader's conditional verdict is appropriate, and the weakest assumption about newline-token states is plausible, but the single most load-bearing and testable concern is the alignment between the training labels and the evaluation metric. Section 3.3 explicitly ranks incorrect lines by length, and Section 4.2 measures hit rate by buggy tokens, so the method is optimized for a token-weighted recall objective using length as a graded relevance signal. A straightforward length baseline is absent from Tables 2-4, making it impossible to know whether the reported gains come from internal-state representations or from a simple proxy that was baked into the labels. This concern is concrete, falsifiable, and directly bears on the paper's central claim of cross-task and cross-language generalization. The paper has real strengths: public code, a two-stage design, multiple LLMs, and held-out tasks. The conditional recommendation stands because the missing control is easy to add and could change the interpretation of every headline number in RQ1. I do not see the concern as fatal enough to reject, but it should be resolved before the SOTA claim is accepted at face value.","tokens_in":20523,"tokens_out":6818,"duration_ms":64610,"concrete_test":"Run two linked experiments on the same three LLMs and datasets: (1) add a baseline that ranks each code line by token count descending and compute the Table 2-4 Top-K Hit Rates; (2) retrain PtTrust's Stage-2 ranker with binary relevance labels (all incorrect lines assigned score 1, correct lines 0) instead of the length-ranked scores in §3.3, keeping the SAE frozen. If the length-only baseline matches PtTrust's Top-1/Top-3/Top-5 within noise, or if the length-ranked training variant substantially outperforms the binary-label variant, the reported SOTA does not demonstrate that internal states contribute to line-level risk assessment.","verdict_should_be":"UNCHANGED","load_bearing_attack":"The semantic-binding stage in §3.3 constructs its training target out of line length: correct lines are scored 0, while incorrect lines are ranked by their length, and the ranker is trained with NeuralNDCG on those scores. The RQ1 metric in §4.2 is Top-K Hit Rate defined as the proportion of buggy tokens covered by the Top-K selected lines, so longer buggy lines contribute proportionally more to the score. PtTrust is the only method trained with this length-ranked target; the Probing Classifier and Uncertainty baselines are not. If line length correlates with bugginess in these datasets, a trivial baseline that ranks lines by token count—without internal states or SAE—could reproduce much of PtTrust's advantage. In that case, the reported state-of-the-art performance would be an artifact of metric-label alignment rather than evidence that early-layer newline states carry transferable line-level error information. The central cross-task and cross-language generalization claim depends on this not being the case.","agreement_with_reader":"partial"},"referee_report":{"model":"deepseek-v4-flash","summary":"The paper proposes PtTrust, a two-stage framework for line-level risk assessment of code LLMs based on internal states. Stage 1 profiles hidden states of a target code LLM at newline tokens in early layers, trains a TopK sparse autoencoder with a reconstruction loss plus a contrastive loss on correct/incorrect and mutated code pairs. Stage 2 uses a small Python-only labeled dataset (HumanEval, EvalPack, QuixBugs) to train a NeuralNDCG ranking model over SAE latents. The framework is evaluated on EditEval, Code Lingua, and Defects4j across three code LLMs, with Top-K Hit Rate for line-level identification and accuracy for snippet-level classification, and the authors claim state-of-the-art results and interpretable cross-task latent features.","tokens_in":20702,"tokens_out":7878,"duration_ms":68093,"significance":"If the claims hold, PtTrust would be a practical contribution: it would show that a small amount of labeled data plus unsupervised SAE pre-training on public code can produce a line-level risk flag that transfers across tasks and languages, with released implementation and labeled datasets. The paper also introduces a benchmark task (fine-grained code line error identification) and compares against reasonable baselines. However, the headline results are currently difficult to interpret because of a metric-label alignment confound, the absence of statistical reliability information, and the GPT-4o-derived labels. The interpretability result is largely a consequence of the training objective. With additional controls, the paper could be a solid empirical contribution.","major_comments":[{"comment":"In §3.3 the incorrect training lines are ranked 'based on their length,' while the RQ1 metric in §4.2 is Top-K Hit Rate, defined as the proportion of buggy tokens covered by the selected lines. Because longer buggy lines contribute proportionally more tokens, a baseline that ranks lines by token count would be aligned with both the training target and the evaluation metric. No such baseline appears in Tables 2-4, so the reported state-of-the-art performance could be an artifact of metric-label alignment rather than evidence that newline-token hidden states carry transferable error information. Please add a length-only ranking baseline and, ideally, a variant of the Probing Classifier that includes line length as an input feature.","section":"§3.3, §4.2, Tables 2-4"},{"comment":"All results are reported as single point estimates without variance, confidence intervals, or significance tests. Several comparisons are close or favor the Uncertainty baseline (e.g., Code Llama on Defects4j Top-5: PtTrust 0.595 vs Uncertainty 0.603; Qwen2.5-Coder on Defects4j: Uncertainty is higher at all K), so the 'state-of-the-art' claim is not yet supported. Please report multiple seeds or bootstrap confidence intervals and perform paired significance tests across instances where appropriate.","section":"§4.2, Tables 2-4; §4.3, Table 5"},{"comment":"Both the semantic-binding labels and the evaluation ground truth are produced by GPT-4o, and the manual verification procedure is applied only to cases where GPT-4o's repair attempts failed. The paper does not report how many cases were manually reviewed, how the review sample was drawn, or any agreement statistics between GPT-4o and human line-level annotations. Since the same labeling source is used in training and testing, a systematic labeling bias (e.g., toward longer lines or particular syntactic patterns) would be shared by both and could interact with the length confound in Major Comment 1. Please quantify label quality on a human-annotated held-out sample and report the manual-review counts.","section":"§4.1.1, Table 1; §6"},{"comment":"The SAE is trained with a contrastive loss that explicitly separates correct and incorrect/mutated line representations, so the observation that some latents are consistently more active for incorrect lines is expected from the objective rather than an emergent, independent property. This weakens Finding 3 and the comparison to human error-related negativity. To support the interpretability claim, compare with an SAE trained without the contrastive term (or with shuffled contrastive pairs) and report whether the same cross-task error latents appear.","section":"§4.4.2, Eq. (4)"},{"comment":"The central design choices are not ablated: no comparison with raw-state inputs under the same NeuralNDCG ranking objective, no removal of the contrastive loss, no sweep of the selected early layer or TopK sparsity k, and no evaluation of the different mutation types. Without these ablations, the paper's claim that the unsupervised SAE pre-training stage is responsible for cross-task and cross-language generalization is under-supported. Please add at least a no-contrastive SAE ablation and a raw-state + ranking baseline.","section":"§3.2, §3.3, §4"}],"minor_comments":[{"comment":"The opening sentence 'PtTrust achieves state-of-the-art performance across all three code LLMs' is contradicted by the Defects4j results in Tables 2-4 (e.g., Uncertainty outperforms PtTrust for Qwen2.5-Coder on Defects4j). Please qualify the claim.","section":"§4.2"},{"comment":"The captions mention that 'Different colors are used to highlight the best and second-best' but the colors are not described or visible in the text; add a legend or use boldface.","section":"Tables 2-4"},{"comment":"The line-deletion contrastive pair definition (original line versus the line following the deleted line) is confusing; spell out how the 'incorrect' member is determined.","section":"Footnote 1 and §3.3"},{"comment":"The paper omits the NeuralNDCG loss definition and training hyperparameters; please provide the formula or a precise citation and the learning rate, batch size, and number of epochs.","section":"§3.3"},{"comment":"References [60] and [61] appear to be the same paper (Pan et al., Lost in Translation) and should be merged.","section":"References"}],"recommendation":"major_revision","confidential_remarks":"I would not accept at this stage without the length baseline and statistical reporting; the paper is otherwise within scope for FSE Companion. The authors' claim that internal-states-based risk assessment generalizes across tasks and languages is plausible, but the current evidence does not rule out the simple length-based explanation. The 'state-of-the-art' phrasing should also be tempered given the Defects4j results."},"author_rebuttal":null,"desk_editor":{"model":"deepseek-v4-flash","letter":"PtTrust is a credible two-stage line-level risk flag for code LLMs: unsupervised SAE pre-training on newline-token states, then a small supervised ranker. What is actually new is the task formulation and the combination — nobody has done fine-grained line-level error identification from internal states, and the authors ship code and labeled data. The held-out evaluation across tasks (editing, translation, repair) and languages (Python, Java) with three LLMs is real work, and the point estimates are consistently in their favor. Credit where due: the paper is honest about the uncertainty baseline beating them on Defects4j, and the threats-to-validity section does name the GPT-4o label issue.\n\nThe soft spots are not fatal, but they are load-bearing. First, the stress test is right: the ranker is trained with a length-ranked target, and the Top-K Hit Rate is token-weighted. A trivial baseline that ranks lines by token count, without internal states, is never reported. That baseline might not beat PtTrust — long buggy lines are not obviously the norm — but without the number the SOTA claim is not yet credible. Second, no error bars or significance tests at all; with three LLMs and three datasets, the pattern is consistent but the magnitudes could be noise. Third, the only ground truth is GPT-4o labels, with manual review only for the cases GPT-4o failed; that is acknowledged but not mitigated. Fourth, the interpretability finding is partly manufactured: the contrastive loss explicitly separates correct and incorrect lines, so finding error-correlated SAE latents afterwards is expected, not surprising. That section is more illustrative than evidential.\n\nThe newline-token assumption — discarding all non-newline tokens and using early layers — is also unablated. It may be fine, but it is the main design bet.\n\nBottom line: this deserves a serious referee. The task is useful, the artifacts are public, and the held-out generalization is meaningful. The right outcome is conditional acceptance with required additions: a length-only baseline, ablations isolating the pre-training and the newline-token choice, error bars, and a softer SOTA claim where their method is not best. I'd take this to a reading group — it is a good case study of metric-label alignment in LLM guardrails.","headline":"A useful new line-level risk flag for code LLMs with public artifacts and held-out gains, but the SOTA claim needs a length-only baseline and error bars before it is credible.","tokens_in":21258,"tokens_out":2532,"would_cite":true,"duration_ms":22913,"reading_group":"yes","serious_thinker":"yes","would_accept_peer_review":true},"rs_alignment":null,"lean_confirmation":null,"pith_extraction":{"msc":[],"pacs":[],"model":"deepseek-v4-flash","headline":"A two-stage pretraining method reads a code LLM's internal states to flag erroneous output lines, and claims this signal transfers across coding tasks and languages.","keywords":["large language models","code generation","risk assessment","internal states","sparse autoencoders","line-level error detection","learning to rank","trustworthiness assurance"],"falsifier":"Shuffle the order of code lines within each snippet before extracting newline-token states, or train the ranker on line length and position alone; if the Top-K hit rates stay about the same, the method's apparent generalization is explained by surface cues rather than by internal-state signals.","tokens_in":20259,"feed_emoji":"🛡️","tokens_out":6094,"duration_ms":54399,"temperature":0.7,"pith_summary":"PtTrust is a two-stage framework for assessing risk in code generated by large language models, aimed at flagging the specific lines of an incorrect answer rather than judging the whole snippet. In a first, unsupervised stage it compresses the model's hidden states, taken only at the newline token of each code line from early layers, with a TopK sparse autoencoder trained on large amounts of unlabeled code, including deliberately mutated lines. In a second, supervised stage, a small labeled Python-only dataset of about 368 snippets teaches a learning-to-rank network to score each line by risk. The paper claims this setup reaches state-of-the-art Top-K hit rates for identifying erroneous lines on three open code LLMs across code editing, translation, and repair, including a Java task the classifier never saw during training. The significance is that risk assessment could piggyback on the same pretraining paradigm as the LLM itself, using abundant unlabeled company code and only a little human feedback.","feed_headline":"Internal-state probe flags bad lines in LLM-generated code","feed_subtitle":"Two-stage pretraining on hidden states transfers from Python labels to Java and other coding tasks.","key_machinery":"The central object is a $\\mathrm{TopK}$ sparse autoencoder applied to hidden states at the newline token of each code line, drawn from the first quarter of the LLM's layers. The encoders computes $z = \\mathrm{TopK}(W_{\\mathrm{enc}}(s-b_{\\mathrm{pre}})+b_{\\mathrm{enc}})$, keeping only the $k$ largest latent values, and the decoder reconstructs $\\hat{s}=W_{\\mathrm{dec}}z+b_{\\mathrm{pre}}$; training minimizes a plain reconstruction loss plus a contrastive loss on pairs of correct and mutated lines. This machinery reduces the high-dimensional internal state to a sparse, interpretable code, and the same frozen latents afterwards feed a learning-to-rank network trained with NeuralNDCG. The key work it does is to disentangle representation from computation: unsupervised pretraining captures general error-related structure from unlabeled code, while only a small supervised stage binds that structure to specific risk labels.","core_discovery":"On the paper's own terms, the discovery is that correctness-relevant information survives in the hidden-state representation of a code LLM at line boundaries, and that a sparse, contrastively pretrained compression of those states transfers across tasks and languages. Given an incorrect generated answer $A$ of $n$ lines, PtTrust identifies a subset $E\\subseteq A$ of erroneous lines by scoring each line from the sparse-autoencoder latent $z$ extracted at its terminating newline token. The autoencoder is trained with a reconstruction loss plus a contrastive loss that pushes apart latent representations of correct and mutated or incorrect lines; the downstream ranker uses NeuralNDCG to order lines by risk. In experiments with three large open-source code LLMs, PtTrust attains the highest Top-1, Top-3, and Top-5 hit rates on code editing and code translation for all three models and remains competitive on a Java repair benchmark, where an uncertainty baseline leads. It also reports state-of-the-art snippet-level error prediction in 7 of 9 cases, and shows that certain SAE latents activate consistently for erroneous lines across all evaluation datasets, which the authors liken to error-related signals observed in human brains.","pith_inferences":["Editorial inference: the decisive experiment the paper does not report is an ablation that removes the SAE pretraining stage; if a classifier trained directly on raw newline-token states matched PtTrust's Top-K scores, the pretraining story would be unnecessary.","Editorial inference: because line-level signals are read at newline tokens, the transfer claim could be stress-tested on minified code or code written without line breaks, or on languages with different line conventions; the current evaluation only covers Python and Java.","Editorial inference: the contrastive mutations, line swaps and line deletions, create errors that differ in kind from natural LLM errors, so the claim that pretraining sees genuine mistakes hinges on how much these synthetic errors share with real ones; a test using only commit-history bugs for pretraining would clarify this.","Editorial inference: a cheap surface-feature baseline that ranks lines by length or position would establish whether the internal-state latents add signal beyond line statistics; the paper includes uncertainty baselines but no such control."],"forward_implications":["Companies could pretrain the risk probe on their own unlabeled code repositories, so that expensive human labels are needed only for a small semantic-binding set.","A Python-only labeled set is enough to produce useful line-level risk signals for unseen tasks such as code editing, translation, and repair, and for Java as well as Python.","Because the SAE latents are sparse and interpretable, a deployed risk flag can be explained by which latent features fire, not just by a single risk score.","The two-stage design keeps deployment cheap: a single forward pass per snippet plus a small ranking network, with no per-task retraining of the LLM.","The same semantic-binding mechanism could in principle bind the same representations to other risk properties, such as security or performance, by changing the labels collected in stage two."],"supporting_citations":[{"why":"Supplies the TopK sparse autoencoder architecture and the reported scaling-law result the pretraining stage builds on.","marker":"[22]"},{"why":"Provides the evidence that sparse autoencoders can extract monosemantic, interpretable features, motivating both the architecture and the interpretability claims.","marker":"[6]"},{"why":"Establishes the initial paradigm of probing LLM internal states to detect errors, serving as both motivation and a baseline.","marker":"[3]"},{"why":"HumanEval supplies the Python code-generation prompts and correctness labels used in the semantic-binding stage.","marker":"[10]"},{"why":"EvalPack supplies buggy-code data for pretraining plus repair labels for the semantic-binding stage.","marker":"[57]"},{"why":"QuixBugs provides Python repair cases that enlarge the small labeled set.","marker":"[46]"},{"why":"Provides the learning-to-rank formulation used to convert line-level risk scores into an ordered list.","marker":"[47]"},{"why":"NeuralNDCG gives the differentiable ranking loss used to train the downstream risk ranker.","marker":"[64]"},{"why":"LookBack Lens is the attention-based baseline that PtTrust must outperform in line-level error detection.","marker":"[12]"}],"fun_headline_variants":["Pretrained hidden states flag bad lines across code languages","PtTrust: internal-state probe catches faulty code snippets","Sparse autoencoder on LLM states scores line risk, transfers","From Python to Java: hidden-state risk detector for code LLMs","Line-level error detection via pretrained LLM internals"],"cache_read_input_tokens":3200,"weakest_assumption_plain":"The load-bearing premise is that the hidden state at a line's newline token, taken from early layers and compressed by a contrastively trained sparse autoencoder, carries enough task-independent signal about that line's correctness that a small Python-only labeled set transfers to unseen tasks and languages.","fun_headline_variants_meta":{"raw":{"variants":["Pretrained hidden states flag bad lines across code languages","PtTrust: internal-state probe catches faulty code snippets","Sparse autoencoder on LLM states scores line risk, transfers","From Python to Java: hidden-state risk detector for code LLMs","Line-level error detection via pretrained LLM internals"]},"model":"deepseek-v4-flash","effort":"low","cost_usd":0.000274,"raw_usage":{"total_tokens":1709,"prompt_tokens":1081,"completion_tokens":628,"prompt_tokens_details":{"cached_tokens":384},"prompt_cache_hit_tokens":384,"prompt_cache_miss_tokens":697,"completion_tokens_details":{"reasoning_tokens":545}},"tokens_in":697,"tokens_out":628,"duration_ms":6266,"temperature":1.0,"reasoning_tokens":545,"cache_read_input_tokens":384,"cache_creation_input_tokens":0},"cache_creation_input_tokens":0},"created_at":"2026-08-16T11:44:16.944654+00:00","model_set":{"reader":"deepseek-v4-flash"},"falsifier":"Shuffle the order of code lines within each snippet before extracting newline-token states, or train the ranker on line length and position alone; if the Top-K hit rates stay about the same, the method's apparent generalization is explained by surface cues rather than by internal-state signals.","supporting_citations":[{"cited_title":null,"cited_arxiv_id":null,"evidence_quote":"QuixBugs provides Python repair cases that enlarge the small labeled set."}],"review_version":1}