Length Representations in Large Language Models

Fuente: arXiv
Saved in:
Bibliographic Details
Main Authors: Moon, Sangjun, Choi, Dasom, Kwon, Jingun, Kamigaito, Hidetaka, Okumura, Manabu
Format: Preprint
Published: 2025
Subjects:
Online Access:
Tags: Add Tag
No Tags, Be the first to tag this record!
_version_ 1866916910456635392
author Moon, Sangjun
Choi, Dasom
Kwon, Jingun
Kamigaito, Hidetaka
Okumura, Manabu
author_facet Moon, Sangjun
Choi, Dasom
Kwon, Jingun
Kamigaito, Hidetaka
Okumura, Manabu
contents Large language models (LLMs) have shown remarkable capabilities across various tasks, that are learned from massive amounts of text-based data. Although LLMs can control output sequence length, particularly in instruction-based settings, the internal mechanisms behind this control have been unexplored yet. In this study, we provide empirical evidence on how output sequence length information is encoded within the internal representations in LLMs. In particular, our findings show that multi-head attention mechanisms are critical in determining output sequence length, which can be adjusted in a disentangled manner. By scaling specific hidden units within the model, we can control the output sequence length without losing the informativeness of the generated text, thereby indicating that length information is partially disentangled from semantic information. Moreover, some hidden units become increasingly active as prompts become more length-specific, thus reflecting the model's internal awareness of this attribute. Our findings suggest that LLMs have learned robust and adaptable internal mechanisms for controlling output length without any external control.
format Preprint
id arxiv_https___arxiv_org_abs_2507_20398
institution arXiv
publishDate 2025
record_format arxiv
spellingShingle Length Representations in Large Language Models
Moon, Sangjun
Choi, Dasom
Kwon, Jingun
Kamigaito, Hidetaka
Okumura, Manabu
Computation and Language
Large language models (LLMs) have shown remarkable capabilities across various tasks, that are learned from massive amounts of text-based data. Although LLMs can control output sequence length, particularly in instruction-based settings, the internal mechanisms behind this control have been unexplored yet. In this study, we provide empirical evidence on how output sequence length information is encoded within the internal representations in LLMs. In particular, our findings show that multi-head attention mechanisms are critical in determining output sequence length, which can be adjusted in a disentangled manner. By scaling specific hidden units within the model, we can control the output sequence length without losing the informativeness of the generated text, thereby indicating that length information is partially disentangled from semantic information. Moreover, some hidden units become increasingly active as prompts become more length-specific, thus reflecting the model's internal awareness of this attribute. Our findings suggest that LLMs have learned robust and adaptable internal mechanisms for controlling output length without any external control.
title Length Representations in Large Language Models
topic Computation and Language
url https://arxiv.org/abs/2507.20398