Search

Search papers and lessons

Continuous Thought

Level 4 · 11 min read

Continuous thought lets a language model reason by feeding its own last hidden state back as the next input instead of writing a word, which can hold several candidate steps at once.

On this page

  • Colour = topic mix
  • Neural network basics
  • Calculus
  • Discrete math
  • Linear algebra
  • Probability
  • Architectures
  • ReadReady to readNot yet

TL;DR

A language model usually reasons by writing words, one token at a time, and each written token is fed back as the next input. Continuous thought skips the words for some steps: the model's last hidden state, a vector of numbers, is fed straight back in as the next input. Coconut, introduced by Hao and colleagues in 2024, trains a model to do this. On ProsQA, a logic task that needs planning, it reached 97.0% accuracy with 14.2 generated tokens, while ordinary chain-of-thought reached 77.5% with 49.4 tokens.

Builds on: Autoregressive Model, Chain-of-Thought Prompting, Transformer · Leads to: Tree Search as a way to read the latent steps

Where it's used

Math word problems. A model answering a grade-school problem such as "Tom has 3 bags with 4 apples in each. He eats 2. How many are left?" normally writes out each arithmetic step. In the paper's GSM8k experiments, a model trained with continuous thoughts reached 34.1% accuracy, against 42.9% for written chain-of-thought, while generating 8.2 tokens instead of 25.0. The trade is real: here the written steps were more accurate.

Planning and search problems. Logic puzzles such as ProsQA ask whether a concept follows from a set of stated rules, which means exploring many possible chains. This is the setting where continuous thought helped most, and the paper argues the reason is that a continuous vector can keep several candidate next steps alive at once.

Inference cost. A chat service pays for each generated token. A model that answers in 9 tokens instead of 92.5, as in the paper's ProntoQA results, costs far less to run per question, if its accuracy holds.

Reading the model's thoughts. Because the latent steps are vectors, a researcher can project them back onto the vocabulary and read the words they most resemble. The paper decodes some first latent thoughts on a math problem into intermediate quantities the solution needs, which gives a partial view of what the model is computing.

How it works

Take a toy question: "Fae is a wumpus. Every wumpus is a rompus. Is Fae a rompus?" The model reads the question, then it has a choice of how to continue.

  1. Read the question. Each word becomes a token, and each token becomes a vector called its embedding. The model's transformer turns the whole sequence into a stack of hidden states, one per position. Check: the last hidden state is one vector, the summary the model has at the current position.
  2. Enter latent mode with a marker. A special token, written here as <bot>, tells the model that the next steps are not words. Check: the marker is part of the input, but it is not a reasoning step.
  3. Feed the hidden state back. Normally the model would turn its last hidden state into a list of word scores, pick a word, and feed that word's embedding back. In latent mode it skips the word and feeds the hidden state itself as the next input. Check: the input sequence grows by one vector, and no word was chosen.
  4. Repeat for each latent step. The second latent step does the same with the new hidden state. Schematically, the vector might hold a mix of "wumpus" and "rompus" directions, with some weight on other candidate facts. Check: the model has not committed to one wording, so it has not thrown the other candidates away.
  5. Leave latent mode and write the answer. A second marker, <eot>, switches back to words. The model writes "Yes, Fae is a rompus." Check: the answer is in ordinary words, which is what the reader sees.
flowchart LR
  Q["Question tokens"] --> B["bot marker"]
  B --> L1["Latent step 1: feed hidden state back"]
  L1 --> L2["Latent step 2: feed hidden state back"]
  L2 --> E["eot marker"]
  E --> A["Answer written as words"]

The math

Write x1,…,xTx_1, \dots, x_T for the tokens, e(x)e(x) for the embedding of token xx, and Et=[e(x1),…,e(xt)]E_t = [e(x_1), \dots, e(x_t)] for the embedded sequence up to position tt. The transformer produces a matrix of hidden states Ht=Transformer(Et)H_t = \text{Transformer}(E_t), and hth_t is the last row, the hidden state at position tt.

Step 1 in symbols: embeddings and hidden states

Each row of HtH_t is a vector of length dd, the model width. The vector hth_t is the only one used to make the next prediction. Check: hth_t has dd numbers, the same length as each token embedding, so it can be used as an input.

Step 2 in symbols: the ordinary next-token rule

In language mode the model maps hth_t to one score per vocabulary word through a matrix WW, the language-model head, and turns the scores into probabilities with the Softmax function:

p(xt+1∣x≤t)=softmax(Wht).p(x_{t+1} \mid x_{\le t}) = \text{softmax}(W h_t).

Check: the softmax outputs are positive and add up to 1, so they form a probability distribution over words.

Step 3 in symbols: the latent step

In latent mode the next input is hth_t itself, not e(xt+1)e(x_{t+1}). After one latent step the input sequence is

Et+1=[ e(x1),…,e(xt),ht ].E_{t+1} = [\, e(x_1), \dots, e(x_t), h_t \,].

Check: the length goes up by one, as it does for a word, but the new entry is a hidden state rather than a token embedding. The paper notes that these hidden states have already passed through the final normalisation layer, so they are not too large in size.

Step 4 in symbols: training

The model is trained by cross-entropy on the answer and the written reasoning that remains. The loss is masked on the question tokens and on the latent positions, so the latent vectors are never trained to match words. Training runs in stages. At stage kk, the first kk written reasoning steps are replaced by k×ck \times c latent steps, where cc is a fixed number of latent steps per written step. Check: at stage 0 nothing is replaced, so the model is trained on ordinary chain-of-thought data first.

The paper also notes that this makes training slower. Each latent step needs its own forward pass through the network, and those passes must run one after another.

Worked examples

Example
1. Tiny case: one word step, then one latent step

Use a toy vocabulary of two words, yes and no, and a hidden state h=(1,0)h = (1, 0). Let the two rows of WW be wyes=(2,0)w_{yes} = (2, 0) and wno=(0,0)w_{no} = (0, 0).

  1. Compute the score for yes: wyes⋅h=2×1+0×0=2w_{yes} \cdot h = 2 \times 1 + 0 \times 0 = 2. Check: the dot product is 2.
  2. Compute the score for no: wno⋅h=0w_{no} \cdot h = 0. Check: the dot product is 0.
  3. Apply the softmax. The probability of yes is e2/(e2+e0)=7.389/8.389≈0.881e^2/(e^2 + e^0) = 7.389/8.389 \approx 0.881. Check: the probability of no is 1/8.389≈0.1191/8.389 \approx 0.119, and 0.881+0.119=10.881 + 0.119 = 1.
  4. Take a latent step. Instead of appending the embedding of yes, append h=(1,0)h = (1, 0) itself. Check: the new input has one more entry, and that entry is the vector (1,0)(1, 0).
  5. Interpretation. The model's preference for yes is spread across both words, and the latent step keeps that spread as a vector instead of choosing yes.
Example
2. Standard case: the GSM8k trade-off

Use the paper's GSM8k results: written chain-of-thought reaches 42.9% accuracy with 25.0 generated tokens, and Coconut reaches 34.1% with 8.2 tokens.

  1. Compute the accuracy gap: 42.9−34.1=8.842.9 - 34.1 = 8.8 percentage points. Check: 34.1+8.8=42.934.1 + 8.8 = 42.9.
  2. Compute the token ratio: 8.2/25.0=0.3288.2 / 25.0 = 0.328. Check: 25.0×0.328=8.225.0 \times 0.328 = 8.2.
  3. Compute the accuracy per token for each method: 42.9/25.0=1.7242.9/25.0 = 1.72 points per token for chain-of-thought, and 34.1/8.2=4.1634.1/8.2 = 4.16 points per token for Coconut. Check: 25.0×1.72=43.025.0 \times 1.72 = 43.0, and 8.2×4.16=34.18.2 \times 4.16 = 34.1.
  4. Interpretation. Coconut is less accurate on this task, but it gives more correct answers per generated token. The paper reports this as a better trade-off between efficiency and accuracy, not as a win on accuracy.
Example
3. Realistic case: planning on ProsQA

Use the paper's ProsQA numbers: written chain-of-thought reaches 77.5% accuracy with 49.4 generated tokens, and Coconut reaches 97.0% with 14.2 tokens.

  1. Compute the accuracy gain: 97.0−77.5=19.597.0 - 77.5 = 19.5 percentage points. Check: 77.5+19.5=97.077.5 + 19.5 = 97.0.
  2. Compute the token ratio: 14.2/49.4≈0.28714.2 / 49.4 \approx 0.287, so Coconut writes about 29% of the tokens. Check: 49.4×0.287≈14.249.4 \times 0.287 \approx 14.2.
  3. Compute tokens per correct answer, a number of our own rather than the paper's: 49.4/0.775≈63.749.4/0.775 \approx 63.7 for chain-of-thought, and 14.2/0.970≈14.614.2/0.970 \approx 14.6 for Coconut. Check: 0.775×63.7≈49.40.775 \times 63.7 \approx 49.4 and 0.970×14.6≈14.20.970 \times 14.6 \approx 14.2.
  4. Interpretation. On this planning task, Coconut is both more accurate and cheaper in written tokens. The paper's explanation is that written chain-of-thought commits early to one path, and a wrong early choice leads to hallucinated edges.

Try it: on ProntoQA, written chain-of-thought uses 92.5 tokens and Coconut uses 9.0 tokens. What is the token ratio, and what share of the tokens does Coconut write? Answer: 9.0/92.5≈0.0979.0/92.5 \approx 0.097, so Coconut writes about 10% of the tokens. Check: 92.5×0.097≈9.092.5 \times 0.097 \approx 9.0.

Common mistakes and tradeoffs

It is tempting to think that a continuous thought is the model's private language, with clear meaning in each vector. In fact a hidden state is a vector that the network computes for its next prediction, and nothing forces it to mean a single thing. The paper finds that decoding a thought onto words sometimes gives meaningful intermediate quantities, but this is partial evidence, not a readout of the whole reasoning.

It is tempting to think that latent reasoning is always better than written reasoning. In fact the paper's GSM8k results favour written chain-of-thought, 42.9% against 34.1%. The gain appears on planning tasks, where early commitment to a wrong step hurts.

It is tempting to think that the model will learn latent reasoning from the answer alone. In fact training without the staged curriculum reached 14.4% on GSM8k and 52.4% on ProntoQA in the paper, far below the staged version. Written reasoning is needed as a scaffold, and the latent steps are learned from it.

When to use continuous thought: planning or search problems where a single written path is fragile, and settings where generating tokens is the main cost. When not to use it: tasks where the written steps are themselves the answer, or where a reader must audit the reasoning in words. Alternatives include written chain-of-thought, pause tokens, which add blank computation slots without any hidden-state feedback, and methods that remove written steps gradually without feeding states back.

History

Written chain-of-thought prompting, published by Wei and colleagues in 2022, showed that asking a large model to write out intermediate steps improved its answers on multi-step problems. That made the written steps a visible and useful part of the model's computation, and it set the baseline that later work tried to beat.

Several methods then tried to make models reason with fewer written steps. Some trained models to drop the steps gradually, and others added pause tokens to give the model more computation without any text.

Hao and colleagues, working at Meta with UC San Diego, posted the continuous-thought paper in December 2024. Its contribution was to feed the hidden state back as the next input, and to show on a planning benchmark that this could beat written chain-of-thought while writing fewer tokens.

Recap

  • A language model normally chooses a word at each step, then feeds its embedding back.
  • Continuous thought feeds the last hidden state back instead, so no word is chosen for that step.
  • Training uses a staged curriculum that replaces written steps with latent steps, with the loss masked on the latent positions.
  • The gain shows on planning tasks such as ProsQA, while written reasoning remains stronger on GSM8k.

Read next: Tree Search for the search view of latent steps, and Training Verifiers to Solve Math Word Problems for the math benchmark used in the paper.

Check yourself

QuestionWhat does a model feed back as the next input during a latent step, and what does it feed back in ordinary generation?Show answer

In a latent step it feeds the last hidden state hth_t, a vector, straight back as the next input. In ordinary generation it turns hth_t into word probabilities, picks a word and feeds that word's embedding back.

QuestionA model's hidden state is h=(2,−1)h = (2, -1) and the score matrix has rows wa=(1,0)w_{a} = (1, 0) and wb=(0,1)w_{b} = (0, 1). What are the two scores, and which word is more likely?Show answer

The scores are wa⋅h=2w_a \cdot h = 2 and wb⋅h=−1w_b \cdot h = -1. Word a is more likely, because its score is higher and the softmax is increasing in the score.

QuestionWhy does the training loss mask the latent positions instead of asking them to match some word?Show answer

A latent position has no word, so there is no target to match. The masking means only the answer and the remaining written steps supply the training signal, which pushes the latent vectors to help predict those tokens rather than to compress a particular wording.

QuestionOn a math benchmark a method writes 8.2 tokens and gets 34.1% accuracy, while another writes 25.0 tokens and gets 42.9%. Why might the first still be useful?Show answer

The first method gives more correct answers per generated token, about 4.2 points per token against 1.7 for the second. It is useful where token cost is the main constraint, but it is less accurate on this task, so the choice depends on what the application values.

Sources