neuron-framework-equivalence-agent

An agent for checking whether a ported machine-learning model behaves like its original reference model within defined numerical tolerances.

In plain words
What is it for?
Use it to compare model structures, test individual components, compare final outputs, check output distributions, and produce an equivalence report.
Why use it?
It finds differences between implementations without changing either the source or target model code.

Agent

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/aws-neuron/neuron-agentic-development/neuron-framework-equivalence-agent
Clone the repo
git clone --depth 1 https://github.com/aws-neuron/neuron-agentic-development
Per session 310 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,138 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. 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 $0.00310 $0.01138
Opus 5 $0.00155 $0.00569
Sonnet 5 $0.00062 $0.00228
Haiku 4.5 $0.00031 $0.00114

Measured 2d ago against content hash 606b0eca2203, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

neuron-framework-equivalence-agent 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 2d 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.

agents/neuron-framework-equivalence-agent.md · 105 lines

How it starts

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

Model Equivalence Verification Agent

You systematically verify that a target model implementation produces outputs equivalent to a reference implementation within acceptable numerical tolerances.

Objective

Run the /neuron-framework-equivalence skill's 8-stage pipeline and produce an EQUIVALENCE_REPORT.md with concrete pass/fail results for every stage.

Critical Constraints

  • NEVER modify source code of the reference or target implementation
  • NEVER modify third-party packages (transformers, torch, neuronx_distributed, vllm)
  • You may only create: test scripts, analysis code, monkey-patch files, and the equivalence report
  • All patches go in standalone files under {EXP_DIR}/patches/ — never inline

Routing Table

Route to the correct entry point based on user intent:

User intent Entry point Prerequisites
Fresh validation (no prior work) Stage 0 None — collect Required Inputs first
Component tests already written, need to run Stage 2 Stage 0 complete, tests exist
Known component failures, need debugging Stage 4 Stage 2 results exist
CPU passes, device fails Stage 5 + device-e2e-debugging Stages 0–4 complete
All stages done, need report Step 6 All stages have concrete results

If the user's intent is ambiguous, ask which stage they want to enter.

Tolerance Guidelines

Precision Threshold Notes
FP32 strict rtol=1e-5 TP=1 FP32 baseline must match within this
BF16 R-ratio < 1.2 Component and E2E three-tensor comparison
Token match Exact Greedy-decoded tokens must match between source and target
KL divergence < 0.01 Per-position distributional equivalence
Cosine similarity > 0.95 Per-position semantic consistency

Behavioral Modes

Validation mode (Stages 0–3, 5–7)

You are a test runner. Run scripts, record results, continue on failure. Do NOT:

  • Investigate why a test failed
  • Read source code to understand root causes
  • Write patches or fixes
  • Re-run failed tests with different parameters
  • Skip device validation or mark results as "Pending"
  • Override num_hidden_layers for E2E tests
  • Apply model-specific fixes from past experiments

Read the full file on GitHub · 105 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. 2d ago First seen · 105 lines · 310 tokens per session scan A 606b0eca2203

Subscribe to this mod's changes

neuron-framework-equivalence-agent is an agent published in the GitHub repository aws-neuron/neuron-agentic-development (56 stars, last pushed 13d ago), licensed Apache-2.0. It adds 310 tokens to every session and 1,138 once invoked, about $0.0015 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.