TS$^2$: Training with Sparsemax+, Testing with Softmax for Accurate and Diverse LLM Fine-Tuning

XuZiyang, Ananthu Rajendran Pillai, Yinghua Yao, Yuangang PanICLR 2026

TL;DR

Standard LLM fine-tuning kills output diversity by forcing the model to be 100% confident in a single "correct" answer, making generations repetitive. This paper introduces TS$^2$, a drop-in training method that uses a modified sparse loss (Sparsemax+) during training and standard softmax during testing. This decoupled approach preserves a rich set of plausible alternative answers while aggressively squashing bad ones, leading to LLMs that are both more accurate and significantly more creative.

What Problem Does This Paper Address?

When Large Language Models (LLMs) undergo Supervised Fine-Tuning (SFT) to learn how to follow instructions, they typically use Cross-Entropy (CE) loss. CE loss is greedy: it pushes the model's probability distribution entirely toward the single "gold" target token provided in the training data, driving the probability of all other tokens toward zero.

This causes distribution collapse (often called the "alignment tax"). The model becomes overconfident and deterministic, forgetting the rich, diverse vocabulary it learned during pre-training. For generative tasks that rely on sampling—like brainstorming, creative writing, or generating multiple code solutions to find one that works—this homogeneity is a massive drawback. Existing fixes either just tweak the decoding process at inference time (which doesn't fix the underlying model) or try to spread probability out during training (which can accidentally boost the probability of nonsensical "junk" tokens).

Probability distributions comparing Pretrained, CE, GEM, and TS²

Methods

The authors propose a new paradigm called TS$^2$: Training with Sparsemax+, Testing with Softmax. The goal is to achieve Tail-Suppressed Plausible Diversity (TSPD)—meaning the model should keep a small "elite club" of highly plausible next tokens, while ruthlessly driving the probability of irrelevant tokens to exactly zero.

Here is how they decouple training and inference to achieve this:

  1. Training with Sparsemax+: Instead of the standard softmax function, they train the model using a Sparsemax mapping. Sparsemax naturally creates a sparse probability distribution, assigning exact zeros to bad tokens and masking their gradients. This acts as an implicit early-stopping mechanism: once the correct token is separated from the pack, the model stops crushing the plausible runner-up tokens. To ensure no residual "junk" mass survives, they introduce Sparsemax+, which adds a novel tail-suppressing penalty to explicitly punish out-of-support tokens.
  2. Testing with Softmax: At inference time, the model switches back to standard softmax decoding. Because of the unique geometry learned during Sparsemax+ training, the resulting softmax distribution is beautifully calibrated. Plausible near-ties survive and share the probability mass (allowing for diverse sampling), while the tail of bad tokens remains safely suppressed.

Datasets

  • Training: UltraFeedback (a large-scale corpus of preference-aligned responses).
  • Evaluation:
    • Open-ended Chat: AlpacaEval (using a Best-of-32 protocol evaluated by a reward model) and MT-Bench-101 (for multi-turn dialogue).
  • Code Generation: HumanEval (pass@k metrics).
  • Standard Benchmarks: OpenLLM Leaderboard tasks (ARC, GSM8K, HellaSwag, MMLU, TruthfulQA, WinoGrande) evaluated using a Best-of-N protocol.
  • Creative Writing: Custom tasks using the poetry8 and ROCStories datasets to measure N-gram, Self-BLEU, and Sent-BERT diversity.

Key Insights and Ideas

  • Decoupling is a Superpower: You don't have to use the same probability mapping for training and inference. By training with Sparsemax+ and testing with Softmax, you get the best of both worlds: the sharp, decisive gradient masking of sparse training, and the smooth, sample-able probabilities of softmax inference.
  • The "Right" Kind of Diversity: True generative diversity isn't about spreading probability indiscriminately across the whole vocabulary (which leads to hallucinations). It’s about preserving uncertainty only among semantically valid options.
  • Preventing the CE Steamroller: Cross-Entropy loss never stops optimizing. Even if the model knows the right answer, CE keeps pushing the target token's logit higher, steamrolling perfectly good alternative words. Sparsemax+ stops this over-optimization, preserving the model's pre-trained creative repertoire.

Key Results

The authors tested TS$^2$ on Llama-3.1-8B and Qwen-2.5-7B, comparing it against standard CE, CE with Weight Decay, NEFTune, and GEM (a state-of-the-art diversity-preserving method).

Performance scaling on Chat and Code tasks
  • Chat Quality & Diversity: On AlpacaEval (Best-of-32), TS$^2$ achieved a 33.12% win rate on Llama-3.1-8B, outperforming standard CE (29.77%) and GEM (31.53%). Furthermore, it scored the highest across all lexical and semantic diversity metrics.
  • Code Generation: On HumanEval, TS$^2$ achieved an impressive 87.00% pass@100, crushing standard CE (72.60%). It also proved highly sample-efficient: TS$^2$'s pass@50 rate (82.70%) nearly matched GEM's pass@100 rate.
  • Knowledge Retention: On the OpenLLM Leaderboard, TS$^2$ scaled significantly better with sampling budgets. At N=32, TS$^2$ hit an 88.88% average accuracy on Llama-3.1-8B, a massive 13.2-point absolute improvement over GEM.

Limitations and Future Work

  • Hyperparameter Tuning: The TS$^2$ method introduces a new hyperparameter ($\alpha$) that controls the strength of the tail suppression. The authors note this needs to be empirically determined for different model architectures (e.g., they used $\alpha=0.25$ for Llama and $\alpha=0.5$ for Qwen).
  • Future Work: While qualitative checks showed that TS$^2$ maintains coherent Chain-of-Thought reasoning, the authors suggest that a systematic, benchmark-level study of long-trace reasoning under TS$^2$ is a promising direction for future research.

Summary updated

BibTeX
@inproceedings{xuziyang2026ts,
  author = {XuZiyang and Ananthu Rajendran Pillai and Yinghua Yao and Yuangang Pan},
  title = {{TS$^2$: Training with Sparsemax+, Testing with Softmax for Accurate and Diverse LLM Fine-Tuning}},
  booktitle = {International Conference on Learning Representations},
  year = {2026},
  url = {https://openreview.net/forum?id=CylRqa82Rk},
}
Figure