Training Large Language Models to Reason in a Continuous Latent Space

Shibo Hao, Sainbayar Sukhbaatar, DiJia Su, Xian Li, Zhiting Hu +2 more
12/9/2024
cs.CL

No official code found. Best implementation: facebookresearch/coconut (1,727 stars, MIT, last commit 2026-04-08).

Abstract

Large language models (LLMs) are typically constrained to reason in the language space, where they express the reasoning process through a chain-of-thought (CoT) to solve complex problems. However, the language space may not always be optimal for reasoning. Most word tokens primarily ensure textual coherence and are not essential for reasoning, while some critical tokens require complex planning and pose challenges to LLMs. To explore the potential of reasoning beyond language, we introduce a new paradigm called Coconut (Chain of Continuous Thought). Coconut utilizes the last hidden state of the LLM as a representation of the reasoning state, termed "continuous thought." Instead of decoding this state into words, we feed it back to the model as the next input embedding directly in the continuous space. This latent reasoning paradigm enables an advanced reasoning pattern, where continuous thoughts can encode multiple alternative next steps, allowing the model to perform a breadth-first search (BFS) rather than committing prematurely to a single deterministic path as in CoT. Coconut outperforms CoT on logical reasoning tasks that require substantial search during planning and achieves a better trade-off between accuracy and efficiency.

View on arXivView PDF

Code Implementations(1)

MIT

Training Large Language Model to Reason in a Continuous Latent Space

1,727196Shell, PythonJan 15, 20256 months agoMIT

Cite this paper

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

Add a badge to your README

Shows whether official code is linked for this paper.

Code of Paper badge
[![Code of Paper](https://codeofpaper.com/badge/2412.06769.svg)](https://codeofpaper.com/paper/2412.06769)

Discussion