TL;DR
Coconut (Chain of Continuous Thought) is a way to train a language model to reason without writing its reasoning in words. At each reasoning step the model takes its last hidden state, the vector it would normally use to choose the next word, and feeds that vector straight back in as the next input. Because nothing is forced into a word, the vector can hold several candidate next steps at once, so the model can search over them instead of committing to one path.
Builds on: Continuous Thought, Chain-of-Thought Prompting, Autoregressive Model, Curriculum Learning · Leads to: later analyses of latent reasoning, such as the 2025 theory papers on superposition in continuous thought listed in the Reading guide
Why it mattered
Chain-of-thought prompting made language models much better at multi-step problems by having them write out their steps. Its cost is that every intermediate step must be a sequence of ordinary words, so a model that is working on a hard step pays the same price per token as one that is writing a filler word like "so". Coconut showed that the words are not required: the reasoning can stay in the continuous vector space the model already uses internally. The paper trained a GPT-2 base model to do this and reported that on a planning-heavy logic task, ProsQA, it beat word-based chain-of-thought while writing far fewer tokens. The idea turned "reasoning in latent space" from a loose hope into a trainable, measured method, and later work (including the 2025 theory papers the authors cite) started to explain why it works.
The problem
Three facts about language reasoning motivated the paper.
First, not every word of a reasoning chain carries reasoning. Many tokens exist only so the text reads fluently. Other tokens are the hard ones, where the model must plan which fact to use next. A word-based chain spends roughly the same amount of computation on each token, so the easy tokens cost as much as the hard ones.
Second, a word-based chain commits early. An Autoregressive Model samples or picks one next token at a time. Once it writes a wrong step, the rest of the chain is built on that mistake. On a graph search problem this shows up as a model that walks down a dead-end path, then invents an edge to escape it.
Third, a chain of words can only be trained through the words. The training signal from the final answer has to pass through a discrete choice of token at every step, and discrete choices block gradients. Coconut keeps every reasoning step as a real-valued vector, so Backpropagation can reach all of it.
The question the paper asks is simple: if the model can reason in its hidden states, can it be trained to do so, and does that help?
How it works
Coconut changes one thing about ordinary chain-of-thought decoding. Two modes alternate. In language mode the model
writes a word, as usual. In latent mode it does not write a word; it takes its last hidden state and uses that as the
input embedding for the next position. The model is told when latent mode starts and ends by two special marker tokens,
written <bot> (begin of thought) and <eot> (end of thought).
flowchart LR Q["Question words"] --> B["bot marker"] B --> L1["Hidden state 1"] L1 --> L2["Hidden state 2"] L2 --> L3["Hidden state 3"] L3 --> E["eot marker"] E --> A["Answer words"] L1 -. fed back as input .-> L2 L2 -. fed back as input .-> L3
Here is one trace of a made-up example. The question is Q. The model should reason in one continuous step and then answer in words. Imagine the hidden state is a vector of two numbers, which is far smaller than a real model's, so you can follow it by eye.
- The question tokens go in, one at a time, as ordinary word embeddings. The model runs its transformer over them and produces a hidden state at each position. Check: nothing unusual has happened yet; this is standard decoding.
- The inserted
<bot>token goes in. Its embedding is a normal word embedding. The model produces a hidden state for it; call that vector . Suppose . Check: the model has not written a word here, only computed a vector. - Instead of looking up a word for , Coconut feeds itself into the next position as its input embedding. The model runs again and produces a new hidden state . Suppose . Check: the only thing that moved from step to step is a vector; no word was chosen.
- The model feeds in as the next input and produces . This repeats for as many latent steps as the training schedule allows. In the paper the number is fixed: the model is simply padded to a constant number of latent thoughts. Check: each pass costs one forward computation of the model, which is why latent steps are cheaper than writing words.
- The
<eot>marker is inserted, and the model switches back to language mode. Its input is again word embeddings. It now writes the answer, or a few remaining words of reasoning, using the continuous thoughts as context. Check: the final tokens are generated by the same Softmax over the vocabulary as any other word.
The training procedure is what makes the latent steps useful. A model trained only on question-answer pairs learns nothing useful from the empty latent steps. So the paper uses a curriculum borrowed from iCoT, a method that gradually removes words from a reasoning chain. The stages go like this.
- At stage 0, the model trains on ordinary word-based reasoning chains.
- At stage , the first language steps are replaced by continuous thoughts. The paper uses for ProntoQA and ProsQA and for GSM8k. The removed words are not supervised at all; the continuous thoughts take their place.
- The loss is the usual next-token cross-entropy on the words that are left: the answer and the remaining reasoning. The loss is masked on the question and on the latent thoughts, so the latent vectors are never told what to say.
- Training moves to the next stage, and the optimizer state is reset.
Because the objective only asks the continuous thoughts to help predict the words after them, the vectors are free to encode whatever helps, not what the removed words said.
The math
We start from the standard language model. For an input , token embeddings go through a transformer to give hidden states , and the last hidden state sets the next-token distribution:
Here is the token embedding function and is the language model head, the matrix that turns a hidden state into scores over the vocabulary.
The latent thought in symbols
Suppose latent mode runs between positions and , where is the <bot> token and is the <eot> token. For
a position with , the input sequence is not word embeddings for those positions. It is
Each latent position reuses the hidden state of the position before it. The next-token distribution is not defined inside the latent span, because a continuous thought is not meant to be a word. The softmax of can still be computed there, and the paper uses it only to inspect what the thought seems to be about. After the span, for , the input goes back to word embeddings.
The training objective in symbols
Let the training stage be and the number of continuous thoughts be . The model makes forward passes: one per latent thought, then one more to score the remaining text. The loss is the usual negative log-likelihood over the language positions that are not masked:
where the sum skips the question tokens and the latent positions. This is the same Cross-Entropy Loss used for ordinary language modelling, applied to fewer positions. Because is a differentiable function of the parameters , the gradient of the loss reaches back through every latent step.
Why the schedule is a sequence of stages
The stage schedule can be written as a rule. At stage k, the first k language steps are replaced:
with for ProsQA, the longest reasoning chain in that dataset. The model stays in the last stage afterwards.
Results
The paper's main table reports accuracy and the average number of generated tokens for each method. The numbers below are copied from that table.
| Method | GSM8k acc. (%) | GSM8k tokens | ProntoQA acc. (%) | ProntoQA tokens | ProsQA acc. (%) | ProsQA tokens |
|---|---|---|---|---|---|---|
| CoT (words) | 42.9 | 25.0 | 98.8 | 92.5 | 77.5 | 49.4 |
| No-CoT | 16.5 | 2.2 | 93.8 | 3.0 | 76.7 | 8.2 |
| iCoT | 30.0 | 2.2 | 99.8 | 3.0 | 98.2 | 8.2 |
| Pause token | 16.4 | 2.2 | 77.7 | 3.0 | 75.9 | 8.2 |
| Coconut | 34.1 | 8.2 | 99.8 | 9.0 | 97.0 | 14.2 |
| Coconut without curriculum | 14.4 | 8.2 | 52.4 | 9.0 | 76.1 | 14.2 |
| Coconut without latent thoughts | 21.6 | 2.3 | 99.9 | 3.0 | 95.5 | 8.2 |
What these numbers mean:
- Coconut beats the no-reasoning baseline on every dataset, and beats word-based chain-of-thought on ProntoQA and ProsQA while writing far fewer tokens.
- On ProsQA, the iCoT baseline is slightly more accurate than Coconut (98.2 against 97.0), and it writes fewer tokens (8.2 against 14.2). The paper does not claim otherwise.
- On GSM8k, word-based chain-of-thought is still the most accurate method (42.9 against 34.1). Coconut's advantage is the efficiency trade-off: the paper's Figure 8 shows that when word-based reasoning is cut down step by step, accuracy falls quickly, while Coconut's accuracy degrades much less at similar token budgets.
- The curriculum matters. Without it, Coconut falls to 52.4 percent on ProntoQA and 14.4 percent on GSM8k, close to the no-reasoning baseline on GSM8k. The paper's own reading is that the model "still needs guidance to learn latent reasoning."
- Adding more continuous thoughts per step helped up to a point. On GSM8k, accuracy rose as went from 0 to 2; with the paper saw a slight drop and more variance, traced to a loss spike when three thoughts were added at the final stage transition.
- Larger models gained less. On Llama 3.2-3B, no-CoT reaches 26.0 percent and Coconut 31.7 percent. On Llama 3-8B, no-CoT reaches 42.2 and Coconut 43.6. The authors' guess is that large language-pretrained models find the switch to latent reasoning harder.
- The limits are real. Training is sequential, because each latent thought needs its own forward pass, so it is slow to train. The experiments use one base model family at small scale, and the paper's main claim is that latent reasoning is a promising direction, not a finished method that beats word reasoning everywhere.
The strongest evidence for the tree-search reading is the analysis of individual ProsQA cases. Probing the model with words after its continuous thoughts, the authors found that the value assigned to candidate nodes at the first latent step was spread across several branches, and the highest-valued branch at the second step was not a child of the first step's best guess. The paper describes this as breadth-first-like rather than greedy, which is a claim about one trained model on one dataset, not a general theorem.
Worked examples
Take a question whose reasoning chain has three language steps, trained with .
- At stage 0, the chain has three language steps and no latent thoughts. One forward pass per training example handles the whole chain. Count: 1 pass.
- At stage 2, the first two language steps are replaced by two continuous thoughts. The model makes forward passes: two for the thoughts, one for the remaining text.
- At stage 3, all three steps are replaced. Here , so the model makes forward passes.
- Interpretation: the price of latent reasoning in training is one extra forward pass per continuous thought, which is why the paper notes that training is sequential and harder to parallelise.
On ProsQA, each question asks whether a named entity reaches one of two concepts in a graph. The paper reports these numbers for the same model family.
- Word-based chain-of-thought gets 77.5 percent accuracy, using 49.4 tokens per answer on average.
- Coconut gets 97.0 percent, using 14.2 tokens per answer.
- The accuracy gain is 97.0 minus 77.5, which is 19.5 percentage points.
- The token ratio is 49.4 divided by 14.2, which is about 3.5. So Coconut writes about a third as many tokens.
- Interpretation: on this task, the continuous steps did not just save output. They made the model more accurate, and the saving in tokens came with it.
GSM8k is a set of grade-school math word problems. Here Coconut does not beat word-based chain-of-thought on accuracy, so the comparison is about trade-offs.
- Word-based chain-of-thought reaches 42.9 percent accuracy with about 25 tokens per answer.
- Coconut reaches 34.1 percent with about 8.2 tokens per answer.
- The no-reasoning baseline, which outputs the answer directly, reaches 16.5 percent with about 2.2 tokens.
- Coconut's gain over the no-reasoning baseline is 34.1 minus 16.5, which is 17.6 percentage points. Its token count is about 3.7 times the no-reasoning count and about a third of the word-based count.
- Clock time per test case on one A100 GPU, batch size 1, is 0.47 seconds for word-based chain-of-thought and 0.15 seconds for Coconut on ProsQA. Their ratio is about 3.1.
- Try it: On GSM8k, how many percentage points below word-based chain-of-thought is Coconut, and what fraction of the word-based token count does Coconut use? Answer: 42.9 minus 34.1 is 8.8 points below; 8.2 divided by 25.0 is about 0.33, so about one third of the tokens.
Reading guide
Read the paper in this order, and use the lessons below for what it assumes.
- Section 1, Introduction. Needs Chain-of-Thought Prompting and the idea that a language model predicts one token at a time, from Autoregressive Model.
- Section 2, Related work. Mentions latent computation, pause tokens and internalised reasoning. The most useful background is Continuous Thought, which names the idea that the paper makes concrete.
- Section 3, Coconut. The method. Needs the Transformer hidden state, the Softmax output layer, and the Curriculum Learning idea behind the stage schedule. The loss is the Cross-Entropy Loss from ordinary training.
- Section 4, Latent tree search. The ProsQA experiments and the analysis. Needs Tree Search and Breadth-First Search to read the claim that the model explores several branches at once; the comparison to greedy decoding also uses Beam Search as a reference point.
- Section 5, Results. Tables 1 to 5. The GSM8k dataset is described in Training Verifiers to Solve Math Word Problems; the larger models in The Llama 3 Herd of Models.
- Appendix A, datasets. How ProsQA is built, with graphs that have typical node counts of about 23 and 36 edges. Read it with Tree Search in mind.
- Section 2, the 2025 papers on superposition. The theory papers on superposition in continuous chain-of-thought (arXiv 2505.12514 and 2509.23365), which the authors cite, analyse the mechanism the paper describes informally.
Check yourself
QuestionIn one sentence, what does Coconut feed back into the model in place of a word?Show answer
It feeds the last hidden state, the vector the model would normally map to a word with the output layer, back in as the next input embedding. Nothing is decoded to a word during the latent steps.
QuestionOn ProsQA, Coconut scores 97.0 percent with 14.2 tokens, and word-based chain-of-thought scores 77.5 percent with 49.4 tokens. By how many percentage points is Coconut more accurate, and about how many times fewer tokens does it write?Show answer
The accuracy gain is 97.0 minus 77.5, which is 19.5 percentage points. The token ratio is 49.4 divided by 14.2, which is about 3.5, so Coconut writes about a third as many tokens.
QuestionWhy does the training schedule replace language steps with continuous thoughts gradually, instead of training the latent model from the start?Show answer
Training on question-answer pairs alone gives the continuous thoughts no useful target to learn from. The paper found that training directly in the final latent setting (without curriculum) performed poorly, for example 52.4 percent on ProntoQA against 99.8 with the curriculum. The stages let the model first learn word reasoning, then gradually learn to compress the early steps into latent thoughts while still being supervised by the later words.
QuestionA reader says Coconut is just a model that has learned to hide its reasoning in vectors, so it must be worse at planning than word-based chain-of-thought. What is the paper's evidence against that?Show answer
On ProsQA, a planning-heavy task, Coconut is more accurate than word-based chain-of-thought (97.0 against 77.5). The paper also reports that its continuous thoughts keep several candidate branches alive and that the best branch can change across steps, which is what a search over alternatives looks like. The claim is about one model and one dataset; the paper does not say latent reasoning is always better, and on GSM8k word-based chain-of-thought remains more accurate.
Sources
- Hao, S., Sukhbaatar, S., Su, D., Li, X., Hu, Z., Weston, J., and Tian, Y. (2024). Training Large Language Models to Reason in a Continuous Latent Space. arXiv:2412.06769.
- Code release: facebookresearch/coconut.
- Wei, J. et al. (2022). Chain-of-Thought Prompting Elicits Reasoning in Large Language Models. arXiv:2201.11903.
- Cobbe, K. et al. (2021). Training Verifiers to Solve Math Word Problems (GSM8k). arXiv:2110.14168.