MCPcopy Create free account
hub / github.com/InternLM/InternBootcamp / AlgoConfig

Class AlgoConfig

verl/verl/trainer/config/algorithm.py:568–614  ·  view source on GitHub ↗

Configuration for the algorithm. The inheritance from BaseConfig provides omegaconf.DictConfig-like interface for a dataclass config. Args: gamma (float): Discount factor for future rewards. lam (float): Trade-off between bias and variance in the GAE estimator. adv_

Source from the content-addressed store, hash-verified

566
567@dataclass
568class AlgoConfig(BaseConfig):
569 """Configuration for the algorithm.
570
571 The inheritance from BaseConfig provides omegaconf.DictConfig-like interface for a dataclass config.
572
573 Args:
574 gamma (float): Discount factor for future rewards.
575 lam (float): Trade-off between bias and variance in the GAE estimator.
576 adv_estimator (str): Advantage estimator type: "gae", "grpo", "reinforce_plus_plus", etc.
577 norm_adv_by_std_in_grpo (bool): Whether to normalize advantages by std (specific to GRPO).
578 use_kl_in_reward (bool): Whether to enable in-reward KL penalty.
579 kl_penalty (str): How to estimate KL divergence: "kl", "abs", "mse", "low_var_kl", or "full".
580 kl_ctrl (KLControlConfig): KL control configuration.
581 use_pf_ppo (bool): Whether to enable preference feedback PPO.
582 pf_ppo (dict[str, Any]): Preference feedback PPO settings.
583 filter_groups (Optional[FilterGroupsConfig]): Filter groups configuration, used in DAPO and Entropy
584 rollout_correction (Optional[RolloutCorrectionConfig]): Rollout Correction configuration.
585 Addresses off-policy issues from policy mismatch, model staleness, and general distribution shifts.
586
587 Set to None to disable entirely. Use factory methods for common presets:
588 - RolloutCorrectionConfig.decoupled_token_is() - Decoupled mode with token-level IS
589 - RolloutCorrectionConfig.decoupled_seq_is() - Decoupled mode with sequence-level IS
590 - RolloutCorrectionConfig.decoupled_seq_is_rs() - Decoupled mode with sequence IS + RS
591 - RolloutCorrectionConfig.decoupled_k1_rs() - Decoupled mode with K1-RS (divergence)
592 - RolloutCorrectionConfig.decoupled_geo_rs() - Decoupled mode with Geo-RS (ratio)
593 - RolloutCorrectionConfig.bypass_ppo_clip() - Bypass mode with PPO-clip
594 - RolloutCorrectionConfig.bypass_ppo_clip_k1_rs() - Bypass mode with PPO-clip + K1-RS
595 - RolloutCorrectionConfig.bypass_pg_is() - Bypass mode with REINFORCE + IS
596 - RolloutCorrectionConfig.bypass_pg_k1_rs() - Bypass mode with REINFORCE + K1-RS
597
598 For backward compatibility, you can still pass a dict, which will be converted to
599 RolloutCorrectionConfig automatically.
600 """
601
602 gamma: float = 1.0
603 lam: float = 1.0
604 adv_estimator: str = "gae"
605 norm_adv_by_std_in_grpo: bool = True
606 use_kl_in_reward: bool = False
607 kl_penalty: str = "kl"
608 kl_ctrl: KLControlConfig = field(default_factory=KLControlConfig)
609 use_pf_ppo: bool = False
610 pf_ppo: dict[str, Any] = field(default_factory=dict)
611 filter_groups: Optional[FilterGroupsConfig] = None
612 # Rollout Correction: corrects off-policy issues (policy mismatch, model staleness, distribution shifts)
613 # Set to None to disable, use RolloutCorrectionConfig presets (e.g., .tis(), .mis()), or pass dict
614 rollout_correction: Optional[RolloutCorrectionConfig] = None

Callers 3

setUpMethod · 0.90

Calls

no outgoing calls

Tested by 3

setUpMethod · 0.72