adding-model-support

Guide adding Megatron-Bridge support for new HuggingFace LLM or VLM models.

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

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps you add reliable Megatron-Bridge support for a new HuggingFace LLM or VLM by guiding the end-to-end work from model discovery to bridge/provider implementation, recipes, tests, and validation.

Core Features & Use Cases

  • Model discovery & config analysis: Extracts critical HF config fields (model_type, architectures, dimensions, RoPE/MoE/MLA specifics) and determines whether the target is an LLM or VLM.
  • Bridge + provider implementation guidance: Describes the correct file/folder layout, registration strategy, provider settings, and where model-specific modules belong.
  • Weight conversion correctness for quantized checkpoints: Detects FP8/FP4/INT4 quantized safetensors and explains required dequantization approaches to prevent silently broken models.
  • Recipe, test, and doc deliverables: Provides a checklist for adding training recipes, unit/functional tests, and docs/examples so onboarding is verifiable and maintainable.

Quick Start

Ask an AI to “help me add Qwen4 support to Megatron-Bridge by analyzing the HF config and safetensors, identifying whether it is an LLM or VLM, planning the required bridge/provider/model code structure, and outlining the dequantization and test steps needed for a correct import-export roundtrip.”

Frequently Asked Questions about adding-model-support

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

FAQPage Schema
How do I add a new HuggingFace model to Megatron-Bridge?

To add a HuggingFace model to Megatron-Bridge, you extract HF config details, determine if it is an LLM or VLM, map components into bridge and provider layers, and add recipes with tests. This ensures correct checkpoint conversion and generation verification.

How do I handle FP8 or FP4 weight conversion for quantized safetensors?

For FP8 or FP4 weight conversion, you must detect quantized safetensors and apply the required dequantization approaches. This prevents silently broken models during the bridge and provider implementation by ensuring correct checkpoint import-export roundtrips.

What HuggingFace config fields are needed for LLM and VLM onboarding?

LLM and VLM onboarding requires extracting HF config fields including model_type, architectures, dimensions, and RoPE or MoE specifics. Analyzing these fields determines the architecture type and guides the correct model-specific module scoping and embedding tying for VLMs.

Does adding VLM support in Megatron-Bridge require special embedding tying?

Yes, adding VLM support requires special embedding tying conventions. The implementation must satisfy required conventions for config field locations and local model-specific module scoping to ensure successful checkpoint conversion and generation tests.

What tests are needed when onboarding a new model family in Megatron-Bridge?

Onboarding a new model family requires unit and functional testing alongside runnable examples. These tests verify successful checkpoint conversion and generation workflows, ensuring the bridge registration and provider configuration are maintainable and correct.