NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Disentangling Reasoning Tokens and Boilerplate Tokens For Language Model Fine-tuning

Ziang Ye, Zhenru Zhang, Yang Zhang, Jianxin Ma, Junyang Lin, Fuli Feng

Abstract

Standard supervised fine-tuning (SFT) for Large Language Models (LLMs) treats every token in a training sequence with equal importance. However, in structured agentic tasks, "boilerplate" tokens—such as formatting and transitional phrases—are significantly easier to learn than the "reasoning" tokens that drive core logic. This disparity often leads to models that mimic formats perfectly but fail at underlying reasoning. We introduce SHuffle-Aware Discriminator (SHAD), an unsupervised method to identify reasoning tokens through data shuffling, and Reasoning-highlighted Fine-Tuning (RFT), which adaptively prioritizes these tokens. Our approach demonstrates substantial gains in LLM agent performance, particularly in generalizing to unseen tools and environments.

Introduction: The Problem of Token Uniformity

When training LLMs to act as agents—performing multi-step planning or executing tool calls—Supervised Fine-Tuning (SFT) is the standard approach. In SFT, the model minimizes cross-entropy loss across all tokens. However, agent datasets are inherently structured, containing a mix of repetitive "boilerplate" (e.g., Thought:, Action:, Action Input:) and sample-specific "reasoning" (the logic connecting a query to a specific API call).

Boilerplate tokens are learned rapidly due to their high frequency and predictability. Once the model masters these structural elements, the gradient signal from them diminishes, yet they continue to "dilute" the training process. This often results in "overfitting" to the template, where the model produces perfectly formatted responses that lack the correct logical grounding for the specific task at hand.

Methodology

To address this, we propose a two-stage framework designed to disentangle token roles and focus training on high-value reasoning.

1. SHuffle-Aware Discriminator (SHAD)

SHAD is an unsupervised classification mechanism based on the insight that boilerplate tokens are "sample-independent" (consistent across different inputs), while reasoning tokens are "sample-specific."

The process involves three steps as illustrated below:

  1. Data Shuffle: A small subset of training data is modified by shuffling input-output pairs (e.g., matching Query A with Response B).
  2. Model Tuning: A reference model is fine-tuned on this mismatched data.
  3. Classifying: Because boilerplate is repetitive, the model can still predict it even with an incorrect prompt. Conversely, it fails to predict reasoning tokens. By comparing the token-level loss of this "shuffled" model ($l_s$) against the original model ($l_o$), we can identify reasoning tokens where the loss difference is significant.
The three-step SHAD framework: Data Shuffle, Model Tuning, and Classifying.

2. Reasoning-highlighted Fine-Tuning (RFT)

Once tokens are categorized, RFT applies an adaptive weighting mechanism. Rather than simply masking boilerplate, RFT calculates the average loss for the reasoning and boilerplate groups separately. It then uses a softmax-based weighting to assign higher importance to the group with higher loss—typically the reasoning tokens—forcing the model to prioritize the more difficult logical transitions.

Key Insights: Predictability and Learning Dynamics

The core innovation lies in using predictability under context-mismatch as a proxy for a token's functional role. This bypasses the need for manual labeling or brittle regular expressions. If a token remains guessable when the context is wrong, it is likely structural boilerplate.

Loss curves on mismatched (shuffled) data show that boilerplate tokens remain predictable (low loss), while reasoning tokens become highly unpredictable (high loss).

As shown in the learning curves, boilerplate tokens are mastered almost immediately, while reasoning tokens require sustained optimization. By de-emphasizing the "easy-to-learn" templates, the model is compelled to learn the causal relationships between user constraints and tool requirements.

Experimental Results

We evaluated our method using LLaMA3-8B and LLaMA3.1-8B across several benchmarks, including ToolBench, APIGen, and ShareGPT. Evaluation covered both held-in (StableToolBench) and held-out (Nexus) datasets.

  • Performance Gains: SHAD+RFT consistently outperformed standard SFT and advanced baselines like Rho-1. On LLaMA3-8B, average scores across benchmarks improved from 52.5% to 59.3%.
  • Generalization: The most significant improvements occurred in "Held-Out" benchmarks like Nexus, where accuracy nearly doubled (14.0% to 27.8%). This suggests the model learned transferable logic rather than just memorizing dataset-specific templates.
  • Efficiency: SHAD is computationally efficient, requiring only a single forward pass on a small data subset for classification, making it far less expensive than training separate reward models.

Conclusion

By disentangling reasoning from boilerplate, SHAD and RFT provide a robust, automated way to enhance LLM fine-tuning for complex tasks. This approach ensures that models focus their limited capacity on the most challenging and critical parts of a sequence, leading to better reasoning capabilities and superior generalization in real-world agentic applications.

Summary updated

BibTeX
@inproceedings{ye2025disentangling,
  author = {Ziang Ye and Zhenru Zhang and Yang Zhang and Jianxin Ma and Junyang Lin and Fuli Feng},
  title = {{Disentangling Reasoning Tokens and Boilerplate Tokens For Language Model Fine-tuning}},
  booktitle = {Annual Meeting of the Association for Computational Linguistics},
  year = {2025},
}
Figure