TL;DR
Discrete autoregressive language models are increasingly applied to non-textual tasks like robotics, computer vision, and mathematics, but standard cross-entropy training treats all incorrect token predictions as equally wrong. This paper introduces DIST²Loss (DIScreTized DISTance Loss), a distance-aware objective that replaces rigid one-hot targets with smooth, reward-weighted distributions based on predefined token distances. This simple, plug-and-play loss function acts as a stable, closed-form alternative to reinforcement learning, significantly boosting data efficiency and performance across diverse multimodal tasks.
What Problem Does This Paper Address?
Large Language Models (LLMs) are no longer just for text; they are widely adapted to predict bounding boxes in vision, joint angles in robotics, and quantized embeddings in image generation. However, these models are traditionally trained using standard cross-entropy loss against "one-hot" target distributions.
This categorical formulation introduces a major flaw when dealing with metrically structured data: it ignores numerical proximity. For instance, if a robot arm needs to rotate 108 degrees, predicting 109 degrees is penalized just as harshly as predicting 0 degrees. The model completely ignores the intrinsic geometry of the token space. While Reinforcement Learning (RL) can teach models these nuances via distance-based rewards, RL is notoriously unstable, computationally expensive, and requires extensive sampling and rollouts.
Methods
The authors propose DIScreTized DISTance Loss (DIST²Loss) to inject metric priors directly into the target distribution.
Instead of forcing the model to match a single correct token, DIST²Loss constructs a soft target distribution over the vocabulary using a discretized exponential family distribution:
$$p_d(v|x, t) = \frac{\exp\left(-\frac{d(v,x,t)}{\tau}\right)}{\sum_{v'\in V_d} \exp\left(-\frac{d(v',x,t)}{\tau}\right)}$$
where $d$ is a task-specific distance metric (such as Euclidean distance for coordinates or cosine distance for high-dimensional embeddings) and $\tau$ is a temperature hyperparameter controlling the distribution's smoothness. The final training objective simply adds this distance-based regularization to the standard cross-entropy loss ($\mathcal{L} = \mathcal{L}_{CE} + \alpha \mathcal{L}_{dist}$).
Conceptually, the authors demonstrate that DIST²Loss is the closed-form solution to entropy-regularized policy optimization. By treating token distances as negative rewards, the optimal policy can be computed analytically in a single forward pass, completely bypassing the need for unstable RL sampling, rollouts, or value networks.
Datasets
The authors evaluate their method across five distinct domains using established benchmarks:
- Toy Regression: A synthetic meta-linear regression task designed to test structural generalization.
- Visual Grounding: Combined training sets of RefCOCO, RefCOCO+, and RefCOCOg for bounding box coordinate prediction.
- Robotic Manipulation: VIMABench, evaluating robot arm manipulation across various data scales (1K, 10K, 100K samples).
- Generative Reward Modeling: The HelpSteer2 dataset for predicting human preference scores, evaluated on RewardBench and MT-Bench.
- Image Generation: ImageNet (256×256) using vector-quantized (VQ) tokens from the LlamaGen pipeline.
Key Insights and Ideas
- RL Benefits Without the RL Pain: Framing distance-aware supervision as a solved RL problem is highly elegant. It provides the alignment benefits of reinforcement learning with known rewards while remaining as stable and fast as standard supervised fine-tuning (SFT).
- Geometry Dictates Semantics: In high-dimensional spaces like VQ codebooks for image generation, token distance directly correlates with semantic similarity. As shown in the paper's token-replacement experiments, replacing a token with a "close" neighbor preserves image structure, while a "distant" token destroys it. DIST²Loss successfully exploits this intrinsic geometry during training.
- Potent in Data-Scarce Regimes: The metric prior acts as a powerful regularizer. It is especially effective when training data is limited (e.g., small robotics datasets) because it guides the model away from making catastrophically large errors early in training.
Key Results
- Visual Grounding: Fine-tuning a Phi3V model with DIST²Loss achieved performance on par with state-of-the-art models that underwent large-scale pretraining on detection datasets. Hard-case analysis showed that even when predictions were technically incorrect (IoU < 0.5), DIST²Loss outputs remained geometrically much closer to the ground truth than standard SFT.
- Robotic Manipulation: On VIMABench, DIST²Loss significantly boosted success rates, particularly in the data-scarce 1K sample setting, where L1 protocol accuracy jumped from 49.6% (SFT) to 53.9%.
- Reward Modeling: Applying DIST²Loss to a Llama-3.1-8B backbone improved RewardBench classification accuracy from 75.3% (SFT) to 85.3%, showing massive gains in the challenging "Chat Hard" and "Safety" domains.
- Image Generation: On ImageNet, it consistently outperformed the standard SFT baseline, lowering the Frechet Inception Distance (FID) and improving the Inception Score (IS) across both 111M and 343M parameter model variants.
Limitations and Future Work
- The Credit Assignment Problem: For multi-token sequences (like multi-digit numbers), a global error does not naturally break down into independent token-level contributions. While the authors propose practical workarounds like Place Value Weighting (weighting higher digits more heavily), explicit credit assignment mechanisms for complex multi-token structures remain an open challenge.
- Extension to Non-Metric Structures: Currently, the loss requires a well-defined metric space. The authors note that extending this framework to non-metric structures, such as hierarchical or relational outputs, is a promising direction for future research.
Summary updated