Skip to content

Add Cascade-KTO ablation study - #3692

Open
danielkorzekwa wants to merge 11 commits into
mainfrom
dkorzekwa/kto_cascade_ablation
Open

danielkorzekwa wants to merge 11 commits into
mainfrom
dkorzekwa/kto_cascade_ablation

Conversation

@danielkorzekwa

@danielkorzekwa danielkorzekwa commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

Type of change: Documentation

Problem: The main KTO tutorial does not compare its KTO checkpoint with KTO trained on Cascade examples, or provide the corresponding evaluation configs and training-example references.

Fix: Add the Cascade-KTO study with paired accuracy, cap-hit rates, missing final answers, abstention and completion-token use. Include the 197 positive and 197 negative training-example references and one NeMo Gym config per benchmark, with shared settings and usage instructions.

kto/
├── README.md                         # link from the main tutorial
├── ABLATIONS.md                      # ablation index
└── ablations/
    ├── kto_cascade_ablation.md        # KTO versus Cascade-KTO
    ├── kto_cascade_training_examples.json
    └── nemo_gym/                     # benchmark YAMLs and setup instructions

Usage

Read the Cascade-KTO study and NeMo Gym setup instructions. The Gym instructions list the required saved inputs and endpoints.

Testing

  • Pre-commit passed for all 14 changed files on CW, including Markdown, YAML and JSON checks.
  • Checked links and whitespace; the manifest contains 197 positive and 197 negative example references.
  • All eight benchmark configs passed offline Gym composition checks.

Before your PR is "Ready for review"

Make sure you read and follow Contributor guidelines and your commits are signed (git commit -s -S).

Make sure you read and follow the Security Best Practices (e.g. avoiding hardcoded trust_remote_code=True, torch.load(..., weights_only=False), pickle, etc.).

  • Is this change backward compatible?: ✅
  • If you copied code from any other sources or added a new PIP dependency, did you follow guidance in CONTRIBUTING.md: N/A
  • Did you write any new necessary tests?: N/A
  • Did you update Changelog?: ✅
  • Did you get Claude approval on this PR?: ❌

Additional Information

The comparison uses different training-data sizes and update counts, so it does not isolate the effect of the data source.

Summary by CodeRabbit

  • Documentation
    • Added an ablation report comparing KTO and Cascade-KTO, with evaluation methodology, benchmark results, and follow-up questions.
    • Added evaluation setup guidance and benchmark configurations for reproducing the comparison across multiple benchmarks.
    • Added a manifest describing the Cascade-KTO training examples and study settings.
    • Updated the tutorial contents to link to the ablation materials.

Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
@copy-pr-bot

copy-pr-bot Bot commented Dec 3, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@coderabbitai

coderabbitai Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Adds a Cascade-KTO ablation report, its training-example manifest, NeMo Gym evaluation documentation and benchmark configurations, and links from the Qwen3.6 KTO tutorial. The materials describe training data, evaluation settings, comparative results, and an unresolved AA-LCR score discrepancy.

Changes: Cascade-KTO ablation study

Layer / File(s) Summary
Training data and comparison
examples/megatron_bridge/tutorials/Qwen3.6-35B-A3B/kto/ablations/kto_cascade_ablation.md, .../kto_cascade_training_examples.json
The report describes example selection and compares training data and updates. The manifest records study metadata and positive and negative examples with source locations, lengths, and seeds.
NeMo Gym evaluation setup
examples/megatron_bridge/tutorials/Qwen3.6-35B-A3B/kto/ablations/nemo_gym/*
Adds shared policy settings, benchmark-specific configurations, and instructions for evaluation setup, inputs, environment variables, and commands.
Results and tutorial links
examples/megatron_bridge/tutorials/Qwen3.6-35B-A3B/kto/ablations/kto_cascade_ablation.md, examples/megatron_bridge/tutorials/Qwen3.6-35B-A3B/kto/ABLATIONS.md, examples/megatron_bridge/tutorials/Qwen3.6-35B-A3B/kto/README.md
The report presents accuracy, non-inferiority, reliability, abstention, and completion-token results. It notes an unresolved AA-LCR score discrepancy. The tutorial pages link to the ablation report.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Other

Merge Risk: Minimal · up to f2b5f

This PR adds documentation and configuration for the Cascade-KTO ablation study and does not change any production training or evaluation code. No actionable merge-blocking risk was found.

Architecture risk: Low · up to f2b5f

The tutorial now provides a linked set of Cascade-KTO study artifacts that makes the selected training examples, evaluation conditions, and reported comparisons inspectable.

Changed areas: examples

Review details

Systems and components

  • observed — 14 changed files mapped to examples.
Pre-merge checks: Passed 5

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title "Add Cascade-KTO ablation study" matches the main change. The PR adds an ablation report comparing KTO and Cascade-KTO checkpoints, plus a training-example manifest, NeMo Gym configs, and th…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Security Anti-Patterns Passed The "Security anti-patterns" check applies to modelopt package and examples Python changes, plus new PIP dependencies in pyproject.toml or requirements files. PR #3692 (NVIDIA/Model-Optimizer, head dk…
Full details: Title check

Explanation

The title "Add Cascade-KTO ablation study" matches the main change. The PR adds an ablation report comparing KTO and Cascade-KTO checkpoints, plus a training-example manifest, NeMo Gym configs, and the README updates that link them. The title is concise, specific, and free of file lists or vague wording.

Full details: Security Anti-Patterns

Explanation

The "Security anti-patterns" check applies to modelopt package and examples Python changes, plus new PIP dependencies in pyproject.toml or requirements files. PR #3692 (NVIDIA/Model-Optimizer, head dkorzekwa/kto_cascade_ablation, author danielkorzekwa) changes only documentation and config files under examples/megatron_bridge/tutorials/Qwen3.6-35B-A3B/kto/: 2 Markdown edits (ABLATIONS.md, README.md), 2 added Markdown files, one added JSON manifest, and 8 added NeMo Gym YAML configs plus a README. The diff contains no .py files, no pyproject.toml or requirements changes, and no new dependencies. A search of the full changed-file diff found no weights_only, allow_pickle, trust_remote_code, eval(, exec(, or nosec tokens. Because no in-scope Python or dependency change exists, none of the six failure conditions can apply, so the check is inapplicable and passes.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 4a9180b and f2b5f3b.

Files selected for processing: 14

  • examples/megatron_bridge/tutorials/Qwen3.6-35B-A3B/kto/ABLATIONS.md
  • examples/megatron_bridge/tutorials/Qwen3.6-35B-A3B/kto/README.md
  • examples/megatron_bridge/tutorials/Qwen3.6-35B-A3B/kto/ablations/kto_cascade_ablation.md
  • examples/megatron_bridge/tutorials/Qwen3.6-35B-A3B/kto/ablations/kto_cascade_training_examples.json
  • examples/megatron_bridge/tutorials/Qwen3.6-35B-A3B/kto/ablations/nemo_gym/README.md
  • examples/megatron_bridge/tutorials/Qwen3.6-35B-A3B/kto/ablations/nemo_gym/aa_lcr.yaml
  • examples/megatron_bridge/tutorials/Qwen3.6-35B-A3B/kto/ablations/nemo_gym/aa_omniscience.yaml
  • examples/megatron_bridge/tutorials/Qwen3.6-35B-A3B/kto/ablations/nemo_gym/common.yaml
  • examples/megatron_bridge/tutorials/Qwen3.6-35B-A3B/kto/ablations/nemo_gym/gpqa_diamond.yaml
  • examples/megatron_bridge/tutorials/Qwen3.6-35B-A3B/kto/ablations/nemo_gym/ifbench.yaml
  • examples/megatron_bridge/tutorials/Qwen3.6-35B-A3B/kto/ablations/nemo_gym/mmlu_pro.yaml
  • examples/megatron_bridge/tutorials/Qwen3.6-35B-A3B/kto/ablations/nemo_gym/mmmu_pro.yaml
  • examples/megatron_bridge/tutorials/Qwen3.6-35B-A3B/kto/ablations/nemo_gym/scicode.yaml
  • examples/megatron_bridge/tutorials/Qwen3.6-35B-A3B/kto/ablations/nemo_gym/tau2_telecom.yaml

Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 10 remain after this review.

@codecov

codecov Bot commented Dec 3, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 80.16%. Comparing base (f69ba34) to head (f2b5f3b).
⚠️ Report is 44 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3692      +/-   ##
==========================================
- Coverage   82.57%   80.16%   -2.41%     
==========================================
  Files         731      737       +6     
  Lines       83388    94951   +11563     
==========================================
+ Hits        68857    76121    +7264     
- Misses      14531    18830    +4299     
Flag Coverage Δ
examples-megatron_bridge 26.57% <ø> (-0.20%) ⬇️
unit 65.18% <ø> (+0.54%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@meenchen meenchen left a comment •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bot review (gpt-6.2-sol) — DM the bot to share feedback.

Changes requested: the ablation does not document whether both checkpoints used matched evaluation settings, which is necessary to interpret the headline cap-hit reductions.

Needs action:

  • Document the evaluation settings and pairing for both checkpoints in kto_cascade_ablation.md, especially the MMLU-Pro temperature, presence penalty, and output cap.
  • Identify the Cascade training subset, explain how both label types were selected, and state whether training examples were checked for overlap with evaluation items.
  • Label which runner produced each Telecom result and state that the custom-runner accuracy comparison did not establish 2 pp non-inferiority.

No action needed:

  • Checked relative links and anchors in source. Reviewed against the supplied main diff and guidance; the exact base SHA, pre-commit results, and benchmark runs were not independently verified.

@kevalmorabia97 kevalmorabia97 left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

The ablation is useful, but its "KTO" column doesn't reproduce the main tutorial's numbers for the same checkpoint, and that undercuts the MMLU-Pro headline.

Needs action:

  • Explain why the re-evaluated KTO checkpoint differs from the main tutorial's QAKTO column: MMLU-Pro has 37 cap hits here vs 7, AA-LCR is 63.50% vs 68.50%, and SciCode is 1 vs 0 cap hits. Then link both checkpoints' eval configs. See the inline comment.
  • Reconsider the MMLU-Pro headline. Against the main tutorial's 7/24,064, 2/24,064 is likely not significant. See the inline comment.
  • Pick one layout for kto/ABLATIONS.md together with #3682. That PR puts the loop-escape ablation directly in ABLATIONS.md, while this one makes it an index over ablations/*.md. Whichever merges second conflicts and leaves the two inconsistent.
  • Name the Cascade dataset and subset, and say whether it overlaps IFBench / MMLU-Pro. In-domain instruction data would explain the IFBench gain. I agree with meenchen's thread on line 12.
  • Fill in the PR template checklist.

No action needed:

  • I recomputed the cap-hit rates and the unweighted averages (accuracy 65.80% / 65.94%, cap hits 1.00% / 0.16%) from the counts, and they match.

Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>

@Separius Separius left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

construction of the dataset was missing before and now it is included, LGTM.

Signed-off-by: Daniel Korzekwa <dkorzekwa@nvidia.com>
@danielkorzekwa
danielkorzekwa marked this pull request as ready for review December 4, 2026 21:08
@danielkorzekwa
danielkorzekwa requested a review from a team as a code owner December 4, 2026 21:08

@meenchen meenchen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bot review (gpt-6.2-sol) — DM the bot to share feedback.

Changes requested: the new Gym configs document the decoding settings, but the study still does not explain how it paired observations for its significance tests.

Needs action:

  • 💬 The Gym configs now show the sampling settings. In kto_cascade_ablation.md, state how questions and repeats were matched across checkpoints and what unit the statistical tests used.
  • 💬 The data-preparation section now identifies the subset and both label sources. State whether Cascade training examples were checked for overlap with evaluation items, especially IFBench and MMLU-Pro.
  • 💬 The custom Telecom rows now link to the runner description. Label the native Gym accuracy and token rows, and state that the custom runner did not establish 2 pp accuracy non-inferiority.

No action needed:

  • ✔️ The headline now names MMMU-Pro, the AA-LCR discrepancy is documented, and the PR checklist is filled in.


## Experiments and results

We use the same results analysis as the [main KTO tutorial](../README.md#experiments-and-results). Both checkpoints were evaluated again using the [NeMo Gym configs](nemo_gym/). We used NeMo Gym because the NeMo Evaluator Launcher (NEL) evaluation protocol used for the main tutorial had been deprecated and was no longer available to us. All differences are Cascade-KTO − KTO.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bot comment.

The shared YAML and benchmark overrides now document the requested settings, including MMLU-Pro at temperature 0.6, presence penalty 0, and a 131,072-token output cap. They don't show how the saved observations were joined for the paired tests. Please state the actual pairing key (e.g., item ID plus seed or repeat index) and whether the tests and intervals treated questions/tasks or individual rollouts as the statistical unit. That distinction matters for the headline p-values because each question has multiple rollouts.


Of 202 candidate positives, one exceeded the 32,768-token limit for the prompt and response, leaving 201. We selected 197 to match the 197 negatives. The final set contains 176 QAD-baseline answers and 21 Cascade reference answers. Reference answers were used for prompts where the saved QAD response hit the output-token limit.

The [training data manifest](kto_cascade_training_examples.json) lists source records and seeds for the 197 positive responses and 197 looping prefixes.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bot comment.

The pinned manifest and the new selection description establish the training provenance, but neither says whether these prompts were checked against the evaluation items. Since the training subset includes instruction-following examples and IFBench is a headline result, please report the scope and outcome of any overlap check, or explicitly say overlap was not checked and remains unknown.


### Check for regressions

At p < 0.05 per comparison, all eight benchmarks in the accuracy table pass the 2.0 pp non-inferiority check; five pass at 1.0 pp.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Bot comment.

The custom-runner cap-hit and non-inferiority rows are labeled now, but the Telecom accuracy and token rows still don't name their runner. Please label those as native Gym and explicitly state that the custom run's p=0.335 did not establish 2 pp accuracy non-inferiority. The linked tutorial explains NEL's retry behavior, but it doesn't map the runners to this study's tables.

This branch has not been deployed

No deployments
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.

4 participants