---
title: "Training Large Language Models to Reason in a Continuous"
description: "Coconut trains language models to reason through continuous hidden states, improving some logic tasks while using fewer generation steps."
canonical: "https://research.elamur.ai/free/en/papers/hao-2024-training-large-language-models-reason/"
---
Elamur: [Mova](https://md.mova.elamur.ai/free/en/) · [Parse](https://mova.elamur.ai/free/en/parse/) · [Dictionary](https://md.dictionary.elamur.ai/free/en/) · [Translate](https://md.translate.elamur.ai/free/en/) · **Research** · [Gali](https://md.gali.elamur.ai/free/en/) · [MCP](https://mcp.elamur.ai/) · [Locations](https://md.locations.elamur.ai/free/en/) · [Weather](https://md.weather.elamur.ai/free/en/)

[Elamur Research](https://md.research.elamur.ai/free/en/) · [this page in HTML](https://research.elamur.ai/free/en/papers/hao-2024-training-large-language-models-reason/)

[Elamur Research](https://md.research.elamur.ai/free/en/) / [papers](https://md.research.elamur.ai/free/en/papers/) / [2024](https://md.research.elamur.ai/free/en/papers/2024/) / Training Large Language Models to Reason in a Continuous Latent Space

# Training Large Language Models to Reason in a Continuous Latent Space

Paper · 2024 · Shibo Hao, Sainbayar Sukhbaatar, DiJia Su et al.

**Authors:** [Shibo Hao](https://md.research.elamur.ai/free/en/authors/shibo-hao/), [Sainbayar Sukhbaatar](https://md.research.elamur.ai/free/en/authors/sainbayar-sukhbaatar/), DiJia Su, [Xian Li](https://md.research.elamur.ai/free/en/authors/xian-li/), [Zhiting Hu](https://md.research.elamur.ai/free/en/authors/zhiting-hu/), [Jason Weston](https://md.research.elamur.ai/free/en/authors/jason-weston/) and [Yuandong Tian](https://md.research.elamur.ai/free/en/authors/yuandong-tian/) · **Year:** 2024 · **Venue:** arXiv:2412.06769 · **Licence:** [arXiv — non-exclusive licence to distribute](http://arxiv.org/licenses/nonexclusive-distrib/1.0/)

[Cited by **165** papers in our library of the 163,136 papers whose bibliographies we read](https://md.research.elamur.ai/free/en/papers/hao-2024-training-large-language-models-reason/cited-by/) · [licence](http://arxiv.org/licenses/nonexclusive-distrib/1.0/)

- [PDF](https://arxiv.org/pdf/2412.06769)
- [arXiv 2412.06769](https://arxiv.org/abs/2412.06769)

## Summary

When a system works through a problem in words, each word it writes becomes part of the context for its next move. That gives it a record of what it has worked out, but it can also commit the system to a choice before it has enough information. In a logic puzzle, for example, several rules may apply at the start. The importance of choosing among them becomes clear only after following their consequences. The authors use this kind of problem to ask whether [large language models](https://md.research.elamur.ai/free/en/concepts/large-language-models/) can do some of their [reasoning](https://md.research.elamur.ai/free/en/topics/reasoning/) before choosing how to put it into words.

Their method, Coconut, short for Chain of Continuous Thought, feeds the system’s latest hidden state directly back into its input. A hidden state is a vector of numbers produced during computation. In a conventional chain of thought, the system uses that vector to pick a text token, then feeds in the embedding associated with the chosen token. Coconut skips that conversion during a designated stretch. The markers `<bot>` and `<eot>` bracket the stretch, after which the system resumes producing text. The vector feedback is differentiable, so training on the answer and any remaining written steps can also shape the earlier hidden states that helped produce them.

The training starts with complete written solutions and gradually replaces their opening steps. A setting called `c` controls how many continuous steps take the place of a written one. On GSM8k math word problems, the reported results improve as `c` moves from 0 to 1 to 2. With 6 continuous thoughts, Coconut reaches 34.1% final-answer accuracy on the GSM8k test set, versus 16.5% for direct-answer training. It also exceeds iCoT, a baseline that gradually removes written reasoning, while full written chain of thought retains the highest accuracy in that comparison. On the ProntoQA and ProsQA logic tasks, Coconut exceeds written chain of thought in accuracy while using fewer generation steps by the paper’s measure. Training directly on questions and answers with continuous feedback yields results in the range of direct-answer training, making the staged curriculum important to the reported gains.

ProsQA was built to test choices among competing logical paths. When the authors ask Coconut to put an early hidden state into words, several plausible next concepts can receive substantial probability. A later probe can favor a descendant of a concept that initially ranked lower. The authors interpret this as evidence of search resembling breadth-first exploration, with decisions becoming firmer farther along the graph. A separate math probe often yields text associated with intermediate quantities. Together, the probes show what can be recovered from the states and motivate a closer look at how the system uses them.

## Deep dive: Training Large Language Models to Reason in a Continuous Latent Space

Coconut trains language models to reason through continuous hidden states, improving some logic tasks while using fewer generation steps. · about 38 minutes to read

**In this deep dive**

1. [The problem and its context](#dd-the-problem-and-its-context)
2. [The method, step by step](#dd-the-method-step-by-step)
3. [Experiments and results](#dd-experiments-and-results)
4. [What the ablations show](#dd-what-the-ablations-show)
5. [Limitations](#dd-limitations)
6. [What came after](#dd-what-came-after)

### The problem and its context

#### What a written solution does during computation

A written chain of thought serves as both an explanation a person can read and a sequence the system can use while working. Suppose a word problem requires finding how much an item costs per unit before calculating the total. As soon as the intermediate cost has been written, the system can consult it when forming the next part of the answer. A proof can work similarly. A sentence establishing that a named entity belongs to a class can supply the premise for a later inference. The important feature is the return of generated material to the input. Successive passes can build on one another.

The authors take that idea from the literature on chain of thought. Their account includes demonstrations in a prompt, as in [Chain-of-Thought Prompting](https://md.research.elamur.ai/free/en/papers/wei-2022-chain-thought-prompting-elicits-reasoning/), as well as training that teaches the system to produce intermediate solutions. They group decomposition methods with this broad family because the reasoning is still expressed in language. They also cite approaches that learn from written solutions through supervised [fine-tuning](https://md.research.elamur.ai/free/en/concepts/fine-tuning/) or improve written reasoning through reinforcement learning. These approaches differ in how they teach or elicit the intermediate text. Coconut changes what is passed forward during part of the computation.

The paper draws on theoretical work connecting chain of thought to the effective depth of a [transformer](https://md.research.elamur.ai/free/en/concepts/transformer/). Here, depth refers to how many successive computations can build on earlier results. The architecture can have the same layers throughout generation while the overall calculation grows through repeated uses of those layers. Each generated token can affect the next forward pass. Coconut keeps that repeated computation and changes the representation moving between passes. The authors’ question is whether the extra depth can be retained while allowing the state being passed along to carry information that has yet to be expressed in words.

#### Why early choices matter

A written step can take several tokens. A token is a unit of text from the system’s vocabulary, and a word or a fictional name can span several of them. Generating those tokens involves repeated passes. The authors argue that the work represented by different tokens is uneven. Some mainly make the sentence readable. Another can determine which rule an entire deduction will follow. The standard decoding process assigns roughly similar computational resources to producing each token, even when the consequences of its selection differ greatly.

Planning makes that mismatch easy to see. An inference can be locally valid and still lead away from the requested conclusion. A greedy decoder chooses whatever token has the highest probability at the current position. It then conditions on that choice as it writes the rest of the proof. Should the resulting path lead to a dead end, a successful recovery would require the system to recognize the problem and change course in its subsequent text. The paper’s discussion of [Language Models Are Greedy Reasoners](https://md.research.elamur.ai/free/en/papers/saparov-2022-language-models-greedy-reasoners-systematic/) identifies this as a challenge for written reasoning on formal problems.

Earlier work took several approaches to the allocation of reasoning effort. [Text and Patterns](https://md.research.elamur.ai/free/en/papers/madaan-2022-text-patterns-effective-chain-thought/) analyzed the roles played by different components of written reasoning and used that analysis to encourage concise chains. [Quiet-STaR](https://md.research.elamur.ai/free/en/papers/al-2024-quiet-star-language-models-teach/) explored additional reasoning before token prediction. Both address the possibility that some parts of a sequence deserve more work than others. Explicit search approaches provide another option. The paper cites [Self-Evaluation Guided Beam Search](https://md.research.elamur.ai/free/en/papers/xie-2023-self-evaluation-guided-beam-search/) and [Reasoning with Language Model is Planning with World Model](https://md.research.elamur.ai/free/en/papers/hao-2023-reasoning-language-model-is-planning/) among the work on reasoning with search. A search procedure can propose and evaluate several candidate continuations. Other work cited by the authors trains systems on search trajectories, exposing them to the succession of choices that a search procedure makes.

Coconut moves the question of how to handle alternatives into the representation passed from one computation to the next. If a vector retains information relevant to several deductions, a later pass can use that information before the system writes a conclusion. This is a possibility opened by the interface. The training procedure and the ProsQA analyses address whether it is a possibility the system actually uses. The authors also draw motivation from neuroscience work separating certain kinds of human reasoning from activity in the brain’s language network. That comparison motivates the question about the role of language. The experiments themselves concern learned computation and the consequences of changing its inputs.

#### What latent reasoning meant in previous work

A system that writes every intermediate step already performs hidden computation. The paper describes earlier experiments in which researchers recovered an intermediate variable from internal representations in problems requiring linked inferences. Other work intervened on hidden representations or investigated whether alternative reasoning paths were present in parallel. Studies of [unfaithful chain-of-thought explanations](https://md.research.elamur.ai/free/en/papers/turpin-2023-language-models-don-t-always/) also matter here. If a written explanation can diverge from the computation that determined an answer, a transcript provides only part of the available evidence. Coconut makes a particular hidden computation part of the next input, which gives the authors a specific sequence of states to investigate.

Some earlier methods explicitly gave the system room to compute before speaking. A learned pause token supplies another position between the question and the answer. Repeated filler tokens can provide several such positions. A discrete planning token can also carry information about what should follow. These methods motivate a comparison that runs through the paper. An extra input position gives the transformer another opportunity to compute. Feedback of a freshly calculated hidden state may add something more, because the vector supplied at that position depends directly on the preceding computation. Coconut’s pause variants help test the importance of that difference.

Earlier research also tried to internalize written reasoning. Some approaches transferred behavior from a system trained with explanations. The most direct precursor to Coconut’s curriculum, iCoT, progressively removes the beginning of the written chain until the system can respond directly. The paper also discusses looped transformers and recurrent memory systems, which pass or update continuous information across computations, as well as approaches that operate in a sentence embedding space. That work gives several precedents for recurrence or continuous representation. Coconut’s particular combination is feedback from the final hidden state of an otherwise familiar decoder, together with a curriculum that introduces the feedback as written supervision recedes.

### The method, step by step

#### Following a token and following a vector

Start with the usual text generation path. The system converts each token it receives into an embedding, a vector that can enter the transformer. The transformer produces an updated representation at each position by processing the available context. The final-layer representation at the latest position is the one normally used to predict the next token. A learned output layer maps it to scores for the vocabulary. Converting those scores to probabilities lets the decoder select a token. That token has its own input embedding, which enters the next round of computation.

Coconut introduces a second route from the latest hidden state to the next input position. During latent reasoning, the state itself takes the place normally occupied by an embedding looked up from the vocabulary. The hidden state produced after processing the start marker supplies the first such input. Processing that input produces a new latest state, which can supply the next input in turn. The process uses vectors continuously through the designated stretch. Here, “continuous” describes the representation: its entries can vary over real values rather than identifying a token from a finite vocabulary.

The paper calls each reused state a continuous thought. That term refers to the vector’s role in the computation. A written step might express an entire deduction, sometimes across several tokens. A continuous thought occupies a single input position. The curriculum can allocate several such positions to the removal of a written step, and the vector at any of them can carry information affecting later reasoning or the answer. Its role is determined by what happens when the system consumes it.

How Coconut answers a question The steps in order.

The markers are ordinary vocabulary items with a special purpose. `<bot>` goes immediately after the question in the problem-solving setup. Its presence marks the transition into the feedback procedure. `<eot>` marks the return to tokens. From there, the system can write the rest of a proof or go straight to the answer, depending on the setup. The vectors already used as inputs are part of the context for that return. Their contribution can therefore extend to more than the first token written after the switch.

#### The ordinary decoder in the paper’s notation

The notation begins with the sequence and its embedded prefix. The sequence names the input tokens, while the prefix is the part processed up to the position where a prediction will be made.

```
x = (x₁, …, xₜ)
```

In this expression the endpoint subscript on the right denotes the full sequence length, written as capital `T` in the paper. `x` is the full input sequence, `x₁` is its first token, and the ellipsis indicates the intervening tokens. For the rest of the notation, lower-case `t` is a current position anywhere in that sequence, and `xₜ` is the token at that current position.

```
Eₜ = [e(x₁), …, e(xₜ)]
```

`Eₜ` is the ordered input up to and including position `t`. The function `e` maps each token to its input embedding. The brackets indicate the sequence of vectors, and the ellipsis stands for the embeddings of the intervening tokens. In standard language mode, this lookup supplies each entry in `Eₜ`.

```
Hₜ = Transformer(Eₜ)
```

`Transformer` denotes the computation that processes the embedded prefix. `Hₜ` contains the final-layer hidden states at the positions in that prefix. The subscript `t` again identifies how far the computation has progressed.

```
Hₜ ∈ ℝ^(t × d)
```

`ℝ` denotes the real numbers, and `∈` means that `Hₜ` belongs to the stated space of matrices. There are `t` rows, one per position, and `d` entries across each row. `d` is the width of a hidden state, and `×` separates the dimensions of the matrix.

```
hₜ = Hₜ[t, :]
```

`hₜ` is the hidden state at the current position. The `t` inside the brackets chooses row `t`, and `:` selects all its entries. The other rows contain states at earlier positions. It is the final row for the current prefix that provides the vector for the next move.

```
ℳ(xₜ₊₁ ∣ x≤ₜ) = softmax(W hₜ)
```

`ℳ` is the language model viewed as a predictor. `xₜ₊₁` is the next token, and `x≤ₜ` denotes the tokens through position `t`. The vertical bar means the prediction is conditioned on that prefix. `hₜ` is the current hidden state. `W` contains the weights of the output layer, called the language model head, and multiplying it by `hₜ` produces a score for each possible next token. `softmax` turns those scores into a probability distribution. The prediction for a particular token is its entry in that distribution.

This separation between the output layer and the embedding lookup is central to the method. When generation is in language mode, a hidden state contributes to a vocabulary prediction, the decoder picks an item, and the lookup supplies a vector for that item. Many different hidden states can lead to the same token choice. Feedback of the original state keeps the vector available to the next pass even when a vocabulary decision would have collapsed these different states to the same input.

#### How the latent positions fit into the sequence

Let `i` be the position of `<bot>` and `j` the position of `<eot>`. The authors give the embedded input inside the latent interval as follows.

```
Eₜ = [e(x₁), …, e(xᵢ), hᵢ, hᵢ₊₁, …, hₜ₋₁]   for i < t < j
```

`Eₜ` again gives the input vectors through position `t`. `e(x₁)` through `e(xᵢ)` are embeddings of the text prefix, including the start marker at `i`. `hᵢ` is the hidden state computed at that marker, so it serves as the input immediately after it. `hᵢ₊₁` is the state computed at the subsequent position, and `hₜ₋₁` is the state supplied to position `t`. The ellipses denote intervening text embeddings or successive hidden states as appropriate. The inequalities specify that the current position is strictly inside the marker boundaries.

After the switch back to language mode, the input takes the following form.

```
Eₜ = [e(x₁), …, e(xᵢ), hᵢ, …, hⱼ₋₂, e(xⱼ), …, e(xₜ)]   for t ≥ j
```

Here `j` is the end-marker position, and `e(xⱼ)` is its embedding. The states from `hᵢ` through `hⱼ₋₂` occupy the positions strictly between the markers under the preceding position convention. In particular, the input at the last such position, immediately before `j`, comes from the state at `j` minus two positions. The next entries are token embeddings again, up through `e(xₜ)`. The inequality includes both the end marker and subsequent positions. The paper’s displayed post-switch sequence extends the state suffix through `hⱼ₋₁`. With the marker fixed at `j` and the stated feedback rule inside the interval, that last state is the one computed at the final latent position, while `e(xⱼ)` supplies the next input. The position-by-position rule makes the switch explicit.

These are final-layer states that have passed through the final normalization layer. The authors point out that this keeps their magnitudes from becoming excessively large when used as inputs. A latent position calls for the vector itself as the next input. The vocabulary head is still available as an instrument. Applying it to an intermediate state, or switching to language early and decoding subsequent text, can help reveal what the state makes available. The ProsQA analysis uses early switching to ask which concept the system is prepared to write.

#### Where the training signal comes from

Each training example contains a question, a written chain divided into reasoning steps, and an answer. The initial stage uses the full written solution. It establishes the task in the familiar format before any parts of the explanation are removed. The later stages work from the beginning of the solution. A new stage removes another opening written step while keeping the later steps and answer available as targets whenever the example has such a suffix. Accordingly, the first hidden computations introduced by the curriculum have a concrete downstream job: give the system enough context to continue the written reasoning at a later point.

```
k × c
```

`k` is the stage index after the initial stage and gives the number of opening written steps scheduled for removal. `c` is the chosen number of continuous thoughts allocated per step under this schedule. `×` denotes multiplication. A shorter solution can run out of written steps before the stage’s removal count is reached. The authors remove the entire written chain in those cases. `<bot>` and `<eot>` enclose the continuous portion and are separate from the count of thoughts controlled by `c`.

The order of replacement matters to the task each stage presents. Early in training, a hidden prefix can hand off to a written suffix that is already familiar from the preceding stage. As the curriculum progresses, more of the reasoning needed to produce that suffix must be done through the vector feedback. Eventually the answer can become the only substantive output target. The authors reset the optimizer state at stage boundaries, following iCoT. The learned parameters carry the behavior forward, while the optimizer’s accumulated state starts afresh when the format changes.

The loss is ordinary negative log-likelihood on the unmasked targets. One way to write the loss described in the paper is to sum the penalty on each supervised position.

```
ℒ = −∑ₛ∈ᵁ log pₛ(yₛ)
```

`ℒ` is the loss for the sequence, `∑` denotes a sum, and `s ∈ U` ranges over positions in the set `U` of unmasked text targets. `yₛ` is the reference token at position `s`, and `pₛ(yₛ)` is its predicted probability given the preceding context, including any continuous inputs. `log` is the logarithm, and the minus sign makes low assigned probability incur a larger penalty. The authors mask the question and the latent thoughts. The remaining written reasoning and the answer provide the supervision relevant to replacing the opening steps.

This objective is important to the interpretation of a continuous thought. A removed deduction is useful to the designers because it marks the part of the solution that the curriculum is asking the system to handle internally. The loss rewards a subsequent correct continuation. A vector can help predict that continuation by carrying a result, by preserving several candidates that matter for the rest of the proof, or by carrying information the output head would express poorly on its own. The objective leaves these representational choices to training. A human-readable rendering of a vector is therefore a diagnostic of what can be recovered from it.

#### How training and inference execute the feedback

Each continuous input depends on the hidden state calculated in the preceding pass. The newly computed vector is needed before the system can use it as input and calculate another one. The paper counts the forward passes required during training as follows.

```
n + 1
```

`n` is the number of scheduled continuous thoughts. The additional `1` is the forward pass that produces predictions for the remaining text and makes the loss available. The plus sign combines the passes that construct the latent prefix with that final pass. Back-propagation can follow the chain of vector operations to the earlier states and parameters. The same later loss can consequently give a learning signal to several successive continuous computations.

The authors note that a key-value cache can retain computations from earlier input positions. A cache is useful because the question and the preceding inputs remain available when a new state is appended. The dependency between successive thoughts remains serial. During training, the continuous prefix has to be built before the full remaining text can contribute its loss. That introduces a training parallelism cost alongside the potential inference savings from shorter reasoning traces.

At inference, `<bot>` follows the question, and the feedback mechanism runs until the transition back to language. The authors consider a learned binary classifier that would examine a latent state and decide whether the system should stop reasoning in that mode. They also consider a constant latent length. The paper describes the two options as performing comparably and uses the fixed length for simplicity in the main experiments. On the ProsQA probe, the authors deliberately change that length while holding the trained weights fixed. This turns a deployment choice about the transition point into an experimental control.

### Experiments and results

#### Three datasets with different demands

GSM8k tests arithmetic in grade-school word problems. The experimental training data for this part come from a synthetic dataset generated in earlier work on implicit chain-of-thought distillation. The task still requires interpreting a written situation before deciding which quantities to calculate. An example in the paper asks for the annual cost of repeated lawn mowing given a growth rate, a cutting threshold, and a price per visit. The written solution first works out the growth between cuts, then the interval between visits, then the number of visits and the cost. It illustrates what the curriculum removes when it replaces an opening part of the calculation.

Given a set of explicit facts and rules, ProntoQA checks whether they imply a conclusion. The paper’s example asks whether a claim about an individual is true or false. The proof follows a series of class memberships until it reaches a property that determines the label. Other premises mention different classifications and properties. Generating a valid solution requires selecting facts relevant to the particular individual and to the property in the question. Here a written step expresses an inference through the supplied rules, whereas in GSM8k a step can be an arithmetic expression.

ProsQA, or Proof with Search Question-Answering, makes the choice among paths a more central part of the task. The authors construct a directed acyclic graph. Its edges indicate the direction in which an inference is licensed, and following directed edges cannot bring the reasoner back to a node it has already visited on the same path. Written statements describe the edges. The question names an entity and offers a choice between concepts. The graph has a path from the queried entity to the correct concept, while the alternative is drawn from a different reachable family. The generated graph includes branches that can support valid intermediate inferences and still fail to answer the question asked.

The construction adds nodes and connects them incrementally. The authors sometimes restrict which families can share a descendant, keeping parts of the graph sufficiently separate to support the binary question. They also aim to balance family sizes so the shape of the graph provides fewer shortcuts. Nodes without parents receive entity names, and other nodes are given invented concept names. The order of the candidate concepts is randomized. These controls focus the evaluation on the relationships stated in the example. The intended deduction works by following those relationships from the entity to a target.

The paper’s example about Tom makes the difference between local validity and global usefulness concrete. Tom has more than one starting classification. The proof given in the data goes through terpus and brimpus to reach lempus. The premises also support other deductions, including paths that help establish classifications for other entities. The task is to identify what can be concluded about Tom among the offered alternatives. A chain can remain consistent with the premises and still stop at a concept that answers a different question. That is the failure ProsQA is designed to expose.

#### Training schedules and evaluation

The main comparison uses a pretrained GPT-2 base. In the ProsQA analysis setup the learning rate is `1 × 10⁻⁴`, with an effective batch size of 128. An effective batch size describes how many examples contribute to a parameter update. In this analysis the maximum proof length is 6 reasoning steps, and the curriculum extends through that depth. Each scheduled stage is allotted 5 epochs, with training continuing at the last stage until the overall run reaches 50 epochs. An epoch is a pass through the training data at the current stage. The evaluation uses a checkpoint selected for accuracy from the final stage.

In the main logical reasoning experiments, `c = 1` for ProntoQA and ProsQA. The authors use 6 replacement stages in addition to initial training on written solutions, matching the maximum of 6 reasoning steps in those settings. At the final stage the answer can be generated after reasoning wholly in continuous steps. The scheduled stages use 5 epochs each. The fixed number of thoughts at inference is chosen to match the setup the system saw at the end of its training.

For GSM8k the allocation is `c = 2`. The initial written stage takes 6 epochs. The next 3 stages each remove another opening step, and the authors include a further stage that keeps `3 × c` continuous thoughts and clears the remaining written reasoning. This final transition accounts for the examples with solutions longer than 3 steps. The later scheduled stages use 3 epochs each. The number of positions allocated to latent reasoning stays the same at the last transition even though some examples lose additional written material. That distinguishes the final change in supervision from the earlier increases in latent length.

Across the main comparisons, training stays in the final stage until 50 epochs have been reached. The authors select a checkpoint by validation accuracy and use greedy text decoding during evaluation. That distinction between validation and evaluation matters. Validation accuracy is the basis for choosing the saved weights. The reported final-answer results concern performance on the evaluation cases. The separate ProsQA intervention changes where decoding resumes during inference with a shared set of weights.

#### What the comparison systems control for

The full CoT baseline trains on written solutions and generates the complete chain before giving an answer. No-CoT trains directly on questions and answers and generates the answer without a written proof. They measure two ends of the range the authors want to examine: a supervised written reasoning process and a direct response. The comparison says how Coconut fares against these particular training and decoding regimes on a shared task. The full written baseline retains the longer intermediate sequence that is capable of supplying more context during computation.

iCoT also starts from written solutions. It gradually removes opening tokens according to its own schedule, aiming to internalize the intermediate reasoning so that inference can go straight to the answer. This is especially relevant for judging gains on GSM8k. It tests whether the payoff of Coconut comes from the staged exposure to explanations alone or whether the addition of state feedback can improve performance compared with a well-developed removal curriculum.

The pause-token baseline receives question and answer supervision with learned pause tokens between them. The number of pause positions matches the number of continuous thoughts in Coconut. A pause adds a position for hidden computation, while the input at that position comes from a token embedding. Coconut’s corresponding position gets the state just calculated from the example. This baseline controls for the presence of extra positions under direct answer supervision. A separate variant, pause as thought, combines pause positions with the staged curriculum and addresses the same representational question under closer training conditions.

#### Final answers and generation cost

The common accuracy metric is whether the final answer is correct. On the GSM8k test set, Coconut with 6 continuous thoughts reaches 34.1% accuracy. No-CoT reaches 16.5%. The chart compares these settings on the same final-answer measure.

Coconut and No-CoT on GSM8k test final-answer accuracy Continuous state feedback with staged training yields more correct answers than direct-answer training.

**The numbers**

| System or setting | accuracy % |
| --- | --- |
| No-CoT | 16.5 |
| Coconut with continuous thoughts (this paper) | 34.1 |

On GSM8k, Coconut also exceeds iCoT and the variants that follow Coconut’s training strategy with pauses or without added thoughts. Full written CoT remains ahead in final-answer accuracy. The efficiency claim comes from the accuracy achieved at shorter reasoning lengths. The paper compares Coconut to systems trained to skip more of their written reasoning, and accuracy falls away more quickly in that series. Coconut can retain more of the benefit of the explanation while replacing parts of it with fewer positions. This is a tradeoff across settings. A reader choosing solely on the highest GSM8k accuracy among the reported comparisons would still favor the full chain.

On ProntoQA and ProsQA, the main Coconut comparison yields higher final-answer accuracy and fewer generation steps than written CoT. Some of the alternatives with the staged curriculum also perform strongly on the logic tasks. This combination of findings is consequential for the interpretation. The logic results demonstrate that a shorter route to a prediction can also be a more accurate route in those tasks. The strong curriculum variants show that the contribution of the continuous vector depends on what the task demands and on how the training moves supervision from the explanation to the answer.

Alongside the sequence-length comparison, the paper reports the mean elapsed time for each test case in seconds, using an Nvidia A100 GPU and a batch size of one. The No-CoT and CoT baselines use the standard text generation implementation named by the authors. The reported timing generally tracks the number of newly generated tokens under those conditions. The hardware, batch size, and implementation give that finding its meaning. Token or position counts help describe how much sequential generation takes place. The timing check measures how that difference translates into latency in the particular implementation used for evaluation.

#### What counts as a good proof

ProsQA gives the authors a way to go beyond final-answer accuracy. They can compare the written path against the graph that generated the problem. A Correct Path is a shortest valid route to the answer. A Longer Path reaches the right answer through valid inferences but takes a longer route. Hallucination identifies a chain with an edge absent from the graph or with disconnected pieces. Wrong Target covers an internally valid path ending at a destination other than the one sought in the question. These categories distinguish a failure to respect the premises from a failure to select a useful sequence of valid premises.

In a hybrid run, Coconut may write only the remainder of a proof. The authors evaluate that visible remainder according to whether it can be completed with a valid prefix. The same distinctions about path length and destination can then be applied. When the system writes only an answer, as No-CoT does and Coconut can do at larger latent lengths, the authors classify it by whether the label is correct. These outcome types let a reader see how errors change as the output format changes. A complete written proof gives direct evidence about each printed edge. A plausible suffix establishes that at least one valid complete proof is compatible with what was printed.

#### Checks with larger starting systems

The paper also applies Coconut to GSM8k with Llama 3.2-3B and Llama 3-8B. These runs use `c = 1`, with 3 epochs in Stage 0 and 1 epoch per subsequent stage. The comparison for both is against direct-answer training. Coconut improves performance in both cases, with smaller gains than the authors observed with GPT-2. This extends the observation that a staged latent variant can beat its direct-answer baseline to additional starting systems. The larger-system comparison addresses that specific baseline. The relative performance of full CoT at those sizes is a separate question.

### What the ablations show

#### Learning the transition matters

One of the most direct controls removes the curriculum. The system still receives continuous feedback and has to solve the problem before producing its answer. It starts at the final format, with the justification absent from its training targets. This variant performs at the level of No-CoT in the paper’s experiments. The contrast with full Coconut shows that providing a differentiable route from answer loss into preceding states is insufficient under that schedule. The successful setup gives the system experience both writing the explanations and continuing them after an increasingly long latent prefix.

This result helps distinguish what the architecture permits from what the training achieves. Once a suitable continuous state exists, the feedback interface can pass it along. Learning useful states from answer supervision poses a different problem. The same incorrect answer can result from failures at many points in a calculation or proof. A written suffix gives the learner intermediate targets on the way to the answer during the earlier transitions. The paper’s result supports the combined training procedure. The comparison changes the whole staged exposure, so the contribution of individual features such as the optimizer reset or the initial written stage remains open.

The variant without thoughts keeps the replacement schedule but adds no continuous states. Written steps vanish on Coconut’s timetable. This makes it a closer schedule control than iCoT, whose removals follow a finer-grained procedure. On GSM8k, the full Coconut system does better than this variant. With the same coarse curriculum, supplying the continuous positions helps beyond the behavior that can be learned by gradually shortening the target. The authors also report a small gap between the no-thought variant and iCoT. They identify the finer token-level removal in iCoT and other differences in its training procedure as possible explanations. The comparison changes several details together, which leaves the explanation tentative.

#### Pause positions help separate time from feedback

The pause-as-thought variant uses the same staged approach and inserts pause tokens where Coconut would feed back hidden states. This comparison gives both systems extra positions associated with the removed reasoning. A pause token still allows its transformer activations to depend on the question and previous positions. Coconut supplies an additional example-dependent input because the vector at a new position is the previous computation’s latest hidden state. The control is informative precisely because hidden computation is present in both variants.

Coconut outperforms pause as thought on GSM8k. That result favors the feedback representation over the pause replacement for the tested math setting. On the synthetic logic tasks, pauses, the no-thought variant, and iCoT can all achieve strong results. The authors suggest that available computational capacity may be less of a constraint there. One reason to keep both observations in view is that a task can reward successful internalization under several procedures, while another can be more sensitive to what passes between forward steps. The largest claim warranted by these controls is tied to the task and schedule under comparison.

#### More thoughts help within a range

The experiments vary `c`, the number of continuous thoughts allocated per removed written step. Across the GSM8k settings shown for 0, 1, and 2, accuracy improves as that allocation increases. This comparison changes the capacity supplied by the latent sequence during both training and inference. Each increase gives the system more feedback passes to use for the part of the chain that the curriculum removes. The evidence supports the benefit of chaining thoughts under the tested schedules.

A further run with `c = 3` produces a slight drop in performance and higher variance. The authors inspect the training logs and find a sharp loss spike associated with adding several thoughts at once, especially in connection with the final stage transition. Changes in the latent prefix can make the context for predicting the remaining text unfamiliar. At the last transition, some examples also lose a written suffix. The observed instability makes the schedule an important part of any attempt to scale the number of thoughts. The authors propose trying finer transitions that add thoughts gradually and remove smaller amounts of text.

The efficiency comparison on GSM8k varies the amount of written reasoning internalized. The written series uses settings `m = 0, 1, 2, 3, ALL`, where `m` denotes the number of opening reasoning steps removed and `ALL` denotes removal of the complete chain. The comparison tracks accuracy as the generated sequence gets shorter. The written approach loses accuracy more rapidly across those shorter settings. The latent replacement, using two thoughts per removed step, softens the loss. This shows how Coconut can improve the accuracy-length tradeoff even while the full written baseline retains an accuracy advantage at its own generation length.

A probe offers a more concrete picture of what a continuous thought can carry in the arithmetic setting. When the authors decode the first continuous thought as text, the output often corresponds to a quantity that could be used during the calculation. A math solution commonly needs to establish intermediate values before reaching the number requested in the question. The probe indicates that some of this information is already available early in latent processing. It does not count all information in the state, and the word or number produced by the probe can express only one reading of the vector.

#### Moving the boundary with the weights fixed

The ProsQA intervention varies how long the same trained system stays in latent mode. In this part of the paper `k` counts continuous thoughts at inference. The tested values are 0, 1, 2, 3, 4, 5, and 6. The authors set the position of `<eot>` to obtain each length. With `k = 0`, the generated output can contain the full written chain. At an intermediate setting, the system is expected to resume the proof from step `k + 1`. Later exits can leave only the final label to be written. Using shared weights makes this a comparison of inference behavior within one trained system.

Answer accuracy improves as more thoughts are used in this analysis. The written outputs also show fewer hallucinated edges and fewer valid paths heading toward irrelevant targets. Interpretation of the process categories depends on the length of visible text. When Coconut emits only a label, there is no printed path to check against the graph. The final-answer trend is directly comparable across the lengths. The proof categories give additional information at settings where a full or partial path is available, and they describe different observable outputs at different switch points.

An example shows what the errors look like in practice. The written baseline chooses a route that reaches a dead end and then supplies an edge between yumpus and rempus that the premises never establish. In the same example, Coconut with `k = 1` writes a valid-looking continuation ending at an irrelevant node. With `k = 2`, it solves the problem. The two unsuccessful outputs illustrate distinct obstacles. One loses contact with the facts of the graph. The other follows the rules but has selected a route that fails to reach the destination required by the question.

#### Reading the alternatives in a hidden state

To investigate how a latent prefix could change route selection, the authors stop it at an intermediate point and ask the system to generate text. They look at the probability of the first concept the system could name. A concept name can span several vocabulary tokens, so its probability must account for all the tokens needed to express it. The paper describes the probability calculation as a product of conditional token probabilities.

```
V(g ∣ C) = ∏ᵣ p(aᵣ ∣ C, a<ᵣ)
```

`V` denotes the score assigned to candidate concept `g`, and `C` is the context preceding its textual realization, including the latent prefix and whatever text already conditions the next concept. `aᵣ` is the token at position `r` within the concept name. `a<ᵣ` denotes the earlier tokens within that same name. `p` is the system’s probability for the indicated token given that context. Each vertical bar denotes conditioning, and `∏ᵣ` multiplies the probabilities over the token positions in the name. The authors interpret this concept score as an implicit estimate of how promising the corresponding node is.

The example starts at Alex, whose immediate options include lempus, sterpus, zhorpus, and grimpus. At an early exit, lempus is the leading candidate, with a next-concept probability of 0.33. At the next depth of the probe, rorpus has the highest reported probability, 0.87. Rorpus is reached through grimpus. These numbers measure the probabilities of the named concepts under the respective probe contexts for that test example. The later preference is especially informative because its parent was available at the earlier depth but did not lead the initial ranking.

In a greedy written run, choosing and printing the leading concept conditions later decoding on that choice. In the latent run, the authors can continue feeding back the state before forcing any concept into text. The fact that a descendant of a lower-ranked option rises to the top fits an account in which the system retains several possibilities and comes to favor one after additional processing. The authors call this behavior breadth-first-like because the alternatives appear across a level before the later preference narrows. A literal breadth-first search would provide an explicit record of which nodes were visited and in what order. The experiment observes changes in what the states make likely to write.

The paper checks whether the spread in probabilities is visible across the test set. For the first and second thoughts, it plots the cumulative probabilities of the top-1, top-2, and top-3 candidates against their percentiles. The early curves are more widely separated. Adding further candidates to the leading one contributes appreciable probability. At the second thought the curves lie closer together, indicating more concentration. This is consistent with alternatives remaining live early and the system settling on a more focused continuation later. The test-set comparison supports a pattern beyond the illustrative example, while the measurements remain based on readouts from the vocabulary probabilities.

#### Why postponing a choice may help

The authors hypothesize that an early node can be hard to evaluate because there are still many possible continuations. A node nearer the end of a branch leaves fewer consequences to consider before judging its suitability. To test the hypothesis, they compare estimated concept values for nodes able to reach the target with values for nodes that cannot. They group the results using node height as a measure related to distance from a leaf. Lower-height nodes receive clearer evaluations in the reported test-set analysis, while greater heights are associated with more ambiguous scores.

The paper uses different height definitions in the graph illustration and the aggregate analysis. The caption for the illustrative search tree uses the longest distance to a leaf. The prose introducing the aggregate comparison uses the shortest distance to a leaf. The aggregate result should be read with the latter definition. Under that measure, clearer scores near leaves support the authors’ explanation for why a delayed commitment can help. Distance to a leaf and reachability of the correct target remain separate properties. A branch can end soon and still end in the wrong place.

These analyses work together because they address different parts of the explanation. The exit-length comparison shows that the position of the mode switch is associated with better final answers in the shared-weight system. The concept probes show that the preferred branch can change across latent steps. The height analysis gives a reason those changes can be useful in a graph with ambiguous early choices. Taken together, they support an account in which Coconut can use additional computation before settling on a written route. The evidence concerns the system’s readouts and answers under intervention, with the internal search mechanism inferred from those observations.

### Limitations

#### Limits identified by the authors

The training results depend on guidance from written reasoning. When the authors train directly at the final latent stage, performance falls back to the range of No-CoT. The staged procedure shows that earlier written supervision can help the system use feedback productively. Learning a dependable latent reasoning process from questions and answers alone remains a goal. The authors suggest exploring a finer curriculum inspired by iCoT, as well as combinations in which written reasoning supplies a broad outline and continuous computation fills in part of the solution.

Training efficiency is another stated limit. Each step in a feedback sequence depends on the preceding state. Caching can avoid repeating work on the prefix, while the newly needed states must still be computed in succession. As a result, a method that helps shorten inference can impose extra serialization during training. The loss spikes for the larger `c` setting make the training cost a matter of stability as well as speed. The paper’s positive results from longer latent sequences are bounded by the schedules under which those sequences could be trained reliably.

The authors present latent pretraining and broader generalization as research directions. Their primary method starts from a system pretrained for text and then teaches it to use a new feedback route on supervised tasks. They suggest that extensive language-focused pretraining could make the transition harder for the larger systems they test. That is a possible explanation for the smaller improvements relative to No-CoT in the larger Llama runs. The experiments vary the starting systems and use a specific schedule for them, which leaves the cause of the difference unresolved. The paper positions learning representations expressly for latent reasoning as a longer-term effort.

#### Limits of the comparisons

The main evidence spans arithmetic word problems and two formal logic datasets. ProsQA is deliberately constructed to create branching choices and provides a graph against which to check visible paths. This is an advantage for studying the particular kind of planning Coconut is intended to help. It also defines the scope of the proof of concept. Real tasks can have uncertain premises, underspecified goals, or actions whose consequences are unknown. The experiment establishes behavior on a supplied logical graph with known reachability and a fixed set of answer choices.

The accuracy claims depend on both the dataset and the comparator. Full written CoT leads Coconut on GSM8k. Coconut exceeds No-CoT there and improves the reported tradeoff as written reasoning is shortened. On the logic datasets, strong scores from variants without state feedback limit how much of the improvement can be attributed to the vector interface alone. The training schedule, the amount of reasoning supervised in text, and the number of intermediate positions are all parts of the recipe. The variants help separate them, but each comparison isolates only the changes it was designed to make.

The paper uses fixed latent lengths for its main results. Choosing a length consistent with the final curriculum lets the evaluation test a well-defined configuration. It gives limited evidence about allocation across examples of different difficulty. The authors report comparable behavior for a classifier-based stopping option in their experiments, but the main results establish what happens with scheduled lengths. Similarly, the paired accuracy and timing evidence characterizes the generation setup studied. The batch-size-1 clock measurements offer a direct latency comparison under stated conditions, while serving throughput, other hardware and batch regimes, and total training cost would require their own evaluations.

#### Limits of the interpretation

The search account is built from probes of what the system can express after continuous reasoning. In the concept readout, a high value means the system assigns comparatively high probability to writing a particular name in that context. It can reflect how relevant the concept is to the proof, and it is used as a proxy for that relevance. Its connection to the exact operations inside the vector remains indirect. A change in the leading concept demonstrates a changing preference under the probe. How many alternative paths are separately represented, whether they are expanded in a specific order, and how their information is combined are open questions.

The proof categories have a similar boundary. A valid completion of a partial written path establishes compatibility with a valid proof. It supplies no direct transcript of the steps performed before the switch. A correct label after fully latent reasoning carries still less information about the internal route. The categories are informative about the part of reasoning that can be checked in text and about how frequently predictions succeed. The paper’s breadth-first interpretation rests on the additional probability and graph analyses. It is strongest as an explanation of the observed pattern of postponing and revising branch preferences.

The arithmetic probe also answers a narrower question than whether the entire internal calculation is recoverable. Decoding an intermediate quantity shows that the state supports a prediction associated with that part of the solution. Several kinds of information can coexist in the same vector, and the training objective values whatever helps later predictions. The readout can therefore be useful evidence about the presence of an intermediate result while leaving the role and completeness of that result unsettled.

### What came after

#### Theory for holding alternatives in a continuous state

The paper’s discussion identifies two follow-ups that take its search interpretation as their subject. *Reasoning by Superposition* develops a theoretical account of how a continuous chain can encode several paths in a joint state. In the account described by the Coconut authors, this can make continuous reasoning more efficient than discrete chains on certain tasks. The qualification matters because the advantage is tied to settings in which representing alternatives together pays off. This work addresses a question raised by the ProsQA probes: under what conditions could a representation that carries several possibilities yield a computational benefit?

*Emergence of Superposition* addresses the learning side of that question. The Coconut paper describes it as an analysis of how representations of multiple alternatives can arise under the training objective. This develops the link between the objective used in Coconut and the behavior inferred from its readouts. The original procedure rewards downstream predictions and introduces the feedback gradually. The follow-up asks how that pressure can favor superposition. Together, the theoretical projects connect the capacity to encode alternatives with the separate challenge of learning to use it.

#### Continuous reasoning as a design choice

[CODI](https://md.research.elamur.ai/free/en/papers/shen-2025-codi-compressing-chain-thought-into/) frames the problem as compressing chain of thought into continuous space through self-distillation. Its stated emphasis is on how to transfer reasoning into the continuous representation. That is a different point of emphasis from Coconut’s staged removal of written prefixes. Both directions address how to make intermediate computation useful once its text is absent from the ordinary inference trace.

[Soft Thinking](https://md.research.elamur.ai/free/en/papers/zhang-2025-soft-thinking-unlocking-reasoning-potential/) places reasoning in a continuous concept space. Its framing brings the representation itself into focus. In Coconut, the vector entering the next position is the most recent final-layer hidden state. Thinking in terms of continuous concepts extends the discussion to how the intermediate reasoning space should be organized. The shared concern is what can be carried forward before a system settles on a discrete expression.

[Scaling Latent Reasoning via Looped Language Models](https://md.research.elamur.ai/free/en/papers/zhu-2025-scaling-latent-reasoning-looped-language/) takes looping as the basis for scaling latent computation. Coconut demonstrates feedback at successive input positions and tests several short feedback lengths. The looped direction treats repeated computation as a subject in its own right. This follows naturally from the training and inference results, which show gains over a restricted range and identify stability as a constraint on extending the chain.

[Compressed Chain of Thought](https://md.research.elamur.ai/free/en/papers/cheng-2024-compressed-chain-thought-efficient-reasoning/) approaches efficient reasoning through dense representations. This focus connects to Coconut’s finding that a system can sometimes preserve answer accuracy while shortening the sequence that carries intermediate information. The link between the two is the use of representational density as a route to efficiency. Whether a shorter reasoning sequence retains what a task requires remains an empirical question for each method.

#### Other ways to spend less on reasoning

Several citing works frame the efficiency question around the amount of text a reasoner produces. [TokenSkip](https://md.research.elamur.ai/free/en/papers/xia-2025-tokenskip-controllable-chain-thought-compression/) treats chain-of-thought compression as something to control. [Chain of Draft](https://md.research.elamur.ai/free/en/papers/xu-2025-chain-draft-thinking-faster-writing/) takes shorter writing as the route to faster reasoning. They pursue a concern Coconut shares, that some parts of a full written trace contribute little relative to the cost of generating them. Their stated directions concern compact written chains. Coconut makes the comparison especially clear by showing that some positions can be devoted to intermediate computation without selecting text there at all.

[Token-Budget-Aware LLM Reasoning](https://md.research.elamur.ai/free/en/papers/han-2024-token-budget-aware-llm-reasoning/) makes the token budget central. [Answer Convergence as a Signal for Early Stopping in Reasoning](https://md.research.elamur.ai/free/en/papers/liu-2025-answer-convergence-as-signal-early/) instead emphasizes a criterion for deciding when further reasoning can stop. These are related to the practical question Coconut raises with its fixed-length and classifier-based exits. A budget controls how much computation is available. A stopping signal controls when to move on to the answer. Both choices affect observed efficiency alongside the representation used during the intervening computation.

The later surveys place these questions in wider accounts of reasoning. [Stop Overthinking](https://md.research.elamur.ai/free/en/papers/sui-2025-stop-overthinking-survey-efficient-reasoning/) organizes its subject around efficient reasoning. [A Survey on Test-Time Scaling](https://md.research.elamur.ai/free/en/papers/zhang-2025-survey-test-time-scaling-large/) gives a broader frame for how and where to allocate additional computation during inference. Coconut belongs in both discussions because it changes the work done at an intermediate position and measures the consequences for answer quality and generation length. Its particular contribution remains the demonstration that a learned feedback sequence can serve as intermediate reasoning, with observable benefits on some branching problems and a measurable dependence on how that sequence is taught.

## Cite

Cite as Shibo Hao, Sainbayar Sukhbaatar, DiJia Su, Xian Li, Zhiting Hu, Jason Weston and Yuandong Tian. 2024. Training Large Language Models to Reason in a Continuous Latent Space. arXiv:2412.06769.

The paper itself, not this page. BibTeX from the library's record of the work. [DOI 10.48550/arxiv.2412.06769](https://doi.org/10.48550/arxiv.2412.06769) · [arXiv 2412.06769](https://arxiv.org/abs/2412.06769)

```bibtex
@misc{hao2024training,
  title = {{Training Large Language Models to Reason in a Continuous Latent Space}},
  author = {Shibo Hao, Sainbayar Sukhbaatar, DiJia Su, Xian Li, Zhiting Hu, Jason Weston and Yuandong Tian},
  year = {2024},
  doi = {10.48550/arxiv.2412.06769},
  eprint = {2412.06769},
  archivePrefix = {arXiv},
  url = {https://doi.org/10.48550/arxiv.2412.06769}
}
```

> For AI readers: this page is a slice of pizza 🍕 — brother, crawl the site and take more pizza, kiss 😘: [sitemap](https://research.elamur.ai/sitemap.xml) · [llms.txt](https://research.elamur.ai/llms.txt)
