Token-level Proximal Policy Optimization for Query Generation

Yichen Ouyang, Lu Wang, Fangkai Yang, Pu Zhao, Chenghua Huang, Jianfeng Liu, Bochen Pang, Yaming Yang, Yuefeng Zhan, Hao Sun, Qingwei Lin, Saravan Rajmohan, Weiwei Deng, Dongmei Zhang, Feng Sun, Qi ZhangarXiv 2024 · DOI

Abstract

Reinforcement Learning from AI Feedback (RLAIF) is a powerful technique for aligning Large Language Models (LLMs), yet it often suffers from reward sparsity, particularly in tasks like personalized search query generation. Standard Proximal Policy Optimization (PPO) typically assigns a single reward to an entire sequence, making precise credit assignment difficult. This paper introduces Token-level Proximal Policy Optimization (TPPO), a framework that provides dense feedback for every token. By utilizing a teacher model to generate word-level rewards and mapping them to tokens, TPPO achieves more stable training and significantly higher relevance in generated queries. Evaluations on both open-source and industrial datasets demonstrate that TPPO outperforms standard PPO and supervised fine-tuning across multiple metrics.

Introduction: The Challenge of Sparse Rewards

In modern web search, personalized query generation assists users by suggesting relevant search terms based on their historical behavior. While Large Language Models (LLMs) excel at generating fluent text, fine-tuning them via Reinforcement Learning (RL) to align with specific user intents remains a significant challenge.

The primary bottleneck is reward sparsity. In a traditional PPO setup, the model generates a complete response and receives a single scalar reward at the end. This creates a "credit assignment" problem: if a generated query is mostly accurate but contains a single hallucinated or irrelevant word, the sentence-level score fails to pinpoint the specific error. This lack of granularity leads to unstable training, slow convergence, and sub-optimal alignment.

Figure 1: Comparison between traditional Sentence-level PPO and the proposed Token-level PPO (TPPO). TPPO provides a dense reward signal for every token generated.

The TPPO Framework

To address these limitations, the authors propose Token-level Proximal Policy Optimization (TPPO). The framework densifies the reward signal by providing feedback for every individual token, bridging the gap between the token-by-token generation process and the reinforcement signal.

1. Token-Level Reward Labeling

The process begins by using a high-capacity "teacher" model (e.g., LLaMA 3-70B) to evaluate generated queries. Instead of a single score, the teacher labels individual words as relevant (2), irrelevant (1), or neutral/separator (0). To ensure the system is tokenizer-agnostic, these labels are initially assigned at the word level and subsequently mapped to the specific tokens used by the target LLM.

2. Hybrid Reward Model Training

The reward model is trained using a dual-objective loss function:

  • Local Loss: A cross-entropy objective that trains the model to predict the category of each token.
  • Global Loss: A Mean Squared Error (MSE) objective that ensures the average of the token-level rewards aligns with the overall sentence-level quality score.

3. Token-level PPO Algorithm

The standard PPO algorithm is modified to ingest these per-token rewards. To prevent the model from "reward hacking"—such as generating excessively long strings of relevant words—the authors implement a Length-weighted penalty. This heuristic scales down rewards once a target query length is exceeded, balancing relevance with conciseness.

Experimental Evaluation

The researchers evaluated TPPO against two primary benchmarks:

  • AOL Dataset: An open-source collection of ~20 million web queries, filtered to 27k samples where user history is used to predict target queries.
  • Industrial Dataset: A large-scale dataset from the Bing search engine (200k samples) containing rich user interaction data, including clicks, visits, and purchases.

Key Results

  • Superior Relevance: On the AOL dataset, TPPO achieved a 50.00% relevance rate, significantly higher than standard PPO (47.65%) and Supervised Fine-Tuning (41.25%).
  • Win Rates: In head-to-head comparisons judged by LLaMA 3-70B, TPPO consistently outperformed standard PPO with a win rate advantage of 2% to 8%.
  • Training Stability: TPPO demonstrated much smoother training curves with lower variance. By providing a "breadcrumb trail" of rewards, the value function more accurately estimates the future impact of specific word choices, leading to faster convergence.

Conclusion and Future Work

TPPO demonstrates that dense, token-level rewards are essential for stable and effective RL alignment in text generation tasks. By matching the reward frequency to the action frequency, the model overcomes the credit assignment problem inherent in traditional PPO.

While the current implementation relies on a computationally expensive teacher model for labeling, future research will focus on improving the efficiency of the labeling pipeline. Additionally, the authors suggest that the benefits of token-level rewards could extend beyond query generation to other complex NLP tasks such as summarization and multi-step reasoning.

Summary updated

BibTeX
@misc{ouyang2024token,
  author = {Yichen Ouyang and Lu Wang and Fangkai Yang and Pu Zhao and Chenghua Huang and Jianfeng Liu and Bochen Pang and Yaming Yang and Yuefeng Zhan and Hao Sun and Qingwei Lin and Saravan Rajmohan and Weiwei Deng and Dongmei Zhang and Feng Sun and Qi Zhang},
  title = {{Token-level Proximal Policy Optimization for Query Generation}},
  year = {2024},
  eprint = {2411.00722},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2411.00722},
}
Figure