Ruler: A Model-Agnostic Method to Control Generated Length for Large Language Models
Jiaming Li, Lei Zhang, Yunshui Li, Ziqiang Liu, yuelin bai, Run Luo,, Longze Chen, Min Yang

TL;DR
This paper introduces Ruler, a model-agnostic method that improves large language models' ability to generate responses of specified lengths by using Meta Length Tokens, enhancing control and versatility.
Contribution
The paper proposes Ruler, a novel, model-agnostic approach utilizing Meta Length Tokens to better control response length in large language models, including automatic length constraint generation.
Findings
Ruler significantly improves length control accuracy across various LLMs.
It achieves an average gain of 27.97 on Precise Match and 29.57 on Flexible Match metrics.
Extensive experiments validate Ruler's effectiveness and generalization.
Abstract
The instruction-following ability of large language models enables humans to interact with AI agents in a natural way. However, when required to generate responses of a specific length, large language models often struggle to meet users' needs due to their inherent difficulty in accurately perceiving numerical constraints. To explore the ability of large language models to control the length of generated responses, we propose the Target Length Generation Task (TLG) and design two metrics, Precise Match (PM) and Flexible Match (FM) to evaluate the model's performance in adhering to specified response lengths. Furthermore, we introduce a novel, model-agnostic approach called Ruler, which employs Meta Length Tokens (MLTs) to enhance the instruction-following ability of large language models under length-constrained instructions. Specifically, Ruler equips LLMs with the ability to generate…
Peer Reviews
No public reviews on file for this paper yet. If you reviewed it on a platform where reviews are public (OpenReview, ICLR, NeurIPS, ICML), you can paste yours below so the community can read it here.
Code & Models
Videos
No videos yet. Explain this paper in a talk, walkthrough, or lecture? Add one.
Taxonomy
TopicsNatural Language Processing Techniques · Topic Modeling
