# Neurarch overview

Neurarch keeps a neural network as a **typed graph**: nodes are layers or blocks, edges carry tensor shapes. The diagram you see in the editor is a side effect of the structure, not the point. Because the model is structured data rather than free-form code, three things become cheap that are otherwise expensive:

1. **Verification.** 50 structural checks (6 guardrail gates + 37 advisor rules + 7 edit checks). The 43 single-graph ones run on every edit in under a millisecond: attention head divisibility, grouped-query head ratios, linear widths against upstream shapes, merge mismatches, cycles, parameter explosions, and more. See [structural checks](/docs/structural-checks.md).
2. **Agent editing.** An AI agent edits the graph through structured actions instead of rewriting code, and every proposed edit passes the same checks before it lands. See [the agent](/docs/agent.md).
3. **Code generation.** The graph exports real PyTorch (plus notebooks, deploy bundles, figures, and reports). You own the code; nothing is locked in. See [import and export](/docs/import-export.md).

## Who it is for

Any engineer who ships a production model without an ML research org behind them: describe the task, start from one of 48 templates or 195 layer types, let the agent assemble and refine the architecture, and export the code. Researchers use the same graph to read papers into an editable form and to check a paper against its implementation.

## The product path

Problem, Code, Handoff, Train, Deploy. You describe the task and data shape; the agent builds the architecture; you export or train (real GPU via Modal, free Colab/Kaggle round-trip, or simulation) and ship a FastAPI + Docker bundle. Training data connects at the Train step, never during design.

## The environment thesis

The same typed graph and sub-millisecond verifier that protect a human designer also make Neurarch a **verifiable environment for AI agents that design architectures**: every action has a programmatically checkable outcome, with no LLM judge. A public benchmark and leaderboard run on it. See [RL environment](/docs/rl-env.md).

## Measured claims

- 264-graph study against real PyTorch (two seeds, torch 2.8): all 96 verifier-blocked designs crashed at forward time; all 80 passed designs ran clean; 90% of clean designs made training progress. Details: [caught-bugs](https://neurarch.com/caught-bugs.html).
- Verifier cost: 0.27 ms per verified edit on a 47-layer graph, 0.05 ms on a 6-layer one, single laptop core. Pinned by a CI test.
- Code round-trip (graph to PyTorch to graph) preserves names, types, and edges at 100% across 8 canonical fixtures (BERT, GPT-2, ViT, LLaMA, ResNet-50, Whisper encoder, Mamba, MLP).

Counts (195 layer types, 75 blocks, 48 templates, 50 checks) are verified against code by tests on every build.
