NF-CoT解决了潜在推理中丢失CoT关键优势的痛点,做LLM推理优化和代码生成的开发者可以直接参考其方法,提升效率。
大型语言模型通过显式思维链(CoT)提升推理能力,但文本CoT强制中间计算通过离散、串行的令牌流进行,效率低下。潜在推理通过在紧凑连续状态中进行中间计算,提供了更高带宽的替代方案。然而,现有潜在推理方法牺牲了CoT的关键优势,如从左到右生成、概率采样、KV缓存兼容性和可处理似然估计。本文提出NF-CoT框架,通过在LLM骨干网络内实例化TARFlow风格的归一化流,对从显式CoT中提取的紧凑连续思维进行可处理概率建模。NF-CoT在代码生成基准测试中,相比显式CoT和先前潜在推理基线,提高了通过率,同时大幅降低了中间推理成本。
Latent Reasoning with Normalizing Flows
Large language models often improve reasoning by generating explicit chain-of-thought (CoT), demonstrating the importance of intermediate computation. However, textual CoT forces this computation through a discrete, serial, and communication-oriented token stream: each reasoning step must be verbalized before the model can proceed, even when the underlying update is semantic, uncertain, or only partially formed. Latent reasoning offers a higher-bandwidth alternative by performing intermediate computation in compact continuous states before committing to text. Yet existing latent-reasoning methods often sacrifice key advantages that make CoT effective in autoregressive language models, including native left-to-right generation, probabilistic sampling, compatibility with KV-cache decoding, and tractable likelihood estimation. We propose NF-CoT, a latent reasoning framework that preserves these advantages by modeling continuous thoughts with normalizing flows. NF-CoT instantiates a TARFlow-style normalizing flow inside the LLM backbone, defining a tractable probability model over compact continuous thoughts distilled from explicit CoT. Continuous-thought positions are generated by an NF head, while text positions are generated by the standard LM head within the same causal stream. This design provides exact likelihoods for latent thoughts, enables probabilistic left-to-right decoding with the original KV cache, and supports direct policy-gradient optimization in the latent reasoning space. On code-generation benchmarks, NF-CoT improves pass rates over explicit-CoT and prior latent-reasoning baselines while substantially reducing intermediate-reasoning cost.