Papers
Topics
Authors
Recent
Search
2000 character limit reached

GAPO: Group-Aware Policy Optimization

Updated 23 November 2025
  • GAPO is a reinforcement learning framework that extends group-based advantage methods to optimize diversity, coverage, and uniformity of generated responses.
  • It replaces scalar per-sample rewards with group-dependent, frequency-aware reward vectors to directly mitigate mode collapse and boost output variation.
  • Empirical results demonstrate GAPO's effectiveness in improving metrics like JSD, Unique@N, and 1-Self-BLEU while balancing diversity with baseline accuracy.

Group-Aware Policy Optimization (GAPO) is a reinforcement learning framework for training LLMs that generalizes the group-based advantage methodology of Group Relative Policy Optimization (GRPO) to enable optimization over group-level properties such as diversity, coverage, and uniformity of generated responses. GAPO replaces scalar, per-sample rewards with group-dependent reward vectors, facilitating direct optimization for output diversity and mitigating mode collapse in generative models. By leveraging a frequency-aware reward function, GAPO achieves greater uniformity and diversity in model outputs without sacrificing baseline accuracy, and extends naturally to both closed-set and open-ended tasks in LLM generation scenarios (Anschel et al., 16 Nov 2025).

1. Formalization and Objective

GAPO is formulated as an extension of GRPO, substituting standard per-output reward rir_i with a group-level reward R~(o)i\tilde R(\mathbf o)_i for each candidate in a group o={o1,…,oG}\mathbf o = \{o_1, \ldots, o_G\} of GG model outputs. The group-aware reward depends on all GG outputs jointly and is designed to capture properties like frequency or diversity among completions.

Notation:

  • θ\theta: current policy parameters
  • πθ(oi,t∣q,oi,<t)\pi_\theta(o_{i,t} | q, o_{i,<t}): policy probability for token tt of candidate ii
  • o={o1,…,oG}\mathbf o = \{o_1, \ldots, o_G\}: group of rollouts
  • R~(o)i\tilde R(\mathbf o)_i0: policy used to generate R~(o)i\tilde R(\mathbf o)_i1
  • R~(o)i\tilde R(\mathbf o)_i2: fixed reference policy for KL penalty
  • R~(o)i\tilde R(\mathbf o)_i3: PPO clipping hyperparameter
  • R~(o)i\tilde R(\mathbf o)_i4: KL-penalty coefficient

Importance-sampling ratios:

R~(o)i\tilde R(\mathbf o)_i5

Group-normalized rewards and advantages:

R~(o)i\tilde R(\mathbf o)_i6

R~(o)i\tilde R(\mathbf o)_i7

Clipped surrogate loss:

R~(o)i\tilde R(\mathbf o)_i8

Full objective:

R~(o)i\tilde R(\mathbf o)_i9

This general formulation provides the substrate for implementing group-consistent learning. When o={o1,…,oG}\mathbf o = \{o_1, \ldots, o_G\}0 is chosen as a frequency-aware diversity reward, GAPO directly optimizes for uniform output probabilities and diversity, outperforming standard RL-fine-tuning and conventional supervised methods (Anschel et al., 16 Nov 2025).

2. Frequency-Aware Group-Level Reward Mechanism

A key application of GAPO is for frequency-based diversity optimization over a known valid answer set o={o1,…,oG}\mathbf o = \{o_1, \ldots, o_G\}1. Empirical frequency for o={o1,…,oG}\mathbf o = \{o_1, \ldots, o_G\}2 is defined as: o={o1,…,oG}\mathbf o = \{o_1, \ldots, o_G\}3 Targeting uniformity o={o1,…,oG}\mathbf o = \{o_1, \ldots, o_G\}4, the per-output reward is: o={o1,…,oG}\mathbf o = \{o_1, \ldots, o_G\}5

  • Over-represented outputs (o={o1,…,oG}\mathbf o = \{o_1, \ldots, o_G\}6) are penalized.
  • Under-represented outputs (o={o1,…,oG}\mathbf o = \{o_1, \ldots, o_G\}7) are rewarded.
  • Invalid outputs receive reward o={o1,…,oG}\mathbf o = \{o_1, \ldots, o_G\}8.

This frequency penalty mechanism enforces uniform sampling, directly combating mode collapse and promoting response diversity (Anschel et al., 16 Nov 2025).

3. Training Workflow and Pseudocode

GAPO adopts a group-based rollout approach in which, for each prompt o={o1,…,oG}\mathbf o = \{o_1, \ldots, o_G\}9, GG0 completions are sampled to form a group. Pseudocode for a single training iteration is as follows:

  1. Sample batch of prompts GG1.
  2. For each GG2, generate GG3 rollouts GG4 using GG5.
  3. For each group GG6:
    • Compute empirical frequencies GG7 (GG8).
    • Calculate group-aware rewards GG9.
    • Compute group mean GG0, stddev GG1, and advantages GG2.
  4. Aggregate clipped surrogate loss GG3 using GG4.
  5. Evaluate GG5.
  6. Perform a gradient update on GG6.
  7. Update GG7 (Anschel et al., 16 Nov 2025).

Recommended hyperparameters include group size GG8 for stable frequency estimation, and, for diversity tasks, a zero KL penalty (GG9).

4. Evaluation Metrics for Diversity and Coverage

GAPO’s impact on LLM response diversity is quantified using several established metrics:

Metric Definition Significance
Jensen–Shannon Divergence θ\theta0 Uniformity to target
Unique@N Number of distinct completions in θ\theta1 samples Output coverage
Semantic Diversity θ\theta2 (embedding space) Diversity in meaning
Lexical Diversity θ\theta3-Self-BLEU (lower BLEU = higher lexical diversity) Surface variation

Performance on list sampling, open-ended prompts, and creative writing tasks is reported using these measures, with GAPO delivering JSD reductions (θ\theta4 vs. θ\theta5 baseline), over θ\theta6 increase in Unique@500 for open sets, and up to θ\theta7 average increase in semantic diversity in creative tasks (Anschel et al., 16 Nov 2025).

5. Empirical Results and Trade-offs

Experiments applying GAPO to Qwen2.5 models (7B and 32B) reveal the following:

  • In closed-set sampling, GAPO achieves JSDθ\theta8, outperforming baselines such as ChatGPT-4o, Claude, and Gemini models, which remain above θ\theta9.
  • For open-ended prompts, Unique@500 improves from πθ(oi,t∣q,oi,<t)\pi_\theta(o_{i,t} | q, o_{i,<t})024 to πθ(oi,t∣q,oi,<t)\pi_\theta(o_{i,t} | q, o_{i,<t})1147.
  • In creative writing, embedding distances and 1-Self-BLEU diversify outputs by 160% and 75%, respectively.
  • On code and reasoning benchmarks (GSM8K, MATH, HumanEval, MMLU-Pro), GAPO maintains or slightly improves flexible scoring, e.g., on GSM8K flexible match: πθ(oi,t∣q,oi,<t)\pi_\theta(o_{i,t} | q, o_{i,<t})2, while the exact match may slightly decrease, πθ(oi,t∣q,oi,<t)\pi_\theta(o_{i,t} | q, o_{i,<t})3.
  • Across sampling temperatures, GAPO consistently yields higher creativity at a given accuracy, dominating baseline on the creativity–coherence spectrum.

A plausible implication is that the tradeoff between diversity and correctness can be tuned via the reward structure and temperature, with GAPO outperforming in diversity at equal or better accuracy (Anschel et al., 16 Nov 2025).

6. Generalization, Limitations, and Best Practices

GAPO demonstrates notable generalization: although trained solely on synthetic list-sampling, it confers diversity benefits on completely unseen, open-ended prompts across diverse domains. Ablations show that vanilla SFT over all valid completions may achieve in-distribution uniformity but fails to generalize, with Unique@500 plummeting to πθ(oi,t∣q,oi,<t)\pi_\theta(o_{i,t} | q, o_{i,<t})4.

Current limitations include the dependency of frequency-based rewards on an explicit finite valid answer set πθ(oi,t∣q,oi,<t)\pi_\theta(o_{i,t} | q, o_{i,<t})5. Extending GAPO to truly unbounded sets requires alternative group-level reward functions. Mode collapse mitigation may also introduce increased risk of unsafe generations, necessitating continued application of safety filters.

Implementation best practices, as recommended by the source, are:

  • Use sufficiently large group sizes (πθ(oi,t∣q,oi,<t)\pi_\theta(o_{i,t} | q, o_{i,<t})6) for accurate frequency estimation.
  • Omit KL penalty (πθ(oi,t∣q,oi,<t)\pi_\theta(o_{i,t} | q, o_{i,<t})7) for diversity-focused tuning; reintroduce if accuracy must be strictly maintained.
  • Normalize advantages using group mean and standard deviation for gradient stability.
  • Consider entropy regularization for further diversity, and systematically validate that increased diversity does not reduce downstream accuracy (Anschel et al., 16 Nov 2025).

7. Relationship to Prior Work and Extensions

GAPO builds upon and generalizes Group Relative Policy Optimization (GRPO) [see (Yu et al., 12 Sep 2025)], which uses group-relative advantages based on scalar per-sample rewards. In S-GRPO, for example, the reward is a weighted combination of binary compilation, security, and format tests, and the group-based structure supplies refined, prompt-localized learning signals for policy optimization (Yu et al., 12 Sep 2025).

Whereas S-GRPO (and other GRPO derivatives) aim to optimize multiple orthogonal constraints for tasks such as secure code synthesis, GAPO focuses on aggregate properties of the group, such as output diversity, by making reward assignment itself a group-level computation. This enables effective mitigation of mode collapse and provides a versatile template for interventions targeting properties emergent at the group level, including, but not limited to, diversity, coverage, and fairness (Anschel et al., 16 Nov 2025).

The framework is directly applicable to a variety of generative tasks requiring model output diversity, and generalizes to any reward that can be defined as a symmetric group-level function of output samples. Further extensions to settings with unbounded answer sets or to full-model RL fine-tuning remain areas for future investigation.

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to Group-Aware Policy Optimization (GAPO).