TL;DR
DIRECT (DPO-based Inference RECTification) is a novel framework that dramatically improves both the accuracy and speed of Large Language Models (LLMs) on sequence labeling tasks like Named Entity Recognition (NER). By combining Direct Preference Optimization (DPO) during training with a constrained template-filling decoding mechanism at inference, DIRECT eliminates formatting errors and delivers up to a 9× inference speedup over existing state-of-the-art methods.
What Problem Does This Paper Address?
Sequence labeling tasks—such as Named Entity Recognition (NER) and Part-of-Speech (POS) tagging—require fine-grained, token-level precision. While LLMs possess immense knowledge, adapting them to these tasks via standard supervised fine-tuning (SFT) introduces two major bottlenecks:
- Insufficient Domain Alignment: LLMs often struggle to strictly adhere to rigid formatting constraints, frequently outputting malformed structures or hallucinated labels despite explicit instructions.
- Low Inference Efficiency: Standard autoregressive decoding forces the model to redundantly regenerate the entire input text alongside the predicted labels, leading to massive computational waste and slow inference speeds.
Methods
The authors introduce DIRECT, a framework that tackles these challenges through a two-pronged approach:
- Precision-Oriented Model Optimization (Training Time): After standard SFT, the authors apply Direct Preference Optimization (DPO). To train the model to avoid subtle boundary and formatting errors, they use an offline sampling strategy to construct preference pairs. The ground-truth sequence serves as the preferred response, while model-generated outputs that score high in text similarity (BLEU) but low in task accuracy (F1) are selected as the less-preferred responses.
- Inference Rectification (Inference Time): Instead of letting the LLM generate text freely, DIRECT uses a template-filling mechanism. The input text and formatting structure are pre-filled into the model's Key-Value (KV) Cache. During decoding, the model's search space is strictly constrained to a predefined candidate set of valid labels. The model only generates the label tokens, completely bypassing the need to re-compute or re-generate the original words.
Datasets
The framework was extensively evaluated under low-resource settings (sampling $K = 250, 500, \text{and } 1000$ samples for training) across eight benchmarks:
- NER (Chinese): Weibo, Youku, Taobao, Resume
- NER (English): MIT-Movie, CoNLL03
- POS Tagging (Chinese): UD, CTB6
Key Insights and Ideas
- High BLEU $\neq$ High F1: In sequence labeling, a model can generate an output that looks 95% textually correct (high BLEU) but misses exact entity boundaries (low F1). Using these specific "near-misses" as negative examples in DPO provides a powerful contrastive signal that sharpens the model's decision boundaries.
- KV Cache as a Structure Enforcer: Instead of relying on the model to remember formatting rules autoregressively, treating the task as a template-filling exercise turns open-ended generation into a highly efficient token-classification task. This guarantees syntactically valid outputs.
Key Results
- State-of-the-Art Accuracy: DIRECT consistently outperformed strong baselines (InstructUIE, GoLLIE, and GNER) across nearly all datasets. Notably, on the MIT-Movie dataset, DIRECT achieved substantial F1-score improvements of up to 15.69% in low-resource settings.
- Massive Speedups: By eliminating redundant token generation, DIRECT achieved up to a 9× speedup in inference time compared to state-of-the-art methods, completing inference on the test set in 32.86 seconds compared to GNER's 309.44 seconds.
Limitations and Future Work
Not explicitly discussed in the paper.
Summary updated