Skip to content

[training_utils] fix: Update metrics.py to change calculate_log_prob_diff to calculate_diff#6033

Open
victordion wants to merge 2 commits intoverl-project:mainfrom
victordion:patch-1
Open

[training_utils] fix: Update metrics.py to change calculate_log_prob_diff to calculate_diff#6033
victordion wants to merge 2 commits intoverl-project:mainfrom
victordion:patch-1

Conversation

@victordion
Copy link
Copy Markdown
Contributor

What does this PR do?

The function name calculate_log_prob_diff is misleading as the tensor it processes is not log probs but probs.

Checklist Before Starting

  • Search for similar PRs. Paste at least one query link here: ...
  • Format the PR title as [{modules}] {type}: {description} (This will be checked by the CI)
    • {modules} include fsdp, megatron, veomni, sglang, vllm, rollout, trainer, ci, training_utils, recipe, hardware, deployment, ray, worker, single_controller, misc, perf, model, algo, env, tool, ckpt, doc, data, cfg, reward, fully_async, one_step_off
    • If this PR involves multiple modules, separate them with , like [megatron, fsdp, doc]
    • {type} is in feat, fix, refactor, chore, test
    • If this PR breaks any API (CLI arguments, config, function signature, etc.), add [BREAKING] to the beginning of the title.
    • Example: [BREAKING][fsdp, megatron] feat: dynamic batching

Test

N/A

API and Usage Example

N/A

Design & Code Changes

N/A

@victordion victordion changed the title [training_utils] fix: Update metrics.py to change the log_prob_diff in function name [training_utils] fix: Update metrics.py to change calculate_log_prob_diff to calculate_diff Apr 16, 2026
@victordion victordion marked this pull request as draft April 16, 2026 18:20
@victordion victordion marked this pull request as ready for review April 16, 2026 18:21
Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request renames the calculate_log_prob_diff function to calculate_diff and updates its implementation and call site to operate on probabilities instead of log-probabilities. The review feedback recommends reverting these changes to use log-probabilities, as they provide more sensitive debugging metrics for LLMs, and suggests an optimized implementation to reduce memory overhead during the calculation.

Comment thread verl/utils/debug/metrics.py
Comment thread verl/utils/debug/metrics.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant