FROMANNUAL REVIEWS

AAAI 2025

•

February 27, 2025

•

Philadelphia, United States

keywords:

snlp

generation

Despite the great success of large language models (LLMs), efficiently controlling the length of the output sequence still remains a challenge. In this paper, we propose Hansel, an efficient framework for length control in LLMs without affecting its generation ability. Hansel utilizes periodically outputted hidden special tokens to keep track of the remaining target length of the output sequence. Together with techniques to avoid abrupt termination of the output, this seemingly simple method proved to be efficient and versatile, while not harming the coherency and fluency of the generated text. The framework can be applied to any pre-trained LLMs during the finetuning stage of the model, regardless of its original positional encoding method. We demonstrate this by finetuning four different LLMs with Hansel and show that the mean absolute error of the output sequence decreases significantly in every model and dataset compared to the prompt-based length control finetuning. Moreover, the framework showed a substantially improved ability to extrapolate to target lengths unseen during finetuning, such as long dialog responses or extremely short summaries. This indicates that the model learns the general means of length control, rather than learning to match output lengths to those seen during training.

Downloads

Paper

Next from AAAI 2025

Nearly Tight Bounds for Exploration in Streaming Multi-Armed Bandits with Known Optimality Gap
poster

Nearly Tight Bounds for Exploration in Streaming Multi-Armed Bandits with Known Optimality Gap

AAAI 2025

Nikolai Karpov and 1 other author

27 February 2025

Similar lecture

Length Representations in Large Language Models
poster

Length Representations in Large Language Models

EMNLP 2025

Hidetaka Kamigaito
+2
Dasom Choi and 4 other authors

06 November 2025

Stay up to date with the latest Underline news!

Select topic of interest (you can select more than one)

PRESENTATIONS

  • All Presentations
  • For Librarians
  • Resource Center
  • Free Trial
Underline Science, Inc.
1216 Broadway, 2nd Floor, New York, NY 10001, USA

© 2026 Underline - All rights reserved

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.