Despite the strong performance of Large Language Models (LLMs) on complex instruction-following tasks, precise control of output length remains a persistent challenge. Existing methods primarily attempt to enforce length constraints by externally imposing length signals or optimization objectives, while largely overlooking the underlying limitation: the model's intrinsic deficit in length cognition. To address this, we propose LARFT (Length-Aware Reinforcement Fine-Tuning), a training framework that aligns the model's length cognition with its action. Specifically, LARFT integrates length-oriented reinforcement learning with a hindsight length awareness. By transforming on-policy data into hindsight self-awareness tasks where the model learns to identify the actual length of its own generation, LARFT jointly optimizes the model's internal representation of length information and refines its policy to satisfy length constraints, thereby achieving precise and reliable length instruction following. Extensive experiments across four base models demonstrate that LARFT outperforms existing baselines, achieving an average improvement of +20.92 points across three length instruction following benchmarks with only a marginal decline of -1.45 points on four general capability benchmarks.
Figures & tables
Figure 1: Overview of the Length-Aware Reinforcement Fine-Tuning (LARFT) framework. (I) Illustrates the Cognition-Action Gap, where standard LLMs fail to align their output length with user instructions. (II) Presents our LARFT method, which unifies Length-Oriented RL and Hindsight Length Awareness to align generation with constraints. (III) Demonstrates that LARFT achieves precise length control while maintaining robust general capabilities.
Method
In-Distribution Tasks (Length Following)
Out-of-Distribution Tasks (General)
LIFEBench
LongBench
Lenctrl-Bench
MMLU ↑
GSM8K ↑
IFEval ↑
GPQA ↑
LD ↓
LS ↑
S l ↑
S q ↑
MAE ↓
ROUGE-L ↑
Qwen2.5-3B-Instruct
Origin
38.79
46.04
76.38
68.49
28.76
18.08
65.07
76.19
73.02
31.03
SFT
65.60
26.93
79.88
66.04
45.44
16.87
65.00
76.04
66.79
29.24
RL
30.71
54.10
87.23
69.49
13.92
20.86
65.00
74.83
74.10
30.13
Table 1: Main results on length-following tasks and general benchmarks. Bold values indicate the best performance.
Figure 3
Method
λt
w/o Sc
0.005
0.01 (Default)
0.05
LIFEBench LS ( ↑ )
75.67
80.57
79.29
73.44
LongBench Sl ( ↑ )
94.58
96.75
96.12
94.22
Lenctrl-Bench MAE ( ↓ )
8.45
7.00
7.36
8.80
Table 2: Ablation study on optimization hyperparameters. We report the performance across three length-following benchmarks. “Sc” indicates Cosine Annealing Scheduling.
Figure 4: Length probing correlations across layers. The plots compare the ability to decode response length from the hidden states of the first token (Left) and the last token (Right) .
Appendix figures & tables8 assets
Supplementary material from the paper’s appendix.
Appendix
Figure 5: Cosine annealing schedule for λt .
Figure 6: Data construction pipeline with sample counts at each stage.
Length Category
Word Range
Count
Percentage
Short
10–100
2,156
24.7%
Medium
101–500
3,421
39.2%
Long
501–1,000
1,892
21.7%
Very Long
1,001–4,000
1,263
14.5%
Total
10–4,000
8,732
100.0%
Appendix
Table 3: Distribution of dataset samples by length category. The dataset covers a broad range of lengths, with the majority of samples falling into the Medium (101–500 words) category.
Benchmark
Task Type
Few-shot
Metric
MMLU ( Hendrycks et al., 2021 )
Knowledge
5-shot
Accuracy
GSM8K ( Cobbe et al., 2021 )
Math Reasoning
5-shot
Exact Match
IFEval ( Zhou et al., 2023 )
Instruction Following
0-shot
Prompt Strict Acc
GPQA ( Rein et al., 2024 )
Graduate-level QA
5-shot
Accuracy
Appendix
Table 4: General capability benchmark configurations.
Parameter
Length Benchmarks
General Benchmarks
Backend
vLLM
vLLM
Temperature
0.6
0.0 (greedy)
Top-p
0.9
1.0
Max New Tokens
8192
Task-dependent
Tensor Parallel Size
4
4
Appendix
Table 5: Inference configuration for all evaluations.
Model Family
Model
Params
Context
Maximum Output Length
Qwen2.5
Qwen2.5-3B-Instruct
3B
32K
8192
Qwen2.5-7B-Instruct
7B
32K
8192
Llama3
Llama-3.2-3B-Instruct
3B
128K
128K
Llama-3.1-8B-Instruct
8B
128K
128K
Appendix
Table 6: Model specifications used in experiments.
Table 12
Hyperparameter
Value
Hyperparameter
Value
Data Configuration
Rollout Configuration
Rollout Batch Size
128
Rollouts per Prompt ( G )
4
Max Prompt Length
2048
Temperature
0.7
Max Response Length
8000
Top-p
0.8
Truncation Side
Left
GPU Mem Utilization
0.8
Policy Optimization
Regularization & Schedule
Appendix
Table 9: Hyperparameters for GRPO-based reinforcement learning.
Reinforcement learning (RL) has enhanced the capabilities of large language models (LLMs) through reward-driven training. Nevertheless, this process can introduce excessively long responses, inflating inference latency and computational overhead. Prior length-control approaches typically rely on fixed heuristic reward shaping, which can misalign with the task objective and require brittle tuning. In this work, we propose LACONIC, a reinforcement learning method that enforces a target token budget during training. Specifically, we update policy models using an augmented objective that combines the task reward with a length-based cost. To balance brevity and task performance, the cost scale is adaptively adjusted throughout training. This yields robust length control while preserving task reward. We provide a theoretical guarantee that support the method. Across mathematical reasoning models and datasets, LACONIC preserves or improves pass@1 while reducing output length by over 50%. It maintains out-of-domain performance on general knowledge and multilingual benchmarks with 44% fewer tokens. Moreover, LACONIC integrates into standard RL-tuning with no inference changes and minimal deployment overhead.
Chang Liu, Yiran Zhao, Lawrence Liu +3
University of California, Los Angeles · Salesforce AI Research · National University of Singapore +1
Token serves as the fundamental unit of computation in modern autoregressive models, and generation length directly influences both inference cost and reasoning performance. Despite its importance, existing approaches lack fine-grained length modeling, operating primarily at the coarse-grained sequence level. We introduce the Length Value Model (LenVM), a token-level framework that models the remaining generation length. By formulating length modeling as a value estimation problem and assigning a constant negative reward to each generated token, LenVM predicts a bounded, discounted return that serves as a monotone proxy for the remaining generation horizon. This formulation yields supervision that is annotation-free, dense, unbiased, and scalable. Experiments on LLMs and VLMs demonstrate LenVM provides a highly effective signal at inference time. On the LIFEBench exact length matching task, applying LenVM to a 7B model improves the length score from 30.9 to 64.8, significantly outperforming frontier closed-source models. Furthermore, LenVM enables continuous control over the trade off between performance and efficiency. On GSM8K at a budget of 200 tokens, LenVM maintains 63% accuracy compared to 6 percent for token budget baseline. It also accurately predicts total generation length from the prompt boundary. Finally, LenVM's token-level values offer an interpretable view of generation dynamics, revealing how specific tokens shift reasoning toward shorter or longer regimes. Results demonstrate that LenVM supports a broad range of applications and token length can be effectively modeled as a token-level value signal, highlighting the potential of LenVM as a general framework for length modeling and as a length-specific value signal that could support future RL training. Code is available at https://github.com/eric-ai-lab/Length-Value-Model.
Zhen Zhang, Changyi Yang, Zijie Xia +11
University of California, Santa Barbara · Carnegie Mellon University · LMSYS Org +2
Precise instruction-following is a fundamental ability of large language models (LLMs), requiring their outputs to strictly satisfy objective constraints in input instructions. In complex application scenarios, these constraints often possess diverse scopes that govern specific response segments rather than the entire output. However, existing optimization methods often neglect constraint scope during data construction and rely on binary per-constraint rewards, yielding limited data diversity and sparse supervision for complex constraints. To this end, we propose ScopeIF, a novel training framework for scope-aware precise instruction-following. We first introduce a unified schema that factorizes objective constraints into three decoupled dimensions: Scope, Target, and Range. Grounded in this schema, we construct ScopeInstruct, a large-scale instruction dataset with diverse scope-aware constraints, and combine tool-grounded verification with graded reward modeling to quantify the violation degree of each constraint, providing dense supervision for policy optimization. Extensive experiments demonstrate that ScopeIF consistently outperforms existing methods, particularly on complex scope-aware constraints, while preserving general capabilities. Notably, it enables optimized Qwen3-4B and 8B models to rival or surpass strong frontier models such as Gemini-2.5-Pro and DeepSeek-V3.2, establishing an effective paradigm for advancing scope-aware instruction-following. Our code and data are available at https://github.com/thu-coai/ScopeIF.
Bosi Wen, Yilin Niu, Xiaoying Ning +3
The Conversational Artificial Intelligence (CoAI) Group, Tsinghua University · Zhipu AI