parity-testing

Verifies numerical parity for Hugging Face to Megatron weight conversions via state-dict round-trips and forward-pass tests.

Updated May 23, 2026
One-click install
npx skills add https://github.com/yo-steven/skills-exploration-20260522 --skill parity-testing-yo-steven
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: parity-testing
Source: https://github.com/yo-steven/skills-exploration-20260522/tree/main/skills/Megatron-Bridge/parity-testing
Command: npx skills add https://github.com/yo-steven/skills-exploration-20260522 --skill parity-testing-yo-steven

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

It helps you quickly diagnose and verify numerical parity when converting models between Hugging Face (HF) and Megatron formats, especially when weights or outputs diverge.

Core Features & Use Cases

  • Tool selection for parity goals: Choose the right verification script for exact round-trip, multi-GPU sharding/aggregation, or output equivalence.
  • Three-level test strategy: Validate exact state-dict mapping, then verify forward-pass logit similarity, and optionally run a lightweight training parity check.
  • Debugging workflow for failures: Use an ordered triage path to localize whether the issue is mapping, TP/PP partitioning, or architectural/provider configuration.
  • Reusable comparison utilities: Use built-in tensor/state-dict comparison patterns to interpret diffs and missing/extra keys.

Quick Start

Run a single-GPU state-dict round-trip for a given HF model to confirm weights map back exactly.

Frequently Asked Questions about parity-testing

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I verify numerical parity for Hugging Face to Megatron weight conversions?

To verify numerical parity for Hugging Face to Megatron weight conversions, run the specified example conversion verification scripts to check exact round-trip state-dict matches and forward-pass logit equivalence within documented tolerances.

What is the best way to debug mismatches in HF to Megatron checkpoint round-trips?

Debugging HF to Megatron checkpoint mismatches involves an ordered triage path using built-in tensor comparison utilities to localize whether the failure stems from state-dict mapping errors, TP/PP/EP partitioning, or architectural configuration.

How does forward-pass logit equivalence testing work for converted weights?

Forward-pass logit equivalence testing runs GPU forward passes on converted checkpoints to validate output similarity, serving as the second validation level after confirming exact state-dict mapping matches.

Does parity testing support multi-GPU sharding configurations like TP, PP, and EP?

Yes, parity testing validates HF to Megatron checkpoint round-trips across TP, PP, and EP settings by verifying multi-GPU sharding and aggregation to ensure weights map correctly across different parallelism configurations.

Why do my Hugging Face to Megatron state-dict mappings have missing or extra keys?

Missing or extra keys in Hugging Face to Megatron state-dict mappings indicate mapping failures during conversion, which you can interpret and diagnose using the built-in reusable tensor and state-dict comparison patterns.

When should I run a lightweight training parity check instead of just forward-pass equivalence?

You should run a lightweight training parity check after validating exact state-dict mapping and forward-pass logit equivalence when you need to verify numerical stability and identical gradients during actual model training iterations.