NeurIPS 2026QuestionsPapersAreasAboutMarkdown

How Much is Left? LLMs Linearly Encode Their Remaining Output Length

Mohamed Amine Merzouk, Dmitri Carpov, Mirko Bronzi, Damiano Fornasiere, Adam Oberman

NeurIPS page · OpenReview · Open on the map

Category: LLM Reasoning, Memory & RAG › LLM Internal Representation Bottlenecks · Type: empirical study · Keywords: LLM output length, linear probe, remaining generation length, transformer internal representation, length estimation

Areas: LLM Reasoning › Reasoning Mechanisms › Internal Representation Geometry; Evaluation & Benchmarks › Language Model and Agent Benchmarks › LLM Internal Representations

Summary

The paper shows that large language models maintain an approximate internal estimate of remaining output length, which can be linearly decoded from hidden states before generation begins.

Explained to a 5-year-old

Big computer programs called language models write sentences one word at a time. They seem to know roughly how many words they will write before they even start. We can look inside the program and see a clue about how much more it will say. This clue works for many different kinds of writing and even for new situations. When the program changes its mind and starts over, the clue updates to a longer answer.

Explained to a 5-year-old, longer

Language models are computer programs that help us write text. They write words one by one, like typing a story. Sometimes they know how many words they will write before they even start. We can look inside the program, at a special place called its hidden state, to see that clue. By using a simple tool called a linear probe, we can read that clue. The clue works for many different kinds of stories and even for new kinds of writing we haven't seen before. It also works when the program changes its mind and goes back to redo part of the answer. The clue tells us how much more the program plans to say. This helps us understand that the program keeps a rough plan of how long its answer will be. The plan is not perfect, but it is useful for knowing how much text will be generated. We can see this plan even before the program writes any words. This discovery shows that big language models have a simple way to guess their output length.

For a technical reader

The paper shows that large language models store an approximate estimate of how many tokens they will generate, which can be extracted from their hidden representations. By training simple linear probes on frozen model states across multiple datasets, the authors demonstrate that this length estimate is linearly decodable before any output is produced. The learned probes generalize to unseen tasks and synthetic completions, and they even capture dynamic changes when the model backtracks or restarts a partial answer. This behavior suggests that transformers maintain a plan-like internal representation of output length, distinct from exact counting mechanisms. The findings could enable better control over generation length and provide insight into how models reason about their own outputs.

Problem

It is unclear whether language models retain an internal sense of how much output they will generate. This work investigates if such an estimate exists and can be recovered from model hidden states without any output tokens.

Method

The approach trains simple linear probes on frozen hidden states of several 7-8B models across multiple datasets to decode remaining length. These probes are evaluated on natural-language and synthetic completions, and their behavior is examined during retraction events.

Results

The approach finds that remaining length is linearly decodable from hidden states, that probe directions transfer across datasets and synthetic completions, and that the estimate shifts during retraction events.

Contributions

The work demonstrates that LLMs maintain an approximate internal representation of remaining output length, shows its decodability across models and tasks, and reveals its dynamic adjustment during retraction.

Research questions this paper is counted under

This page was written by language models from the title and abstract of each paper, and the answers were checked by two other models. It can be wrong: check the paper itself. Suggest a correction