Improving Self Consistency in LLMs through Probabilistic Tokenization

Ashutosh Sathe, Divyanshu Aggarwal, Sunayana Sitaram

TL;DR

Instead of relying on temperature or nucleus sampling during generation to produce diverse reasoning paths for self-consistency, this paper introduces Probabilistic Tokenization: sampling alternative valid tokenizations of the input prompt and running standard greedy decoding. This simple shift perturbs the model’s input representation directly, sparking genuinely diverse logical reasoning chains rather than superficial phrasing changes, and consistently boosting self-consistency performance across both Transformer and State Space Model (SSM) architectures.

What Problem Does This Paper Address?

Self-Consistency (CoT + SC) is one of the most effective ways to boost an LLM's reasoning accuracy: sample multiple reasoning paths for a given prompt and take the majority vote across the generated answers. Typically, this diversity is generated via stochastic decoding (e.g., temperature or top-$p$/nucleus sampling).

However, relying entirely on the model's next-token output distribution has significant flaws. Generative sampling frequently creates reasoning paths that are superficially diverse (using different synonyms or sentence structures) while following the exact same flawed logical steps or shared failure modes (such as premature stopping). The authors ask: Can we induce genuine logical diversity earlier in the pipeline by altering how the model perceives the input text?

Methods

Byte-Pair Encoding (BPE) vocabularies consist of merged subwords, meaning an input string can be broken into several valid sequences of subword tokens. While standard tokenizers greedily pick the longest merges, the authors treat tokenization probabilistically:

  1. Unigram Probability Estimation: Token likelihoods $p(t_j)$ are calculated using simple frequency counts across a large pretraining text sample (~10 billion tokens from FineWeb), avoiding the expensive Expectation-Maximization (EM) training required by classical subword regularization.
  2. Sampling Tokenizations: Given prompt $X$, tokenization sequences $x_{\text{tok}}$ are assigned likelihoods via a unigram language model: $$\Pr(x_{\text{tok}} \mid X) = \prod_{j=1}^{k} p(t_j)$$ The authors sample $m$ alternate tokenizations ($m=64$) using the Forward-Filtering Backward-Sampling algorithm ($l \to \infty$).

  3. Reasoning & Aggregation: For each of the $m$ sampled tokenizations, the model generates a Chain-of-Thought (CoT) reasoning path using deterministic greedy decoding. The final answer is picked via majority vote.

Datasets

  • Token Frequency Estimation: A 10-billion-token subset of FineWeb.
  • Evaluation Benchmarks: Four standard reasoning benchmarks:
  • MATH (mathematics)
  • GSM8k (grade-school math word problems)
  • AQuA (algebra word questions with multiple choice)
  • PIQA (physical commonsense reasoning)
  • Models Evaluated: Seven open-source models covering five families: OLMo-7B, Gemma-2B & 7B, Llama-3-8B & 70B, Mistral-7B, and Mamba-2.8B (a non-transformer SSM).

Key Insights and Ideas

  • Input-Level vs. Output-Level Diversity: Perturbing how tokens are framed at the input fundamentally shifts how the LLM decomposes problems. For example, tokenizing $16` as `$|16 vs. `$|1|6` caused Llama-3 to verbalize currency ("dollars" vs. "$") and adopt an entirely different calculation strategy (board-by-board costing vs. aggregate pricing).
  • Fixing Non-Transformer Reasoning: State Space Models like Mamba-2.8B severely degraded under standard temperature-based CoT + SC (dropping relative performance by -23.72% on MATH), because output sampling produced invalid or incomplete reasoning. Probabilistic tokenization paired with greedy decoding stabilized Mamba, resulting in an +18.29% relative gain on MATH.
  • Higher Solution Coverage (Oracle Accuracy): Because the reasoning paths are logically rather than syntactically distinct, the "Oracle" accuracy (whether the correct answer appears in any of the 64 paths) improved drastically—proving the model accesses latent problem-solving capabilities hidden behind standard BPE splits.

Key Results

  • Average Accuracy Gains: Across all models and reasoning benchmarks, Probabilistic Tokenization (Majority) achieved an average +17.11% relative improvement over the no-CoT baseline, surpassing standard CoT + SC (+16.39%).
  • Substantial Oracle Improvements: Probabilistic Tokenization achieved a +71.40% average relative improvement in Oracle accuracy over the baseline, compared to +64.46% for CoT + SC Oracle. On Mamba-2.8B (MATH), the Oracle gain reached +216.03%.
  • Counting vs. EM: Estimating token probabilities via simple token counts yielded downstream performance on par with EM estimation while drastically reducing computation.
  • Model Scaling: Gains were most pronounced in the 7B–8B parameter range, where multi-step reasoning capabilities solidly emerge.

Limitations and Future Work

  • Corpus Dependency: Accurately calculating unigram frequencies requires access to a representative corpus. While 10B web tokens suffice for general benchmarks, domain-specific tasks (e.g., biomedical text or specialized code) may suffer if out-of-domain token frequencies lead to degenerate tokenizations.
  • Base Model Sensitivity: Probabilistic tokenization relies on an LLM having some baseline robustness to varied subword representations; extremely small or weak models can sometimes be confused by sub-optimal token boundaries.
  • Future Work: Developing learnable input-aware re-rankers or weighted voting strategies rather than simple majority voting to select the final answer.

Summary updated

BibTeX
@inproceedings{sathe2024improving,
  author = {Ashutosh Sathe and Divyanshu Aggarwal and Sunayana Sitaram},
  title = {{Improving Self Consistency in LLMs through Probabilistic Tokenization}},
  booktitle = {LLMs and Cognition @ ICML},
  year = {2024},
  url = {https://openreview.net/forum?id=jcH9PWIcZA},
}
Figure