model-integration

model-integration is a skill for Claude Code, Codex from redai-infra/Relax. It costs 76 tokens per session (3,102 once invoked), scanned A, original, Apache-2.0.

A guide for adding a new AI model to the Relax training system. It explains how model weights are converted, shared across GPUs, and synchronized with the system that runs the model.

In plain words
What is it for?
Use it when adding a model architecture, converting Megatron weights to Hugging Face format, implementing GPU weight gathering or splitting, or supporting colocated and fully asynchronous training.
Why use it?
It removes the need to work out the different integration steps for each training backend and execution mode. It also helps diagnose weight-conversion and synchronization problems.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when adding a model architecture, converting Megatron weights to Hugging…

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/redai-infra/relax/model-integration
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add redai-infra/Relax --skill model-integration
Clone the repo
git clone --depth 1 https://github.com/redai-infra/Relax

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for model-integration

README.md
[![agentmods](https://agentmods.dev/badge/skills/redai-infra/relax/model-integration.svg)](https://agentmods.dev/skills/redai-infra/relax/model-integration)
Your own site
<a href="https://agentmods.dev/skills/redai-infra/relax/model-integration"><img src="https://agentmods.dev/badge/skills/redai-infra/relax/model-integration.svg" alt="Measured on agentmods" height="20"></a>
Per session 76 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 3,102 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00076 $0.03102
Opus 5 $0.00038 $0.01551
Sonnet 5 $0.00015 $0.00620
Haiku 4.5 $0.00008 $0.00310

Measured 7d ago against content hash b5db74e984a7, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-06, from the pricing page.

Security

Grade A, and why

model-integration scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 7d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/model-integration/SKILL.md · 247 lines

How it starts

The opening of the file, as written. The whole thing — 247 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Model Integration Guide

Overview

Relax 支持两种训练后端和两种执行模式,新模型接入需根据组合适配不同的模块。

后端 x 模式矩阵

Colocate (共卡) Fully-Async (全异步)
Megatron Bridge 自动转换;Actor/Rollout 时分共享 GPU Bridge 或 raw 转换;独立 GPU 集群,DCS 权重同步
FSDP HF 原生权重名,DTensor 自动 redistribute 暂不支持

决策树

新模型接入
  ├─ Megatron 后端?
  │    ├─ Bridge 支持? → [快速路径] 仅需 Step 1-2
  │    └─ Bridge 不支持 → [完整路径] Step 1-5
  └─ FSDP 后端? → [FSDP 路径] Step 6

Megatron Backend

权重同步 Pipeline

训练完成后,权重需从 Megatron 内部格式同步到 Rollout 引擎(SGLang):

Training Step Complete
        │
        ├─── [bridge 模式] ─────────────────────┐
        │    AutoBridge.export_hf_weights()     │
        │    自动处理 Megatron→HF 转换          │
        │                                       ▼
        ├─── [raw 模式] ────────────────────────┐
        │    all_gather_param (common.py)       │  TP-sharded → full
        │            │                          │
        │            ▼                          │
        │    convert_to_hf (__init__.py)        │  Megatron name → HF name
        │            │                          │
        │            ▼                          │
        ├────────────┴──────────────────────────┘
        │
        ├─── [共卡] UpdateWeightFromTensor
        │    GPU→CPU serialize → Gloo gather → Ray IPC
        │
        └─── [全异步] UpdateWeightFromDistributed / DeviceDirectBackend
             NCCL broadcast / HTTP push
                     │
                     ▼
             chunk_param (checkpoint_engine/utils.py)
             full → TP-sharded (逆操作,仅全异步)

共卡 vs 全异步选择逻辑actor.py:176):

update_weight_cls = UpdateWeightFromTensor if self.args.colocate else UpdateWeightFromDistributed

Step 1: Model Provider (Bridge 模式 — 快速路径)

前提:模型已有 Megatron Bridge 支持。

Read the full file on GitHub · 247 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 7d ago First seen · 247 lines · 76 tokens per session scan A b5db74e984a7

Subscribe to this mod's changes

model-integration is a skill published in the GitHub repository redai-infra/Relax (580 stars, last pushed 9d ago), licensed Apache-2.0. It adds 76 tokens to every session and 3,102 once invoked, about $0.0004 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

verl-rl-training

Provides guidance for training LLMs with reinforcement learning using verl (Volcano Engine RL). Use when implementing RLHF, GRPO, PPO, or other RL algorithms for LLM post-training at scale with flexible infrastructure backends.

davila7/claude-code-templates · 51 tokens

openrlhf-training

High-performance RLHF framework with Ray+vLLM acceleration. Use for PPO, GRPO, RLOO, DPO training of large models (7B-70B+). Built on Ray, vLLM, ZeRO-3. 2× faster than DeepSpeedChat with distributed architecture and GPU resource sharing.

davila7/claude-code-templates · 72 tokens

verl-rl-training

Provides guidance for training LLMs with reinforcement learning using verl (Volcano Engine RL). Use when implementing RLHF, GRPO, PPO, or other RL algorithms for LLM post-training at scale with flexible infrastructure backends.

OpenLAIR/dr-claw · 51 tokens

openrlhf-training

High-performance RLHF framework with Ray+vLLM acceleration. Use for PPO, GRPO, RLOO, DPO training of large models (7B-70B+). Built on Ray, vLLM, ZeRO-3. 2× faster than DeepSpeedChat with distributed architecture and GPU resource sharing.

OpenLAIR/dr-claw · 72 tokens

verl-rl-training

Provides guidance for training LLMs with reinforcement learning using verl (Volcano Engine RL). Use when implementing RLHF, GRPO, PPO, or other RL algorithms for LLM post-training at scale with flexible infrastructure backends.

Orchestra-Research/AI-Research-SKILLs · 51 tokens

openrlhf-training

High-performance RLHF framework with Ray+vLLM acceleration. Use for PPO, GRPO, RLOO, DPO training of large models (7B-70B+). Built on Ray, vLLM, ZeRO-3. 2× faster than DeepSpeedChat with distributed architecture and GPU resource sharing.

Orchestra-Research/AI-Research-SKILLs · 72 tokens