# facebookresearch/coconut

Training Large Language Model to Reason in a Continuous Latent Space

Repository: https://github.com/facebookresearch/coconut
Canonical: https://ross.abutalabs.com/products/facebookresearch-coconut
Language: Python
License: MIT
License Family: permissive
Last push: 2026-07-02T08:17:30+00:00

## Health v2 (maintenance only)
Score: 61/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 90, release rhythm 35, longevity 42
- inputs: {"age_days": 595, "days_push": 62, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 1689, forks 187 (observed 2026-08-28T04:05:22.344977+00:00)

## What it is
Official PyTorch implementation of Coconut, a method for training large language models to reason in a continuous latent space instead of explicit token-level chain-of-thought. It provides training and evaluation pipelines built on Hugging Face models with configurable YAML experiment settings.

## Use cases
- train an LLM to reason in continuous latent space
- reproduce the Coconut paper experiments
- run latent chain-of-thought reasoning on GSM8K
- compare CoT vs no-CoT vs latent reasoning training
- fine-tune Hugging Face models with continuous thought steps

## When to choose
- you want to experiment with latent-space reasoning for LLMs
- you need the official reference implementation of the Coconut paper
- you are doing research on alternatives to token-based chain-of-thought

## When to avoid
- you need a production-ready inference library
- you want plug-and-play reasoning without training models
- you lack GPU resources for LLM fine-tuning

## Facets
- artifact type: library
- maturity: active
- function: llm-training, machine-learning, rag
- domain: large-language-models, machine-learning, deep-learning, artificial-intelligence
- platform: python
- tags: latent-reasoning, chain-of-thought, research-code, huggingface, reasoning, linux, gpu

## Member repositories
- facebookresearch/coconut (main) score 61

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:05:22.344977+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T03:38:40.614860+00:00, confidence not recorded.
  - readme: https://github.com/facebookresearch/coconut (fetched 2026-08-28T04:05:22.344977+00:00, sha af83e6124a16)
- Data as of 2026-08-30T08:39:29.467469+00:00.
