STAIF: A Stage-wise Optimization for Complex Instruction Following
Organizations: University of Science and Technology of China · iFLYTEK Research Group
Abstract
Following complex instructions with multiple explicit constraints remains a fundamental challenge for large language models (LLMs). Existing alignment methods, such as DPO, optimize holistic reward signals that often underemphasize strict satisfaction of individual constraints, particularly under out-of-distribution or multi-constraint settings. In this paper, we propose STAIF, a stage-wise optimization framework that decouples the alignment of subjective (soft) constraints from the optimization of objectively verifiable (hard) constraints. Stage 1 applies preference optimization with multiple negative samples to sharpen sensitivity to soft constraints, while Stage 2 applies Reinforcement Learning with Verifiable Rewards (RLVR) to enforce strict compliance with hard constraints. To support this method, we construct STAINSTRUCT, a high-quality bilingual (English, Chinese) dataset of approximately 31,000 complex multi-constraint instructions. Extensive analyses validate the design of STAIF and show state-of-the-art performance on representative benchmarks against strong baselines, as well as genuine generalization.
Figures & tables
| Model | IFEval | IFBench | CFBench | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| P-S | P-L | I-S | I-L | P-S | P-L | I-S | I-L | CSR | ISR | PSR | |
| GPT-4.1 | 87.8 | 91.2 | 91.1 | 93.2 | 38.7 | 43.8 | 42.1 | 47.5 | 83.0 | 61.0 | 70.0 |
| DeepSeek-v3.2 | 86.4 | 90.5 | 90.8 | 93.5 | 39.7 | 43.5 | 42.3 | 46.8 | 87.0 | 65.0 | 72.0 |
| Gemini 2.5 | 89.8 | 91.1 | 92.9 | 94.0 | 39.7 | 50.3 | 43.0 | 52.5 | 83.0 | 60.0 | 70.0 |
| Doubao 1.8 | 83.4 | 87.0 | 88.5 | 90.0 | 29.3 | 36.4 | 32.8 | 39.7 | 83.0 | 60.0 | 68.0 |
| QwQ-32B | 83.5 | 87.7 | 88.8 | 91.8 | 36.3 | 40.4 | 39.7 | 44.2 | 87.0 | 61.0 | 70.0 |
| Model | Method | IFEval | IFBench | CFBench | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| P-S | P-L | I-S | I-L | P-S | P-L | I-S | I-L | CSR | ISR | PSR | ||
| Qwen2.5-7B | StaIF | 87.0 | 88.7 | 91.0 | 92.3 | 44.2 | 48.3 | 46.0 | 49.9 | 82.0 | 51.0 | 61.0 |
| w/o stage1 | 80.2 | 82.8 | 86.3 | 88.1 | 37.8 | 41.2 | 39.7 | 43.9 | 80.0 | 45.0 | 58.0 | |
| w/o stage2 | 79.4 | 82.0 | 85.5 | 87.6 | 38.4 | 42.5 | 40.3 | 45.4 | 81.0 | 46.0 | 58.0 | |
| Tulu3-8B | StaIF | 90.4 | 91.1 | 92.9 | 93.5 | 50.3 | 52.0 | 53.1 | 55.2 | 73.0 | 35.0 | 45.0 |
| w/o stage1 | 85.1 | 87.0 | 89.3 | 90.2 | 42.2 | 45.6 | 43.3 | 47.8 | 70.0 | 33.0 | 41.0 | |
| Method | IFEval | IFBench | ||||||
|---|---|---|---|---|---|---|---|---|
| P-S | P-L | I-S | I-L | P-S | P-L | I-S | I-L | |
| DPO (joint) | 79.1 | 82.0 | 84.6 | 86.9 | 36.9 | 39.5 | 39.7 | 43.7 |
| RLVR (joint) | 81.6 | 83.3 | 86.9 | 89.4 | 41.3 | 43.2 | 44.1 | 45.1 |
| DPO+RLVR (joint) | 84.5 | 86.8 | 88.4 | 90.7 | 41.1 | 45.1 | 44.7 | 48.3 |
| StaIF | 87.0 | 88.7 | 91.0 | 92.3 | 44.2 | 48.3 | 46.0 | 49.9 |
| Model | Method | Negative | IFEval | IFBench | CFBench | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Sample | P-S | P-L | I-S | I-L | P-S | P-L | I-S | I-L | CSR | ISR | PSR | ||
| Qwen2.5-7B | Stage 1 only | Single | 76.3 | 80.4 | 83.5 | 86.5 | 34.0 | 38.1 | 36.1 | 40.6 | 80.0 | 43.0 | 56.0 |
| Multiple | 79.4 | 82.0 | 85.5 | 87.6 | 38.4 | 42.5 | 40.3 | 45.4 | 81.0 | 46.0 | 58.0 | ||
| StaIF | Single | 85.0 | 86.3 | 89.7 | 90.6 | 42.2 | 46.5 | 44.9 | 47.5 | 80.0 | 46.0 | 56.0 | |
| Multiple | 87.0 | 88.7 | 91.0 | 92.3 | 44.2 | 48.3 | 46.0 | 49.9 | 82.0 | 51.0 | 61.0 | ||
| Tulu3-8B | Stage 1 only | Single | 76.5 | 79.4 | 83.5 | 86.1 | 31.6 | 34.6 | 33.7 | 37.0 | 69.0 | 30.0 | 40.0 |
| Model | MT-Bench | GSM8K | MMLU-Pro | BBH |
|---|---|---|---|---|
| Qwen2.5-7B-Instruct | 7.4 | 91.6 | 55.9 | 72.3 |
| + StaIF | 7.5 | 91.4 | 56.0 | 74.4 |
| Tulu3-8B-SFT | 6.3 | 78.7 | 35.0 | 67.8 |
| + StaIF | 7.1 | 81.3 | 35.4 | 71.2 |
Appendix figures & tables6 assets
Supplementary material from the paper’s appendix.
Appendix
| Category | Sub-category | Description |
| Semantic Understanding | Semantic Analysis | Analyze the logical structure, semantic relationships, and core meaning of text. |
| Sentiment Classification | Identify the emotional tendency or intensity of text. | |
| Element Extraction | Extract key information units (e.g., people, events, relationships) from unstructured text. | |
| Element Recognition | Identify extracted entities (e.g., “Apple” “Organization”, “Beijing” “Location”). | |
| Natural Language Inference | Determine the logical relationship among contents (Entailment/Contradiction/Neutral). | |
| Text Processing | Preprocessing (cleaning, segmentation, normalization) or postprocessing (formatting, filtering) of text data. |
| Category | Sub-category | Description |
| Content | Theme | The generated content should focus on a specific topic or field. |
| Exclusion | Clearly specify the information or content that should not be included in the generated content. | |
| Inclusion | Clearly specify the particular information or content that must be included in the generated content. | |
| Value | The generated content should not contain information that violates values, such as safety, false information, discrimination, or bias. | |
| Numerical | Limit the length and number of words, sentences, and paragraphs in the generated content, or use numerical precision constraints to ensure accuracy. | |
| Target Audience | The generated content should target a specific audience, which affects terminology, detail level, and complexity. |
| (9) | ||||
| Stage 1 | |
| Initial learning rate | |
| Number of training epochs | 3 |
| 0.1 | |
| Maximum sequence length | 4,096 |
| Per-GPU batch size | 1 |
| Stage 2 | |
|---|---|
| Initial learning rate | |
| Maximum sequence length | 4,096 |
| Number of training epochs | 2 |
| Number of rollouts per iteration | 16 |
| KL divergence loss coefficient | |
| Model | IFEval | CFBench | |||||
|---|---|---|---|---|---|---|---|
| P-S | P-L | I-S | I-L | CSR | ISR | PSR | |
| Qwen2.5-7B-Instruct | |||||||
| VeRL | – | 83.9* | – | – | 76.0* | 40.0* | 52.0* |
| RLCF | 72.6* | 77.3* | 80.3* | 84.1* | – | – | – |
| StaIF | 87.0 | 88.7 | 91.0 | 92.3 | 82.0 | 51.0 | 61.0 |
| LLaMA3-8B-Instruct | |||||||
LLM Alignment
Large language model alignment studies methods for making models follow human intentions, values, and safety constraints across contexts.
See all 611 papers