Abstract: As large language models expand beyond natural language to domains such as mathematics, multimodal understanding, and embodied agents, tokens increasingly reflect metric relationships rather than purely linguistic meaning. We introduce DIST2Loss, a distance-aware framework designed to train autoregressive discrete models by leveraging predefined distance relationships among output tokens. At its core, DIST2Loss transforms continuous exponential family distributions derived from inherent distance metrics into discrete, categorical optimization targets compatible with the models' architectures. This approach enables the models to learn and preserve meaningful distance relationships during token generation while maintaining compatibility with existing architectures. Empirical evaluations show consistent performance gains in diverse multimodal applications, including visual grounding, robotic manipulation, generative reward modeling, and image generation using vector-quantized features. These improvements are pronounced in cases of limited training data, highlighting DIST2Loss's effectiveness in resource-constrained settings.
Introduction
Standard Large Language Models (LLMs) are built on a discrete autoregressive foundation, predicting the next token by treating the vocabulary as a set of independent categories. While effective for natural language, this "one-hot" approach fails to capture the inherent metric relationships in domains like mathematics, robotics, and spatial reasoning. For instance, a model predicting a coordinate should ideally be penalized less for a "near miss" than for a prediction on the opposite side of an image. This paper introduces DIST²Loss, a framework that incorporates metric distance directly into the training objective.
The DIST²Loss Framework
The authors propose DIScreTized DISTance Loss (DIST²Loss) to provide models with an inductive bias for numerical and spatial proximity. Instead of a hard one-hot target, DIST²Loss generates a "soft" target distribution based on a predefined distance metric.
The process involves three key steps:
- Metric Definition: Selecting an appropriate distance metric, such as Euclidean distance for coordinates or cosine similarity for high-dimensional embeddings.
- Discretization: Transforming a continuous distribution (such as a Gaussian) centered on the ground truth into a discrete probability distribution over the model's vocabulary.
- Optimization: Training the model to minimize the KL Divergence between its predicted distribution and this distance-aware target.
The final loss function is a weighted sum of standard Cross-Entropy and the distance-aware loss: $$\mathcal{L} = \mathcal{L}_{Cross-Entropy} + \alpha \mathcal{L}_{dist}$$ This approach provides an analytical solution for reward alignment, offering greater stability than traditional Reinforcement Learning (RL) methods by avoiding noisy gradients and sampling instability.
Experimental Evaluation
The researchers evaluated DIST²Loss across five distinct domains to demonstrate its versatility and effectiveness in teaching models the "topography" of different data types.
The evaluation included:
- Visual Grounding: Predicting bounding box coordinates using RefCOCO, RefCOCO+, and RefCOCOg datasets.
- Robotic Manipulation: Executing pick-and-place tasks in VIMABench.
- Reward Modeling: Judging AI response quality via RewardBench and MT-Bench.
- Image Generation: Generating realistic images using vector-quantized (VQ) features on ImageNet.
- Function Regression: A synthetic "learning-to-learn" task.
Key Results and Insights
The empirical results highlight several advantages of distance-aware training:
- Data Efficiency: The most significant gains were observed in low-data regimes. In robotics tasks with only 1,000 samples, the DIST²Loss-enhanced model significantly outperformed standard supervised fine-tuning, suggesting the framework acts as a powerful "data multiplier."
- Performance Boosts: In reward modeling, a Llama-3.1-8B model saw a 10% accuracy increase on RewardBench. In visual grounding, the Phi3V baseline reached state-of-the-art performance levels despite having no prior specialized grounding ability.
- High-Dimensional Topography: Beyond simple scalars, the method improved image generation by leveraging distances between high-dimensional embeddings, proving that the model can learn complex feature relationships.
Conclusion
DIST²Loss offers a simple, plug-and-play method to teach foundational models the "metric rules" of the physical and mathematical world. By moving beyond categorical independence, models learn more efficiently and achieve higher accuracy, particularly when training data is scarce. Future work will address multi-token credit assignment and the potential for learning distance metrics dynamically during training.
Summary updated