Proximal Policy Optimization Actual Combat: Manipulating Output Tokenizer Length

Miao Fan, Chen Hu, Shuchang ZhouarXiv 2023 · DOI

Abstract

While Supervised Fine-Tuning (SFT) is effective for knowledge acquisition in Large Language Models (LLMs), it often struggles with precise stylistic constraints. This paper investigates the use of Proximal Policy Optimization (PPO) to solve the task of generating responses of specific tokenizer lengths. We demonstrate that PPO acts as a mechanical "spring," effectively stretching or compressing model outputs to meet exact length requirements. Our results show that a PPO-tuned Llama-7b model can achieve 100% accuracy on 100-token targets, significantly outperforming commercial models like GPT-4.

Introduction

Aligning LLMs with human values via Reinforcement Learning from Human Feedback (RLHF) is a complex and often unstable process. A primary difficulty lies in the abstract nature of reward models for concepts like "helpfulness." To isolate and study PPO behavior, we propose a "Golden" reward model task: Output Tokenizer Length Manipulation. Unlike subjective qualities, length is perfectly measurable, allowing for a clear evaluation of PPO's ability to master stylistic constraints that SFT typically fails to regulate strictly.

Methodology

We utilized a Llama-7b base model and compared SFT against PPO using several specialized reward mechanisms:

  • General Reward ($R_g$): A binary reward based on the proximity of output length to the target.
  • Validity Reward ($R_v$): To prevent "reward hacking" (generating repetitive gibberish), we employed the gzip algorithm to measure information density. High compression ratios resulted in withheld rewards.
  • Probability Ratio Objective (PRO): A modified loss function focusing on the End-of-Sequence (EOS) token position to improve training stability.
  • Progressive Training (PPO_2step): A two-stage process where the model is first trained on a single length and then fine-tuned for multi-length versatility.

Results and Analysis

The PPO-optimized model demonstrated remarkable precision in length control. While the base model's outputs were often erratic, the PPO model consistently hit target lengths with high accuracy.

Figure 5: Distribution of output lengths for the base model versus the PPO-optimized model. The PPO model shows a sharp peak around the target length (mean 101.75), demonstrating superior precision.

Quantitatively, the PPO model outperformed industry leaders on this specific task. For a 100-token target, the PPO-tuned Llama-7b achieved 100% accuracy, whereas GPT-4 only reached 18.63%.

Figure 6: Comparison of length-following accuracy across different models. PPO achieves near-perfect precision, significantly outperforming GPT-3.5, GPT-4, and Claude.

Discussion: The "Spring" Metaphor

Our findings suggest a functional division: SFT for Knowledge, PPO for Style. SFT is superior at "knowledge-based" tasks but fails to strictly regulate format. PPO, conversely, provides the mechanical tension—like a spring—needed to fit existing knowledge into a specific "container" or token length. However, a "smart union" is required, as PPO models can sometimes lose the content comprehension strengths of their SFT counterparts. This "Instruction Following Gap" remains a key area for future research.

Conclusion

PPO is a powerful tool for enforcing strict stylistic constraints in LLMs. By using measurable objectives like tokenizer length, we can stabilize PPO training and achieve performance that exceeds much larger commercial models. Future work will focus on amalgamating SFT's knowledge depth with PPO's stylistic precision to create models that are both intelligent and highly controllable.

Summary updated

BibTeX
@misc{fan2023proximal,
  author = {Miao Fan and Chen Hu and Shuchang Zhou},
  title = {{Proximal Policy Optimization Actual Combat: Manipulating Output Tokenizer Length}},
  year = {2023},
  eprint = {2308.05585},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2308.05585},
}
Figure