ModelBest and OpenBMB open-source ForgeStencil: a dual-agent system that drops Stencil optimizations into real scientific computing software

On August 4, 2026, ModelBest (面壁智能) and the OpenBMB open-source community released ForgeStencil under Apache-2.0 (GitHub: OpenBMB/ForgeStencil). ForgeStencil is an AI system that closes the loop from automatic research to automatic deployment of Stencil optimizations on real scientific and industrial software — and it does so with no human in the loop.

Why Stencil optimization matters

Stencil computation — weighted combinations over a fixed neighborhood on structured grids — sits at the heart of CFD (hypre), electromagnetics (FDTD / gprMax), nuclear reactor neutron transport (minisweep), seismic imaging, oil & gas exploration, climate modeling, and medical imaging. Stencil kernels routinely eat 50%+ of these programs' runtime and are pinned by memory bandwidth — so getting them near the hardware roofline is, in practice, the single biggest performance lever for these workloads.

What's different from previous "auto-codegen" tools

Two decades of work (Halide, Devito, EBISU, DRStencil, ConvStencil, AN5D) can already generate competitive CUDA kernel code and tune parameters. But there's a hard limit baked into all of them: the optimization strategy is still designed by humans, and the integration into the real upstream application is also done by a human engineer. Change the scenario, the shape, or the GPU, and the manual work starts over.

ForgeStencil's key design choice is to automate both strategy discovery and application integration, using two cooperating agents (see the official README):

  • A Kernel Agent that runs the Plan → Code → Profile loop, autonomously discovers new optimization strategies (tiling, fusion, layout, occupancy, host-side restructuring), and deposits the results in kernel/ as an operator library.
  • An App Agent that locates hotspots in a real application, forges an app-specific operator on top of that library, verifies correctness via the program's own self-check, and ships the integration patch.

This architecture is why both Chinese (36Kr) and English (AIbase) press outlets describe it as the first AI system that fully automates Stencil optimization without a human in the middle.

Measured numbers: 100 real applications, 2.05× geometric mean end-to-end

All numbers below are taken directly from the ForgeStencil README and its audited result registry. Every figure is reportedly re-runnable from a clean clone.

End-to-end, across 100 validated applications (vs each app's own production GPU code):

Metric Value
Median end-to-end speedup 1.41×
Geometric mean 2.05×
Range 0.998× – 97.7×
≥ 1.05× 89%
≥ 1.20× 73%
≥ 1.50× 43%
≥ 3× 21%
≥ 10× 7%

Operator-level (same-precision vs the strongest published baseline among Halide / Devito / EBISU): geometric mean ≈ 2.16× across 32 cases (32/32 wins). On star_1, the fp16-vs-fp16 head-to-head (same precision) still gives 1.75×.

Real-software scenarios (from the AIbase summary cross-checked against the README):

  • hypre structured multigrid solver: 3.86×
  • gprMax / FDTD electromagnetics: 2.47×
  • minisweep reactor neutron transport: up to 5.78×
  • RTM seismic reverse-time migration: 1.81×
  • Total minimod seismic mini-app: 1.22×
  • QuantLib bond pricing: 1.82×
  • Non-Cartesian MRI reconstruction: 2.45×
  • Digital breast tomosynthesis back-projection: 1.63×

Per the project, ~42% of the optimizations land directly on real industrial loads in oil & gas, medical equipment, and weather departments.

Cross-GPU portability: A100 → H100 → B200

The kernel library carries runtime architecture dispatch for sm_80 / sm_90 / sm_100, and the README includes a full cross-generation study:

  • A100 → H100: hardware bandwidth +1.68×, but the kernels "arrive still bandwidth-saturated" on H100 (DRAM 77–90% utilization) — close to optimal transfer. The vs-Halide geometric mean actually rises from 2.16× (A100) to 2.38× (H100).
  • H100 → B200: bandwidth grows another 2.4×, but memory-issue rate is no longer the bottleneck, so the kernels fall off the roofline (DRAM 78–90% drops to 44–65%). A targeted re-forge recovers some of the loss: structural deep-prefetch on box_1 adds +7.0% at 512³ and +5.1% at 1024³.

Most "kernel optimization" projects die the moment the GPU generation changes; the README openly documents which patches matter and why.

How the numbers survive scrutiny

Three things I would have suspected the project of faking, all addressed in the README:

  1. Baseline is real production code, not a toy reference. Measurement runs the original and optimized paths in the same binary, switched by a single env flag, with the original path byte-identical to upstream.
  2. Correctness is the application's own check (bit-exact or its own tolerance in most cases). Timing uses the application's own timer, interleaved over multiple rounds with median taken.
  3. No third-party source is bundled. Each integrated app ships only provenance + a fetch script + a patch, keeping the license clean (Apache-2.0).

So the headline "N× speedup on app X" is reproducible on an idle, clock-locked A100 with each app's standard test suite.

My take: the right shape for an "AI4Science" product

I've had two recurring frustrations with the AI4Science space:

  • Paper speedups tend to halve by the time they reach production, because very few teams will grind through "does it actually pass the build, does the numerical result stay correct" work.
  • Even when that work happens, the stack requires an LLM inference setup + a GPU kernel expert + a domain scientist, so it doesn't scale horizontally.

ForgeStencil knocks down the second complaint: Kernel Agent and App Agent share one operator knowledge base, so once a tactic works on app A it transfers to app B. Any HPC user with a target application can get an end-to-end patch.

A few caveats worth keeping in mind:

  • The 97.7× cases come mostly from structural headroom in the upstream (too many tiny kernel launches, low occupancy, per-step synchronization) — not from a universally faster kernel. The README itself stresses this.
  • Against already-well-tuned code, the README reports sw4lite 1.00×, hpgmg_fv 1.02×, and cloverleaf 1.01× — so the floor is often just parity.
  • The pipeline is GPU-bound: a few apps are CPU-only and are labeled "research," not validated.

So what

For HPC, industrial-simulation, nuclear, oil & gas, or medical-imaging teams: git clone https://github.com/OpenBMB/ForgeStencil and run the Quick Start against your usual apps. The cost is one afternoon per app; the upside is whether you can claim a 2× + production speedup you can defend at a perf-review meeting.

For LLM Agent practitioners: the take-away is that the harness treats benchmarks and correctness checks as first-class citizens. Faking a "we optimized this kernel" demo is easy; faking an integration patch that the upstream's own test suite agrees with is a system-level error. That bar is what makes Agent-for-X useful in production, not flashy demos.


References: