Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions fast_llm/layers/language_model/loss/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def loss_class(self) -> "type[LanguageModelZLoss]":
return LanguageModelZLoss


class GRPOMetricsLevel(enum.StrEnum):
class PolicyMetricsLevel(enum.StrEnum):
none = "none"
basic = "basic"
with_entropy = "with_entropy"
Expand All @@ -219,6 +219,16 @@ class LanguageModelPolicyGradientLossConfig(LanguageModelLossConfig):

epsilon_low: float = Field(default=0.2, desc="Lower clip parameter for ratio of log probs")
epsilon_high: float = Field(default=0.2, desc="Upper clip parameter for ratio of log probs")
metrics: PolicyMetricsLevel = Field(
default=PolicyMetricsLevel.none,
desc=(
"Additional diagnostic metrics to log. "
"`basic`: importance-ratio, KL and advantage statistics. "
"`with_entropy`: also log the policy entropy. "
"Not supported with pipeline_parallel > 1."
),
hint=FieldHint.feature,
)

@property
def loss_class(self) -> "type[LanguageModelPolicyGradientLoss]":
Expand All @@ -236,16 +246,6 @@ class LanguageModelGRPOLossConfig(LanguageModelPolicyGradientLossConfig):
desc="Enable triton implementation. Default: use if available.",
hint=FieldHint.expert,
)
metrics: GRPOMetricsLevel = Field(
default=GRPOMetricsLevel.none,
desc=(
"Additional GRPO metrics to log. "
"`basic`: per-token ratio, KL, and advantage statistics. "
"`with_entropy`: also log per-token entropy. "
"Not supported with pipeline_parallel > 1."
),
hint=FieldHint.feature,
)

@property
def loss_class(self) -> "type[LanguageModelGRPOLoss]":
Expand Down
Loading
Loading