Table of Contents
Fetching ...

PositionID: LLMs can Control Lengths, Copy and Paste with Explicit Positional Awareness

Zekun Wang, Feiyu Duan, Yibo Zhang, Wangchunshu Zhou, Ke Xu, Wenhao Huang, Jie Fu

TL;DR

Novel approaches--PositionID Prompting and PositionID Fine-Tuning--are proposed to enhance the model's ability to continuously monitor and manage text length during generation and enable LLMs to perform copy and paste operations accurately.

Abstract

Large Language Models (LLMs) demonstrate impressive capabilities across various domains, including role-playing, creative writing, mathematical reasoning, and coding. Despite these advancements, LLMs still encounter challenges with length control, frequently failing to adhere to specific length constraints due to their token-level operations and insufficient training on data with strict length limitations. We identify this issue as stemming from a lack of positional awareness and propose novel approaches--PositionID Prompting and PositionID Fine-Tuning--to address it. These methods enhance the model's ability to continuously monitor and manage text length during generation. Additionally, we introduce PositionID CP Prompting to enable LLMs to perform copy and paste operations accurately. Furthermore, we develop two benchmarks for evaluating length control and copy-paste abilities. Our experiments demonstrate that our methods significantly improve the model's adherence to length constraints and copy-paste accuracy without compromising response quality.

PositionID: LLMs can Control Lengths, Copy and Paste with Explicit Positional Awareness

TL;DR

Novel approaches--PositionID Prompting and PositionID Fine-Tuning--are proposed to enhance the model's ability to continuously monitor and manage text length during generation and enable LLMs to perform copy and paste operations accurately.

Abstract

Large Language Models (LLMs) demonstrate impressive capabilities across various domains, including role-playing, creative writing, mathematical reasoning, and coding. Despite these advancements, LLMs still encounter challenges with length control, frequently failing to adhere to specific length constraints due to their token-level operations and insufficient training on data with strict length limitations. We identify this issue as stemming from a lack of positional awareness and propose novel approaches--PositionID Prompting and PositionID Fine-Tuning--to address it. These methods enhance the model's ability to continuously monitor and manage text length during generation. Additionally, we introduce PositionID CP Prompting to enable LLMs to perform copy and paste operations accurately. Furthermore, we develop two benchmarks for evaluating length control and copy-paste abilities. Our experiments demonstrate that our methods significantly improve the model's adherence to length constraints and copy-paste accuracy without compromising response quality.

Paper Structure

This paper contains 44 sections, 1 equation, 15 figures, 9 tables.

Figures (15)

  • Figure 1: The workflows of our methods. We propose PositionID Prompting and PositionID Fine-Tuning for response length control. $S_n$ and $S_t$ denote the system prompts in the normal mode and the PositionID mode, respectively. The model is trained on a mixture of both modes, while inferences are conducted in the normal mode. "Infer" denotes "inference". Additionally, we introduce PositionID CP Prompting for precise copying and pasting. The font with a blue background indicates tool calls, where $s$ and $e$ represent the start and end positions for the copied and pasted spans. The model utilizes external tools to perform copying and pasting operations.
  • Figure 2: Comparing PositionID Prompting with Zero-Shot Prompting on LenCtrl-Bench. "RL", "MW", "MS", and "MP" denote "Rouge-L ($\uparrow$)", "MAE (word) ($\downarrow$)", "MAE (sentence) ($\downarrow$)", and "MAE (paragraph) ($\downarrow$)", respectively.
  • Figure 3: Performance on LenCtrl-Bench with different constraint lengths. The solid line stands for the MAE, while the dotted line indicates the Rouge-L score. Figure a, b, and c showcase the performance of GPT-4 under PositionID prompting at different levels of granularity, while Figure d, e, and f display the results of Yi-6B-Chat after PositionID Fine-Tuning.
  • Figure 4: The distribution of the number of samples at word granularity in the training set.
  • Figure 5: The distribution of the number of samples at sentence granularity in the training set.
  • ...and 10 more figures