TL;DR
TRIM (Token Relevance via Interpretable Multi-layer Attention) is a highly efficient, forward-only framework that curates high-quality data subsets ("coresets") for LLM instruction tuning. By shifting from coarse sample-level metrics to fine-grained, token-level attention signals, TRIM outperforms state-of-the-art gradient-based methods by up to 9% while running orders of magnitude faster.
What Problem Does This Paper Address?
Instruction tuning aligns pretrained large language models (LLMs) with human intent, but training on massive, uncurated datasets is computationally prohibitive. While selecting a small, high-quality subset of data—a coreset—can match or even exceed full-dataset performance, finding the right data is difficult.
Current coreset selection methods typically rely on sample-level signals derived from gradients or Hessians. This introduces two major bottlenecks:
- High Computational Cost: Calculating per-sample gradients requires expensive backward passes, making it hard to scale to massive datasets.
- Systematic Biases: Sample-level scoring suffers from length bias (often favoring shorter sequences where signals are concentrated) and loss-centric bias (treating all tokens uniformly, even though task-relevant information is usually sparse and localized).
TRIM addresses these challenges by introducing a token-level, representation-centric approach that operates entirely via efficient forward passes.
Methods
TRIM bypasses gradient computation by leveraging the model's internal attention maps to identify task-defining features. The pipeline consists of a brief warmup phase followed by two primary stages:
- Stage I: Building Token Fingerprints: Using a handful of target validation examples, TRIM computes an Aggregated Token Saliency score for each token. This score combines row saliency (how sharply a token focuses its attention on specific keys) and column saliency (how much attention a token receives from others). It then creates a "fingerprint" (prototype vector) for each token class by taking the saliency-weighted average of their last-layer hidden states.
- Stage II: Candidate Scoring and Selection: TRIM passes candidate samples through the model via a forward pass and measures the cosine similarity between the candidate's token representations and the target task's fingerprints.
If a candidate contains a token class not seen in the validation set, TRIM utilizes a Nearest Fingerprint Fallback (NFF) mechanism to map it to the closest available class in the input-embedding space. Finally, token-level scores are aggregated into a sample-level score using a robust pooling function that balances the mean informativeness, maximum token spikes, and a sequence coverage bonus.
Datasets
The authors evaluated TRIM using a massive candidate pool of 270,679 instruction-tuning examples combined from four public sources:
- DOLLY: Everyday tasks, Q&A, and summaries.
- CoT (Chain-of-Thought): Reasoning-style prompts and responses.
- OASST1: Multi-turn chat conversations.
- FLAN V2: A diverse mixture of fine-tuning tasks.
For math-specific in-domain selection, they utilized the MATHINSTRUCT corpus (262k examples).
Downstream evaluation benchmarks included MMLU (general knowledge), BBH (big-bench hard reasoning), TyDiQA (multilingual question answering), GSM8K (grade-school math), SVAMP, MATHEMATICS, and SIMULEQ.
Key Insights and Ideas
- Token-Level Resolution Mitigates Length Bias: Traditional gradient methods tend to favor shorter sequences. Because TRIM scores at the token level and aggregates matches, it naturally surfaces longer, more complex reasoning examples that sample-level metrics overlook.
- Structural Fidelity Over Surface Overlap: Instead of just matching keywords, TRIM's attention fingerprints capture latent structural patterns (like stepwise logic or mathematical operators). This allows it to excel even when there is low topical overlap between the candidate pool and the target task.
- Cross-Model Transferability: Coresets selected using a smaller, lightweight scorer model (e.g., LLaMA-2-7B) transfer effectively to larger models (LLaMA-2-13B) and entirely different architectures (Mistral-7B), proving that attention signals capture model-agnostic task structures.
Key Results
- Performance Gains: At a fixed 5% coreset budget, TRIM achieved the highest macro-average accuracy (48.56%) across MMLU, BBH, and TyDiQA, outperforming strong gradient baselines like LESS. On TyDiQA, TRIM's 5% coreset actually outperformed fine-tuning on the entire dataset.
- Challenging Downstream Tasks: When selecting data for GSM8K from a non-math corpus, a 5% TRIM coreset achieved 29.52% accuracy—nearly matching full-data fine-tuning (30.25%) and beating LESS by ~8.8%.
- Drastic Speedups: TRIM reduces data selection time from days to hours. For a 5% coreset selection on MMLU, TRIM completed the warmup and scoring in 4.40 hours, compared to 35.76 hours for LESS and 87.95 hours for S2L.
Limitations and Future Work
- Dependence on Validation Sets: TRIM typically requires a small target validation set to construct its initial fingerprints, though the authors demonstrated an in-domain variant that mitigates this.
- Safety and Bias Risks: As a data curation tool, TRIM selects data based on alignment with a target reference set. If the candidate pool contains toxic, biased, or unsafe data that happens to align structurally with the target, TRIM may amplify those properties. The authors note that TRIM should be paired with independent dataset auditing and safety filtering.
- Theoretical Open Questions: Exploring the explicit causal link between "linguistic collapse" geometries during pretraining and the downstream effectiveness of attention-derived selection remains an open area for future research.
Summary updated