How Much is Left? LLMs Linearly Encode Their Remaining Output Length
Reviewed by Pith T0 review T1 audit T2 compute T3 formal T4 kernel 2026-07-07 17:43 UTCglm-5.2pith:6KTCEUN5record.jsonopen to challenge →
The pith
LLMs linearly encode how many tokens they have left to generate
A machine-rendered reading of the paper's core claim, the machinery that carries it, and where it could break.
Core claim
The residual stream of an instruction-tuned LLM contains a linearly decodable estimate of how many tokens of output remain, readable from the prompt's last hidden state before generation begins, transferring across datasets with different length distributions, and updating directionally upward when the model retracts and restarts a partial solution. The central object is the Remaining Count Probe -- a single linear layer with no nonlinearity that regresses on the residual-stream activation at each completion position to predict the remaining token count. The asymmetry in cross-dataset transfer (natural-language probes generalize to synthetic data but not vice versa) is itself a key finding,,
What carries the argument
A linear probe (single linear layer, no nonlinearity) trained on frozen residual-stream hidden states to predict remaining token count at each generation position. Three variants are compared: the Remaining Count Probe (reads hidden states at every position), a constant-median statistical baseline (dataset median at every position), and a Completion Length Probe (trained only on the prompt's last hidden state, then decremented by position). The cross-dataset transfer matrix tests whether the recovered direction is model-general or dataset-specific.
If this is right
- If the length-tracking direction is causal, ablating or steering it at inference time could control how long a model's response runs, enabling budget-aware generation without external heuristics.
- A retraction token that does not produce an upward shift in the probe's estimate could serve as a signature of unfaithful chain-of-thought -- the model says 'wait' but does not internally revise its plan.
- Prompt-end length estimates exceeding a token budget could trigger early termination before any output is generated, reducing inference cost.
- The cross-dataset transfer asymmetry suggests that models trained on more heterogeneous data develop more general internal representations of output structure, which could inform training-data curation for controllable generation.
- If the length signal sharpens with scale, frontier models may carry substantially more precise internal plans for their own output than the 7-8B models tested here, with implications for predictability and steerability of long-form generation.
Load-bearing premise
The 'plan-like' interpretation rests on the cross-dataset transfer asymmetry being genuine and not driven by tokenization differences between natural-language and synthetic datasets; the paper acknowledges that a shared-BPE replication is left to follow-up work and does not empirically rule out this alternative explanation.
What would settle it
Train probes on synthetic and natural-language datasets that share identical tokenizers and BPE boundaries; if the natural-to-synthetic transfer advantage disappears under matched tokenization, the 'plan' interpretation weakens to a tokenizer artifact.
Figures
read the original abstract
Large language models generate one token at a time, yet their responses show remarkably consistent length structure: step-by-step solutions converge in predictable token counts, retrievals stop after a few sentences, retractions extend responses by measurable amounts. We ask whether the model carries an internal estimate of how much response remains. Training minimal-capacity linear probes on frozen hidden states of three open-weight 7-8B models across seven completion-style datasets, we find three converging pieces of evidence. First, total response length is linearly decodable from the prompt's last hidden state alone, before any output is emitted. Second, probe directions trained on natural-language datasets transfer broadly, including to controlled synthetic completions never seen in training, outperforming a statistical baseline; the converse direction generally fails, and this asymmetry is itself informative. Third, on curated high-loss completions, the probe's per-position estimate shifts upward at the moment the model retracts and restarts a partial solution, a directional behavior no position-only predictor can reproduce (qualitative, not aggregate). We frame this as approximate estimation of remaining generation length, distinct from exact-counting impossibility results for transformers, and interpret it as evidence that LLMs maintain a plan-like internal representation of output length (decodable, not necessarily used causally).
Editorial analysis
A structured set of objections, weighed in public.
Referee Report
Summary. The paper investigates whether LLMs maintain an internal, linearly decodable estimate of remaining output length. Using minimal-capacity linear probes on frozen hidden states of three 7-8B instruction-tuned models across seven datasets (two synthetic, five natural-language), the authors report three findings: (1) total response length T is linearly decodable from the prompt's last hidden state alone, beating a constant-median baseline in every cell; (2) probe directions trained on natural-language datasets transfer cross-dataset, including to synthetic targets, while the converse (synthetic to natural) fails—an asymmetry the authors attribute to natural-language training recovering a more general length-tracking direction; (3) on curated high-MAE completions, the probe's per-position estimate shifts upward at retraction tokens, a behavior monotonic baselines cannot reproduce. The paper is methodologically careful in several respects: three-seed averaging, a stratified probe family separating prompt-end decodability from mid-completion updates, and an explicit limitations section acknowledging that decodability does not entail causal use and that the retraction evidence is qualitative.
Significance. The paper addresses a well-motivated question at the intersection of mechanistic interpretability and LLM generation dynamics. Its strengths include a clean probe family design that stratifies contributions (prompt-end vs. mid-completion), a cross-dataset transfer matrix across three model families that goes beyond standard within-distribution probing, and honest scoping of claims (e.g., explicitly framing the retraction result as qualitative, acknowledging the worst-MAE selection bias). The cross-dataset asymmetry result, if it holds up under the controls discussed below, is a genuinely informative finding for the probing literature. The code is released (anonymously), and the hyperparameter and dataset configuration tables (Tables 6-7) support reproducibility. The per-layer sweep (Appendix A.1) and the classification-probe ablation (Appendix A.8) are valuable additions.
major comments (2)
- §4.1, Table 1: The paper's foundational claim is that total response length T is linearly decodable from the prompt's last hidden state alone. The only baseline is the constant-median predictor, which uses zero prompt information. No baseline controls for simple prompt features (e.g., prompt token length, question type, structural cues) that could mechanically correlate with completion length. On natural-language datasets, the probe's improvement over the constant-median baseline (e.g., GSM8K: 42.29 vs. 58.66 for Llama) could partially reflect these content correlations rather than an internal length estimate. A simple regression baseline using prompt token count (and perhaps one or two other surface features) as a predictor of T would help distinguish 'the model encodes a length plan' from 'the model encodes prompt features that correlate with length.' This is load-bearing for the paper
- §5, Table 3: The cross-dataset transfer asymmetry (natural → synthetic transfers; synthetic → natural fails) is a central result. The paper argues that tokenization differences are 'unparsimonious as the load-bearing explanation' because a tokens-per-character story predicts symmetric failures, but the matrix shows one-way generalization. However, the argument against a tokenization confound is made verbally rather than empirically. The paper itself acknowledges that 'a shared-BPE replication is left to follow-up work.' Given that this asymmetry underpins the 'plan-like representation' interpretation, at minimum the paper should more precisely characterize what tokenization differences exist across the datasets and why the asymmetry argument is robust to them. Alternatively, a control using a fixed tokenizer across datasets would substantially strengthen the claim. Without this, an artif
minor comments (6)
- §3.3: The Completion Length Probe is trained with MSE loss but evaluated with MAE. The rationale for this loss/metric mismatch is not stated. A brief note on why MSE was chosen for training while MAE is the headline metric would help.
- Table 2: Several cells show the Remaining Count Probe losing to Exact countdown (e.g., Llama/Count: 34.41 vs. 29.80; Llama/MMLU-Pro: 123.56 vs. 123.31). The paper addresses this in the 'Implied claim' paragraph, but marking these cells explicitly (e.g., with a different symbol) would improve clarity.
- Figure 3: The table in panel (b) lists token positions 179-191, but the text references t=173 with r_t=814. The relationship between the table range and the referenced position is unclear; better alignment would help.
- §A.9: The selection procedure for the four additional retraction examples is described as sorting by per-completion MAE and walking down from the worst. It would help to state how many completions were examined before these four were selected, to give a sense of prevalence.
- Table 7: The Count and Countdown datasets have only 301 train and 301 eval samples. This is quite small compared to the natural-language datasets. A note on whether this affects the cross-dataset transfer results (e.g., whether the synthetic→natural failure is partly a sample-size artifact) would be appropriate.
- §2: The related work section is well-structured but could briefly mention prior work on length-controlled generation or length prediction in NLP, as these are adjacent to the prompt-end decodability claim.
Simulated Author's Rebuttal
We thank the referee for a careful and constructive report. Both major comments identify controls that would strengthen the paper's central claims. We address each below and indicate what revisions we will make.
read point-by-point responses
-
Referee: §4.1, Table 1: No baseline controls for simple prompt features (prompt token length, question type, structural cues) that could mechanically correlate with completion length. A regression baseline using prompt token count would help distinguish 'the model encodes a length plan' from 'the model encodes prompt features that correlate with length.'
Authors: This is a fair and important point. We agree that the constant-median baseline is the weakest possible control and that a prompt-feature regression baseline is needed to isolate what the probe is reading beyond surface correlations. We will add this baseline in revision. Specifically, we will train a simple linear regression (and optionally a gradient-boosted regressor) mapping a small set of prompt-level surface features — prompt token count, prompt character count, and question type indicator — to T, fit on the train split and evaluated on the eval split, and report its MAE alongside the constant-median and Completion Length Probe in Table 1. This directly tests whether the probe's improvement over the constant baseline is attributable to surface features that are linearly readable from the prompt alone. We expect the probe to outperform this baseline on the synthetic datasets (where T is a deterministic function of the prompt and the probe recovers it almost exactly, e.g., MAE 5.27 on Countdown), but the comparison on natural-language datasets is the empirically open question the referee rightly flags. We note two partial defenses of the current claims that the revision will make explicit: (1) The cross-dataset transfer result (Table 3) is difficult to explain by surface-feature correlations alone — a probe trained on OpenThoughts-1k transfers to Count/Countdown, which have a completely different surface structure, and a probe trained on MMLU-Pro transfers to GSM8K despite different question formats. If the probe were merely reading 'prompt token count' or 'question type,' it should not generalize across these structurally dissimilar datasets. (2) The per-layer sweep (Appendix A.1) shows the signal is absent at layer 0 (the embedding output) and emerges only in later revision: no
-
Referee: §5, Table 3: The argument against a tokenization confound for the cross-dataset transfer asymmetry is made verbally rather than empirically. The paper should characterize tokenization differences across datasets and explain why the asymmetry argument is robust to them, or provide a fixed-tokenizer control.
Authors: We agree that the tokenization argument should be supported empirically rather than only verbally. We will add two things in revision. First, a quantitative characterization of tokenization differences across all seven datasets: for each dataset, we will report the distribution of tokens-per-character, BPE merge depth, and vocabulary overlap with the synthetic Count/Countdown sets. This makes the tokenization landscape explicit and lets the reader assess whether the datasets that transfer well to each other are also the ones with similar tokenization profiles. Second, we will strengthen the logical argument with a concrete analysis: if tokenization mismatch were the load-bearing explanation for transfer failure, we would expect the degree of tokenization mismatch between a train-target pair to predict the transfer MAE. We will test this by computing the correlation between a tokenization-similarity metric (e.g., vocabulary overlap or tokens-per-character ratio) and the off-diagonal entries of the transfer matrix. If tokenization is the primary driver, this correlation should be high; if it is not, the correlation should be weak — which is what we expect given the asymmetry (natural→synthetic transfers despite large tokenization differences; synthetic→natural fails despite the same differences). We note that the asymmetry itself is logically inconsistent with a pure tokenization story: the tokenization gap between, say, OpenThoughts-1k and Count is the same in both directions, yet transfer succeeds in one direction and fails in the other. A tokens-per-character confound predicts symmetric failure, not asymmetric. However, we acknowledge that tokenization could interact with the probe-fitting dynamics in ways this simple symmetry argument does not capture — for instance, revision: no
-
Referee: §5, Table 3: The argument against a tokenization confound for the cross-dataset transfer asymmetry is made verbally rather than empirically. The paper should characterize tokenization differences across datasets and explain why the asymmetry argument is robust to them, or provide a fixed-tokenizer control.
Authors: We agree that the tokenization argument should be supported empirically rather than only verbally. We will add two things in revision. First, a quantitative characterization of tokenization differences across all seven datasets: for each dataset, we will report the distribution of tokens-per-character, BPE merge depth, and vocabulary overlap with the synthetic Count/Countdown sets. This makes the tokenization landscape explicit and lets the reader assess whether the datasets that transfer well to each other are also the ones with similar tokenization profiles. Second, we will test whether tokenization similarity predicts transfer performance: if tokenization mismatch were the load-bearing explanation, the degree of mismatch between a train-target pair should correlate with the off-diagonal transfer MAE. We will compute this correlation and report it. We note that the asymmetry itself is logically inconsistent with a pure tokenization story: the tokenization gap between, say, OpenThoughts-1k and Count is the same in both directions, yet transfer succeeds in one direction and fails in the other. A tokens-per-character confound predicts symmetric failure, not asymmetric. However, we acknowledge that tokenization could interact with probe-fitting dynamics in ways this simple symmetry argument does not fully capture — for instance, if the synthetic-trained probe overfits to a narrow direction that happens to align with a tokenization artifact, the failure on natural-language targets could be a generalization failure rather than a tokenization mismatch per se. The correlation analysis we propose would help distinguish these. Regarding a fixed-tokenizer control: this would require regenerating all completions with a shared BPE, which is a substantial experimental effort that revision: no
-
Referee: §5, Table 3: The argument against a tokenization confound for the cross-dataset transfer asymmetry is made verbally rather than empirically. The paper should characterize tokenization differences across datasets and explain why the asymmetry argument is robust to them, or provide a fixed-tokenizer control.
Authors: We agree that the tokenization argument should be supported empirically rather than only verbally. We will add two analyses in revision. First, a quantitative characterization of tokenization differences across all seven datasets: for each dataset, we will report the distribution of tokens-per-character, vocabulary overlap with the synthetic Count/Countdown sets, and average BPE fragment length. This makes the tokenization landscape explicit. Second, we will test whether tokenization similarity between a train-target pair predicts the off-diagonal transfer MAE. If tokenization mismatch were the load-bearing explanation, this correlation should be high; if it is not, the correlation should be weak. We expect the latter, given the asymmetry: the tokenization gap between OpenThoughts-1k and Count is the same in both directions, yet transfer succeeds in one direction and fails in the other. A pure tokens-per-character confound predicts symmetric failure, not asymmetric. We acknowledge, however, that tokenization could interact with probe-fitting dynamics in subtler ways — for instance, if the synthetic-trained probe overfits to a narrow direction that happens to align with a tokenization artifact, the failure on natural-language targets could reflect poor generalization rather than a direct tokenization mismatch. The correlation analysis would help distinguish these explanations. Regarding a fixed-tokenizer control: this would require regenerating all completions with a shared BPE across three model families, which is a substantial experimental effort. We will scope this for follow-up work but believe the two analyses above, combined with the existing asymmetry argument, substantially narrow the space of tokenization-based explanations. We will revise the manuscript to make revision: no
-
Referee: §5, Table 3: The argument against a tokenization confound for the cross-dataset transfer asymmetry is made verbally rather than empirically. The paper should characterize tokenization differences across datasets and explain why the asymmetry argument is robust to them, or provide a fixed-tokenizer control.
Authors: We agree that the tokenization argument should be supported empirically rather than only verbally. We will add two analyses in revision. First, a quantitative characterization of tokenization differences across all seven datasets: for each dataset, we will report the distribution of tokens-per-character, vocabulary overlap with the synthetic Count/Countdown sets, and average BPE fragment length. This makes the tokenization landscape explicit and lets the reader assess whether datasets that transfer well to each other also share similar tokenization profiles. Second, we will test whether tokenization similarity between a train-target pair predicts the off-diagonal transfer MAE: if tokenization mismatch were the load-bearing explanation, this correlation should be high; if it is not, the correlation should be weak. We expect the latter, given the asymmetry — the tokenization gap between OpenThoughts-1k and Count is the same in both directions, yet transfer succeeds one way and fails the other. A pure tokens-per-character confound predicts symmetric failure, not asymmetric. We acknowledge, however, that tokenization could interact with probe-fitting dynamics in subtler ways: for instance, if the synthetic-trained probe overfits to a narrow direction that happens to align with a tokenization artifact, the failure on natural-language targets could reflect poor generalization rather than a direct tokenization mismatch. The correlation analysis would help distinguish these. Regarding a fixed-tokenizer control: this would require regenerating all completions with a shared BPE across three model families, which is a substantial experimental effort. We will scope this for follow-up work but believe the two analyses above, combined with the existing asymmetry argument, meaning revision: no
-
Referee: §5, Table 3: The argument against a tokenization confound for the cross-dataset transfer asymmetry is made verbally rather than empirically. The paper should characterize tokenization differences across datasets and explain why the asymmetry argument is robust to them, or provide a fixed-tokenizer control.
Authors: We agree that the tokenization argument should be supported empirically rather than only verbally. We will add two analyses in revision. First, a quantitative characterization of tokenization differences across all seven datasets: for each dataset, we will report the distribution of tokens-per-character, vocabulary overlap with the synthetic Count/Countdown sets, and average BPE fragment length. This makes the tokenization landscape explicit and lets the reader assess whether datasets that transfer well to each other also share similar tokenization profiles. Second, we will test whether tokenization similarity between a train-target pair predicts the off-diagonal transfer MAE: if tokenization mismatch were the load-bearing explanation, this correlation should be high; if it is not, the correlation should be weak. We expect the latter, given the asymmetry — the tokenization gap between OpenThoughts-1k and Count is the same in both directions, yet transfer succeeds one way and fails the other. A pure tokens-per-character confound predicts symmetric failure, not asymmetric. We acknowledge that tokenization could interact with probe-fitting dynamics in subtler ways: for instance, if the synthetic-trained probe overfits to a narrow direction that happens to align with a tokenization artifact, the failure on natural-language targets could reflect poor generalization rather than a direct tokenization mismatch. The correlation analysis would help distinguish these. Regarding a fixed-tokenizer control: this would require regenerating all completions with a shared BPE across three model families, which is a substantial experimental effort. We will scope this for follow-up work but believe the two analyses above, combined with the existing asymmetry argument, meaningfully narrow revision: no
Circularity Check
No circularity found: probes trained on external ground-truth labels, evaluated on held-out data, compared against parameter-free baselines.
full rationale
The paper's derivation chain is self-contained and non-circular. (1) The probes are trained on frozen hidden states against external ground-truth labels (r_t = T - t, Eq. 1), not against their own outputs. (2) The constant-median baseline is parameter-free (the train-split median of r_t), and the exact-countdown baseline reuses the prompt-end estimate T̂_0 with a deterministic decrement — neither is a fitted parameter renamed as a prediction. (3) The cross-dataset transfer matrix (Tables 3, 9, 10) evaluates probes on datasets never seen during training, so the transfer claims are not forced by construction. (4) The synthetic Count/Countdown results are explicitly framed as positive controls ('a probe that performs well on Count and Countdown is verifiably reading the relevant information out of the residual stream and not relying on dataset-wide regularities,' §3.7), not as evidence for the plan-like representation claim. (5) No self-citation is load-bearing: the cited works (Alain & Bengio 2018, Belinkov 2021, Lindsey et al. 2025, etc.) are by different author groups and provide methodological context, not the central premise. (6) The retraction-spike observation (§4.3) is qualitative and the paper explicitly flags its limitations, including the absence of a length-matched control — this is a correctness risk, not circularity. The skeptic's concern about prompt-content confounds is a validity threat, but it does not constitute circularity: the probe's target (ground-truth T) is external to the probe, and no prediction reduces to a fitted input by construction.
Axiom & Free-Parameter Ledger
free parameters (4)
- Probe weights (linear layer) =
trained per (model, dataset, layer) combination
- Learning rate =
2e-4
- Max steps =
4000
- Generation temperature/top-p/top-k =
T=0.7, top-p=0.8, top-k=20
axioms (4)
- standard math Linear probes recover information already linearly available in the hidden state, not computation performed by the probe itself.
- standard math The median is the optimal constant predictor under L1 loss.
- domain assumption Naturally-terminated sequences (those emitting EOS before max-length cutoff) are representative of the model's general generation behavior.
- domain assumption The cross-dataset transfer asymmetry is not explained by tokenization differences.
Reference graph
Works this paper leans on
-
[1]
The Thirty-eighth Annual Conference on Neural Information Processing Systems , year=
Refusal in Language Models Is Mediated by a Single Direction , author=. The Thirty-eighth Annual Conference on Neural Information Processing Systems , year=
-
[2]
Discovering Latent Knowledge in Language Models Without Supervision , author=. 2024 , eprint=
work page 2024
-
[3]
The Linear Representation Hypothesis and the Geometry of Large Language Models , author=. 2024 , eprint=
work page 2024
-
[4]
Understanding intermediate layers using linear classifier probes , author=. 2018 , eprint=
work page 2018
- [5]
-
[6]
A structural probe for finding syntax in word representations , author =. NAACL , year =
-
[7]
Probing Classifiers: Promises, Shortcomings, and Advances , author=. 2021 , eprint=
work page 2021
-
[8]
Emergent World Representations: Exploring a Sequence Model Trained on a Synthetic Task , author=. 2024 , eprint=
work page 2024
-
[9]
Emergent Linear Representations in World Models of Self-Supervised Sequence Models , author=. 2023 , eprint=
work page 2023
-
[10]
The Geometry of Truth: Emergent Linear Structure in Large Language Model Representations of True/False Datasets , author=. 2024 , eprint=
work page 2024
-
[11]
Representation Engineering: A Top-Down Approach to AI Transparency , author=. 2025 , eprint=
work page 2025
- [12]
- [13]
-
[14]
DeepSeek-R1 incentivizes reasoning in LLMs through reinforcement learning , volume=
Guo, Daya and Yang, Dejian and Zhang, Haowei and others , year=. DeepSeek-R1 incentivizes reasoning in LLMs through reinforcement learning , volume=. Nature , publisher=. doi:10.1038/s41586-025-09422-z , number=
- [15]
-
[16]
Understanding R1-Zero-Like Training: A Critical Perspective , author=. 2025 , eprint=
work page 2025
-
[17]
Understanding Aha Moments: from External Observations to Internal Mechanisms , author=. 2025 , eprint=
work page 2025
-
[18]
Can Aha Moments Be Fake? Identifying True and Decorative Thinking Steps in Chain-of-Thought , author=. 2026 , eprint=
work page 2026
-
[19]
Reasoning Theater: Disentangling Model Beliefs from Chain-of-Thought
Siddharth Boppana and Annabel Ma and Max Loeffler and Raphael Sarfati and Eric Bigelow and Atticus Geiger and Owen Lewis and Jack Merullo , year=. 2603.05488 , archivePrefix=
work page internal anchor Pith review Pith/arXiv arXiv
- [20]
-
[21]
Large Language Models Cannot Self-Correct Reasoning Yet , author=. 2024 , eprint=
work page 2024
- [22]
-
[23]
Transformers need glasses! Information over-squashing in language tasks , author=. 2024 , eprint=
work page 2024
-
[24]
Tokenization counts: the impact of tokenization on arithmetic in frontier LLMs , author=. 2024 , eprint=
work page 2024
- [25]
-
[26]
OLMo: Accelerating the Science of Language Models , author=. 2024 , eprint=
work page 2024
- [27]
-
[28]
Training Verifiers to Solve Math Word Problems , author=. 2021 , eprint=
work page 2021
-
[29]
Measuring Mathematical Problem Solving With the MATH Dataset , author=. 2021 , eprint=
work page 2021
-
[30]
MMLU-Pro: A More Robust and Challenging Multi-Task Language Understanding Benchmark , author=. 2024 , eprint=
work page 2024
-
[31]
TriviaQA: A Large Scale Distantly Supervised Challenge Dataset for Reading Comprehension , author=. 2017 , eprint=
work page 2017
-
[32]
OpenThoughts: Data Recipes for Reasoning Models , author=. 2025 , eprint=
work page 2025
discussion (0)
Sign in with ORCID, Apple, or X to comment. Anyone can read and Pith papers without signing in.