---
title: Latent Codebooks for Fast Thinking
url: https://www.emergentmind.com/topics/latent-codebooks-for-fast-thinking
type: topic
---

# Latent Codebooks for Fast Thinking

Searching arXiv for the cited papers to ground the article in current literature.
Latent codebooks for fast thinking are mechanisms that replace, compress, or control explicit Chain-of-Thought (CoT) with internal latent representations so that a model can preserve strategy-level guidance while reducing autoregressive reasoning length, latency, and token cost. In the most direct formulation, a model learns a finite bank of reasoning prototypes from concise CoT sketches and, at inference, conditions on a small set of latent “thinking vectors” rather than generating a long rationale; related work broadens the idea to steering directions, latent reasoning extractors, short chains of latent thoughts, and reserved abstract reasoning vocabularies [2509.23633] [2507.03704] [2604.22709].

## 1. Conceptual scope and terminology

The immediate motivation is the inefficiency of explicit reasoning traces. Reasoning-oriented LLMs often rely on CoT, self-consistency, or tree-of-thought style decoding, but long reasoning traces increase wall-clock time and token usage, and can also induce “overthinking,” where extra steps introduce irrelevant detours and surface-level heuristics that degrade accuracy. In the LC-FT study, Qwen3-Thinking uses approximately \(19\)k tokens on AIME, which is presented as a concrete example of this cost regime [2509.23633].

Within this literature, “fast thinking” denotes inference in which the model produces the answer directly, guided by a compact internal representation of reasoning strategy rather than by explicit textual steps. “Slow thinking” denotes explicit multi-step generation in token space. The distinction appears both in models that learn reusable strategy priors and in models that dynamically modulate reasoning speed at test time [2509.23633] [2507.03704].

The term “codebook” is used in more than one sense. In LC-FT, the codebook is a learnable matrix of discrete strategy prototypes, indexed discretely but accessed through soft attention, yielding continuous mixtures [2509.23633]. In “Controlling Thinking Speed in Reasoning Models,” a single layerwise steering vector \(v^l\) functions as a one-dimensional latent code for the slow-fast transition, and the paper explicitly motivates extending that single axis into a set of reasoning-mode directions [2507.03704]. In “Abstract Chain-of-Thought,” the codebook is a reserved abstract vocabulary \(\mathcal{V}_{\mathrm{abs}}\) of discrete non-linguistic tokens generated under constrained decoding [2604.22709]. In “CoLT,” by contrast, there is no discrete VQ-style codebook; the latent units are continuous hidden states placed at designated reasoning positions [2606.31986].

This suggests a useful working distinction. A **narrow** usage refers to finite prototype banks or reserved vocabularies. A **broader** usage refers to any compact latent intermediate representation that mediates reasoning and can be controlled, selected, or routed more efficiently than full verbal CoT.

## 2. Latent Codebooks for Fast Thinking in large language models

LC-FT defines the codebook as
\[
\mathbf{C} \in \mathbb{R}^{M \times H},
\]
where each row \(c_j \in \mathbb{R}^H\) is a strategy prototype. A small, fixed set of learnable queries
\[
\mathbf{Q} \in \mathbb{R}^{K \times H}
\]
retrieves mixtures of these prototypes by attention, with \(K\) much smaller than the number of tokens in a CoT trace, and the paper gives \(16\)–\(48\) as representative values. The resulting latent hints are the thinking tokens
\[
\mathbf{T}=\mathbf{A}(\mathbf{C}\mathbf{W}_v)\mathbf{W}_o \in \mathbb{R}^{K\times H},
\]
where \(\mathbf{A}\) is the attention matrix over codebook entries [2509.23633].

The training signal does not use full verbose rationales. Instead, the method constructs concise CoT sketches \(\tilde r\). A teacher model proposes a candidate hint, and the hint is accepted only if it does not leak the answer and if the backbone model, when prompted with the question plus hint, produces an answer that a task-specific verifier accepts. The resulting dataset is
\[
\mathcal{D} = \{ (x_i, \tilde r_i, y_i) \}_{i=1}^N.
\]
These sketches are used only during training, not at inference [2509.23633].

The thinking tokens are injected at an internal transformer layer \(L\). If the text input has hidden states \(\{z_1,\dots,z_n\}\) at layer \(L\), LC-FT appends the latent slots:
\[
\mathbf{Z}^{(L)}=\big[z_1,\dots,z_n;\;\mathbf{t}_1,\dots,\mathbf{t}_K\big] \in \mathbb{R}^{(n+K)\times H}.
\]
The injected vectors are not input tokens; they are non-textual latent slots. They are masked before layer \(L\), so earlier layers process only the original token sequence, and from layer \(L\) onward the model attends jointly over text states and thinking tokens. A small refiner MLP is applied only to the thinking tokens before injection [2509.23633].

LC-FT training has two stages. In Stage 1, a frozen reference LLM processes inputs with explicit rationales, and the model aligns the pooled latent-thought representation \(z_T^{(l)}\) to the pooled rationale representation \(z_R^{(l)}\) using cosine similarity, with stop-gradient on the reference representation. The paper notes that there is no vector quantization loss; prototypes are learned directly as parameters through alignment. In Stage 2, explicit rationales are dropped, and the model is trained with the standard language modeling objective conditioned on the thinking tokens:
\[
\mathcal{L}_{\mathrm{LM}} = -\sum_{t=1}^{|y|} \log p_\theta\!\left(y_t\,\middle|\,y_{<t},\,x,\,\mathbf{T}\right).
\]
The trainable components are the codebook, the projection layers, the refiner, and LoRA adapters from layer \(L\) onward; earlier layers are frozen. The stated aim is to train the model to use the latent thinking tokens instead of explicit CoT [2509.23633].

The central computational property is that generation length at inference depends only on answer length. The reasoning prior is inserted once into hidden space rather than emitted token by token. The paper therefore describes LC-FT as a model that “thinks silently” in one pass [2509.23633].

## 3. Adaptive compute: routing, confidence, and speed control

LC-FT is paired with GainRouter, a lightweight routing mechanism that decides whether a given input should remain in the fast codebook-guided mode or escalate to slow explicit reasoning. The router consumes a pooled question representation, the thinking tokens projected to a lower dimension, an attention-pooled summary of those thinking tokens, cosine similarity between question and hints, normalized attention entropy, and a predicted normalized length difference between fast and slow generations. The decision rule is
\[
UseThink(x)=\mathbb{1}\!\left[\mathrm{raw\_logit}(x)\ge \theta+\delta\theta(x)\right],
\]
with labels derived from paired fast and slow runs: positive if only the slow model succeeds, negative if the fast model succeeds, and cases where both fail ignored. The stated purpose is to suppress overthinking and reduce unnecessary token generation [2509.23633].

A different control mechanism appears in “Controlling Thinking Speed in Reasoning Models,” which identifies a steering vector \(v^l\) governing the slow-fast transition and edits hidden states as
\[
h^l \leftarrow h^l + \alpha \cdot v^l.
\]
A positive \(\alpha\) pushes the model toward faster, more direct CoT; a negative \(\alpha\) toward slower, more deliberative CoT. The paper derives \(v^l\) by PCA over hidden-state differences between fast and slow traces, and adapts \(\alpha_t\) token by token using a Jensen–Shannon-divergence difficulty signal between early- and late-layer next-token distributions. Across MATH-500, AIME24, AIME25, and GPQA, the adaptive scheme yields an average \(+1.26\%\) Pass@1 with \(-8.56\%\) tokens [2507.03704].

ThinkRouter places routing directly between latent and discrete reasoning spaces. Its latent backbone is Soft Thinking, where each reasoning step uses a probability-weighted average of top-\(j\) token embeddings. ThinkRouter measures confidence by \(p_{\max}=\max_v p_t[v]\) and routes to discrete token space when \(p_{\max}<T\), and to latent space otherwise. The paper argues that low-confidence latent mixtures can introduce and propagate noise, whereas discrete selection can ground uncertain steps. ThinkRouter also uses an entropy-based Cold Stop criterion for end-of-thinking. On STEM reasoning and coding benchmarks across Qwen3-1.7B, Qwen3-8B, Qwen3-32B, and gpt-oss-20b, it reports an average improvement of \(19.70\) points in Pass@1 and generation-length reductions of up to \(15.55\%\) [2602.11683].

Taken together, these papers define a common control problem: latent reasoning is efficient, but it is not uniformly reliable. Routing, confidence estimation, and internal difficulty signals determine when compression is safe and when the model should pay the cost of explicit reasoning.

## 4. Architectural variants across domains and modalities

In e-commerce relevance modeling, “Thinking Broad, Acting Fast” introduces Latent Reasoning Knowledge Distillation (LRKD). The teacher uses Multi-Perspective CoT with three explicitly defined perspectives—User Intent Perspective, Structured Analysis Perspective, and Business Rule Perspective—and is trained with SFT plus DPO. The student is a BERT cross-encoder augmented with a latent reasoning extractor \(\mathcal{R}(\cdot)\) that produces \(\mathbf{r}_{qp}\), aligned by MSE to a fixed sentence embedding \(\mathbf{e}_{\mathrm{cot}}\) of the teacher rationale. The extractor is explored in MLP, Poly-Encoder, and GAT forms; the Poly-Encoder uses \(K\) learned context codes, which the paper explicitly interprets as a close architectural analogue to a codebook. The teacher requires \(46{,}800\) ms per batch of \(100\) pairs, whereas BERT baseline is \(132.22\) ms, LRKD-Poly is \(132.68\) ms, and LRKD-GAT is \(148.76\) ms. Offline results show, for example, AliExpress ACC/F1 improving from \(53.17/49.34\) to \(57.36/52.29\) with LRKD-GAT [2601.21611].

In multimodal reasoning, CoLT replaces text CoT with a short chain of latent thoughts. A latent thought is the last-layer hidden state at a designated reasoning position, re-injected as the input embedding at the next step, and the default chain length is \(K=3\). To prevent semantically meaningless latent states and unstable training, CoLT adds a lightweight external decoder with forward supervision, latent \(\rightarrow\) text, backward alignment, text \(\rightarrow\) latent, and an internal transition predictor over adjacent latent steps. The decoder and internal losses are removed at inference. On MMStar and MMT-Bench with Qwen3-VL-8B, text CoT uses roughly \(139\)–\(142\) CoT tokens and \(7.24\)–\(7.38\) seconds decoding time per sample, whereas CoLT uses \(3\) latent tokens and \(0.32\)–\(0.33\) seconds; the reported speedups are \(10.1\times\) overall and \(22.6\times\) in text decoding time, with accuracy improving from \(67.1\) to \(68.9\) on MMStar and from \(63.3\) to \(67.4\) on MMT-Bench [2606.31986].

Abstract-CoT is the discrete counterpart. It adds a reserved abstract vocabulary \(\mathcal{V}_{\mathrm{abs}}\), typically with codebook size \(M=64\), and inserts a latent reasoning segment
\[
\tilde{z} = \texttt{<beginabstract>}~z_1~\dots~z_m~\texttt{<endabstract>}
\]
with \(m \le 128\). Training uses a policy-iteration-style warm-up loop alternating between bottlenecked SFT from verbal CoT and self-distillation from prompts alone, followed by warm-started GRPO under constrained decoding. Reported results include \(1671 \rightarrow 144\) tokens on MATH-500 for Qwen3-8B, \(496 \rightarrow 225\) on AlpacaEval-LC-2.0, and \(735 \rightarrow 171\) on HotpotQA, corresponding to up to \(11.6\times\) fewer reasoning tokens while maintaining comparable performance [2604.22709].

These variants differ substantially in implementation, but all preserve the same core pattern: broad reasoning supervision at training time, compact latent computation at inference time.

## 5. Empirical profile, interpretability, and precursors

LC-FT reports quantitative gains on both mathematical reasoning and programming. On AIME, Qwen3-Thinking reaches \(73.33\%\) with \(19{,}411\) tokens, LC-FT alone reaches \(55.00\%\) with \(7{,}690\) tokens, and LC-FT + GainRouter reaches \(73.33\%\) with \(12{,}797\) tokens. On OlympiadBench, the corresponding values are \(50.00\%\) with \(7{,}075\) tokens for Qwen3-Thinking, \(25.00\%\) with \(2{,}668\) tokens for LC-FT, and \(50.51\%\) with \(5{,}332\) tokens for LC-FT + GainRouter. On HumanEval, Qwen3-Thinking is \(91.93\%\) at \(4{,}061\) tokens, LC-FT is \(87.58\%\) at \(98\) tokens, and LC-FT + GainRouter is \(92.55\%\) at \(1{,}401\) tokens. The paper also reports sparse prototype usage, low normalized entropy, and class-consistent prototype reuse, and gives a qualitative case in which the model emphasizes a prototype cluster coherent with “logarithmic simplification + telescoping” [2509.23633].

Longer-term antecedents show that latent codebooks were already being used to compress search spaces and to make internal states more discrete. Latent Programmer learns a VQ-style discrete latent sequence \(Z\) for programs and performs two-level search: first over latent plans, then over programs conditioned on those plans. On the string transformation DSL, it reports \(51\%/57\%/68\%\) accuracy at beam sizes \(1/10/100\), compared with \(47\%/51\%/61\%\) for RobustFill [Transformer]. On Python code generation, it reports BLEU \(14.0/18.6/21.3\) at beam sizes \(1/10/100\), compared with \(12.1/15.5/17.2\) for RobustFill [Transformer]. The latent sequence is presented as a compact plan that makes search more efficient [2012.00377].

“Codebook Features” pushes the codebook idea inside the network at every layer. Hidden activations are replaced by sums of the top-\(k\) codes from a learned codebook, yielding sparse, discrete internal features. The paper emphasizes that \(k\) is typically less than \(1\%\) of the codebook size, computes channel capacity as \(\lceil \log_2 {C \choose k} \rceil\), and reports, for example, \(97.1\%\) average precision for codebook features versus \(70.5\%\) for the best neuron at matched recall in the FSM setting. It also shows that activating topic-linked codes can steer generation toward topics such as “dragon,” “fire,” or “football” [2310.17230].

These precursors clarify that latent codebooks serve two roles. They are an efficiency mechanism, because they reduce search or generation complexity, and they are a representational mechanism, because they make reasoning states more modular, sparse, and sometimes more controllable.

## 6. Limitations, misconceptions, and future directions

A common misconception is that latent fast-thinking methods are uniformly discrete. The current literature is mixed. LC-FT uses a discrete codebook in index space but forms continuous thinking vectors through soft attention; ThinkRouter’s latent steps are soft mixtures of token embeddings; LRKD and CoLT operate in continuous latent spaces; Abstract-CoT uses explicitly discrete abstract tokens [2509.23633] [2602.11683] [2606.31986] [2604.22709].

A second misconception is that latent reasoning simply dominates explicit CoT. The papers do not support that conclusion. LC-FT notes that some tasks still need explicit CoT, especially the hardest reasoning tasks or tasks requiring very long derivations; GainRouter exists precisely because fast mode is not always sufficient. LRKD notes an interpretability trade-off: the teacher’s CoT is fully interpretable, whereas the student’s latent reasoning is explainable only indirectly. CoLT still depends on explicit CoT annotations during training, and its fixed \(K\) can underfit hard problems or introduce redundant constraints when too large. Abstract-CoT reports that cold-start RL from random abstract embeddings is ineffective and that a short abstract budget can remain a bottleneck on the hardest math problems [2509.23633] [2601.21611] [2606.31986] [2604.22709].

ThinkRouter adds a further caution specific to soft latent mixtures: aggregated low-confidence alternatives can introduce and propagate noise, producing high confidence in unreliable trajectories. That observation motivates confidence-aware routing and suggests that latent compression is safest when the model’s token distribution is already sufficiently sharp [2602.11683].

The future directions described across these papers are convergent. LC-FT explicitly suggests latent codebook designs closer to VQ-VAE style vector quantization, explicit clustering of strategies, better routing policies, and controllable reasoning by targeting specific codebook entries or regions. LRKD points toward discrete latents or mixture-of-experts gating based on perspectives. CoLT points toward adaptive numbers of latent steps and more structured latent spaces or codebooks. Abstract-CoT points toward budget-adaptive abstract reasoning and hierarchical codebooks [2509.23633] [2601.21611] [2606.31986] [2604.22709].

The resulting research program is clear: retain the strategic benefits of CoT, but move the reasoning substrate from long natural-language traces to compact latent variables that can be injected, decoded, routed, or discretely selected. In that sense, latent codebooks for fast thinking define not one architecture but a family of methods for shifting reasoning from verbose external text into shorter internal representations, with efficiency gains that are now documented across language reasoning, coding, retrieval-style relevance modeling, and multimodal reasoning.

Source: https://www.emergentmind.com/topics/latent-codebooks-for-fast-thinking