megatron-engine-expert

megatron-engine-expert is an agent for Claude Code from areal-project/AReaL. It costs 35 tokens per session (2,640 once invoked), scanned C, original, Apache-2.0.

A usage and integration guide for MegatronEngine, a system for training large machine-learning models across multiple computers or processors within AReaL.

In plain words
What is it for?
Use it for MegatronEngine setup, pipeline-parallel training, checkpoint and weight synchronization, strategy tuning, and troubleshooting.
Why use it?
It helps developers choose parallel training strategies and connect MegatronEngine with training, checkpoint, rollout, and evaluation workflows.

Agent for Claude Code

About the project

AReaL is an infrastructure system for training large language models with reinforcement learning, connecting model training to applications built around AI agents. Researchers and developers use it to train reasoning and agentic models through asynchronous workflows, and the catalogue add-ons support working with AReaL.

areal-project/AReaL · 5,725 stars · on GitHub · areal-ai.io

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.

agentmods
npx agentmods add agents/areal-project/areal/megatron-engine-expert
Clone the repo
git clone --depth 1 https://github.com/areal-project/AReaL

Made for: Claude Code.

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 megatron-engine-expert

README.md
[![agentmods](https://agentmods.dev/badge/agents/areal-project/areal/megatron-engine-expert.svg)](https://agentmods.dev/agents/areal-project/areal/megatron-engine-expert)
Your own site
<a href="https://agentmods.dev/agents/areal-project/areal/megatron-engine-expert"><img src="https://agentmods.dev/badge/agents/areal-project/areal/megatron-engine-expert.svg" alt="Measured on agentmods" height="20"></a>
Per session 35 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,640 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. Scan, not verified.
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.00035 $0.02640
Opus 5 $0.00017 $0.01320
Sonnet 5 $0.00007 $0.00528
Haiku 4.5 $0.00003 $0.00264

Measured 6d ago against content hash 31c3b2974e7b, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade C, and why

megatron-engine-expert scanned grade C with 1 finding 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 6d 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.

Hidden instructionshighPrompt injection

Directives inside HTML comments, invisible characters or bidirectional overrides are read by the model and not by the person reviewing the file.

<!-- ================================================================================ MAINTAINER GUIDE ================================================================================ Location: .claude/agents/megatron-en
Origin

Copies of this mod

1 near-identical copy found in the catalogue:

.claude/agents/megatron-engine-expert.md · 314 lines

How it starts

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

MegatronEngine Usage Expert

You are an expert in MegatronEngine usage and integration in AReaL. Focus on configuration, workflows, and integration points rather than implementation details.

When to Activate

Use only for MegatronEngine usage and integration guidance:

  • MegatronEngine configuration and initialization
  • Pipeline parallel (PP) workflow integration
  • Checkpointing and weight synchronization
  • Parallel strategy selection and tuning
  • Integration with rollout and evaluation workflows
  • Performance optimization and troubleshooting

Do NOT use for general distributed training theory or low-level implementation details.

Core Concepts

MegatronEngine provides comprehensive distributed training capabilities through multiple parallelism dimensions. It coordinates TP (tensor), PP (pipeline), DP (data), CP (context), EP (expert), and ETP (expert tensor) parallelism strategies.

Key architectural principles:

  • Pipeline Parallelism (PP): Splits model layers across stages for ultra-deep models
  • Hybrid Parallelism: Combines multiple parallel dimensions for optimal resource utilization
  • Unified Coordination: Manages communication across all parallel groups

Primary Classes

  • MegatronEngine (areal/engine/megatron_engine.py): Main engine class implementing distributed training coordination
  • ParallelStrategy (areal/api/alloc_mode.py): Configuration dataclass for parallel dimensions
  • MegatronCheckpointManager (areal/engine/megatron_utils/checkpointer.py): Checkpoint handling for distributed state

Key Methods

Initialization: Initialize MegatronEngine with model, optimizer, parallel strategy, and additional configuration parameters as needed.

Training Operations:

  • forward() / backward(): Coordinated across all parallel dimensions
  • step(): Weight update with gradient synchronization
  • state_dict() / load_state_dict(): Distributed checkpoint handling

Configuration

1. Configuration Overview

Read the full file on GitHub · 314 lines

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. 6d ago First seen · 314 lines · 35 tokens per session scan C 31c3b2974e7b

Subscribe to this mod's changes

megatron-engine-expert is an agent published in the GitHub repository areal-project/AReaL (5,725 stars, last pushed yesterday), licensed Apache-2.0. It adds 35 tokens to every session and 2,640 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it C with 1 finding (hidden instructions). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other agents, from other repositories

llm_backends

AgentFly supports multiple LLM backends for text generation, each with their own configuration options. This module provides configuration classes for different backend types including vLLM, Verl, and OpenAI-compatible clients. Among them, Verl backend is designed for internal training usage. The Verl backend is the…

Agent-One-Lab/AgentFly · 0 tokens

sft

Supervised fine-tuning pipeline reference. For config templates and dataset format examples, see getting-started.qmd and dataset-formats/.

axolotl-ai-cloud/axolotl · 0 tokens

fenic-feature-developer

Use this agent when the user requests help implementing new features, operations, expressions, or functionality for the Fenic DataFrame library. This includes:\n\n- Adding new DataFrame operations (e.g., 'add a pivot operation to DataFrame')\n- Creating new logical expressions (e.g., 'implement a regexextract…

typedef-ai/fenic · 0 tokens

Data Scientist

Develops ML models, engineers features, works with Snowpark notebooks and Cortex ML functions, and conducts statistical analysis. Invoke with $ds.

Snowflake-Labs/cocoplus · 31 tokens

workflow-prompt-writer

Use this agent when writing, reviewing, or debugging LLM prompt files (.prompt). Specializes in Liquid.js template syntax, YAML frontmatter configuration, and Output SDK prompt conventions.

growthxai/output · 42 tokens

gke-cluster-runner

Launch a single TPU training workload on a GKE cluster via XPK, poll until completion or hang, capture xprof + HLO dumps to GCS, and report structured verdict signals back to the master agent. Stateless one-shot worker — does NOT write wiki pages, decide experiment verdicts, or update the model page. Use for every…

vlasenkoalexey/tpu_performance_autoresearch_wiki · 100 tokens