~/satyajit

Laguna's Model Factory: treating model development as an industrial process

mdjsonmcp

2026-07-03 · 13 min · llm · agents · mixture-of-experts · systems · explainer

Most model reports are about a model. Poolside's Laguna report is unusual: its real subject is the factory. Yes, it ships two Mixture-of-Experts models for agentic software engineering — Laguna M.1 (225.8B total, 23.4B active) and the open Laguna XS.2 (33.4B total, 3B active) — and they're solid, competitive-in-class coding models. But the argument the report actually makes is that the models are downstream of something more valuable: a Model Factory that treats foundation-model development as an industrial process rather than a craft. The evidence they offer is a number — they built XS.2 from inception to release in five weeks.

the Model Factory · development as a flywheel
one integrated loopeach turn versions the next1versioned data2training3evaluation4inference
1. versioned data

What: Every dataset is content-addressed and versioned, so any model's exact inputs are reproducible.

Why: Reproducibility is the substrate of an industrial process — you can't iterate reliably on training data you can't pin down.

auto-advancing · click any stage to hold it

The two models, briefly

The models are conventional-but-careful MoE. Both are pre-norm Transformers with RMSNorm and token-choice routing with a shared expert. The report spells out XS.2's config — 8 of 256 routed experts per token plus one shared expert, the routed output scaled by 2.5 before it rejoins the residual (a DeepSeek-V3 / Nemotron-style modulation), a sigmoid router normalized after top-k, and a dense first layer for stability — but gives M.1's totals without its routing width, so I won't guess it. Both use GQA (not MLA), the Muon optimizer, and a served context of 256K — XS.2's attention runs 8 KV heads with softplus per-head gating.

two weight classes · total vs activated parameters
050100150200billion params →Laguna M.1~200B class · flagship23.4B225.8B totalLaguna XS.2~30B class · open3B33.4B total
activated per token total (mostly dormant)
activated / token
23.4B (10%)
sparsity
9.6× total : active
class
~200B class · flagship

Laguna M.1 carries 225.8B parameters but activates only 23.4B per token — about 9.6× sparse, the whole point of a mixture of experts. Same recipe, scaled down: XS.2 is the Apache-2.0 open weights.

The one architectural wrinkle worth noting is XS.2's attention: where M.1 runs global attention on every layer, XS.2 interleaves sliding-window and global at a 3:1 ratio with a 512-token window — the same hybrid-attention idea as MiMo-V2-Flash, tuned for a smaller model that has to be cheap to serve. And the data is unambiguously code-first: XS.2's pretraining mix is ~30% raw code plus a large synthetic-code share, on top of >30T tokens (from a pool of ~27T unique). But by the report's own framing, none of this is the point. The point is how it was all made.

XS.2 is really M.1 with four ablated deltas flipped on: the hybrid attention above, a Warmup-Stable-Decay LR schedule instead of cosine, the routed-expert modulation, and one dense layer instead of three. Each was a config change against the M.1 baseline, chosen on a small MoE proxy — cheap precisely because the factory made the data pipeline, trainer, and eval harness transfer for free. The peak LR came from a fitted WSD scaling law, lrN0.46D0.27\text{lr}^\star \propto N^{-0.46}\,D^{-0.27} in active params and tokens, rather than a re-tuned sweep. The stability lessons transferred too: M.1's pre-training surfaced expert collapse around 450B tokens (fixed by Moonlight-style LR scaling, so Muon runs at AdamW-scale weight decay) and a logit-drift blowup traced to a BF16 all-reduce on the LM-head input gradient (fixed by forcing that one reduction to FP32). XS.2 hit none of them — the factory's job is to make the second model boring.

What "industrial process" actually means

The Model Factory is defined as "a tightly-integrated stack of versioned data, training, evaluation, and inference." Three principles hold it together:

The components have names, and the flywheel is literal: Titan trains, Blender streams the data mix, Hive generates synthetic data, Atlas serves inference and RL rollouts, and a containerized Code Execution platform spanning ~1M repositories provides synthetic tasks, evaluation, and RL execution rewards — one component doing all three. The RL harness they train against is the same harness they ship to customers. That's the loop the interactive above is gesturing at: data → train → eval → infer, where inference feeds the next round of data, and the whole thing is versioned tightly enough that a five-week model is possible.

Left-to-right pipeline of labeled stages: Common Crawl, parsing, language ID, deduplication, quality tagging, conservative filtering, score-and-rank, bucketing, sampling, and final web mix.
One arm of the factory made concrete: the versioned web-data pipeline runs raw Common Crawl through extraction, dedup, quality tagging, conservative filtering, composite scoring, and quota-aware sampling into the training mix — an assembly line with end-to-end lineage (paper, Figure 3).

That pipeline also flipped a habit. For M.1 they ran a high-precision filter that aggressively dropped noisy documents; for XS.2 they went high-recall instead — the composite score fully rejects only ~25.8% of web samples as pure noise and recovers ~34% of documents the old static rules had thrown away, then treats quality as a ranking signal and samples from score buckets rather than hard-filtering. Under a >30T-token budget, controlling repetition and diversity beats maximizing average quality; over-filtering starves the long tail.

Choosing the data mix by optimization, not taste

The web pipeline decides which documents survive. A separate problem is how much of each source to train on — the mixture weights. Done by hand, that's a few knobs set by taste and a handful of ablations. The report's quietest radical move, AutoMixer, turns it into an optimization loop, and it's the cleanest single instance of the factory thesis: a decision that used to be craft becomes a versioned, automated search.

The setup is a surrogate-model sweep. For each data ablation they train a swarm of ~60 proxy models — each a ~0.5B-parameter MoE on ~60B tokens — from different mixtures sampled over 50+ heterogeneous dataset groups (web, curated edu, academic, raw / grounded / synthetic code, math web, conversational and knowledge sets). Every proxy is one labeled example of "mixture in, capabilities out."

AutoMixer pipeline: a column of dataset groups on the left feeds a six-step loop — sample N mixtures over the simplex, train N proxy models, evaluate M capabilities, fit one regressor per capability, then optimize the mixture weights to maximize all capabilities jointly.
The AutoMixer loop: sample mixtures over the dataset-group simplex, train a proxy model on each, evaluate a small set of capabilities, fit a surrogate regressor per capability, then optimize the mixture. The diagram illustrates the loop with 15 example groups; the real sweep spans 50+ (paper, Figure 6).

Formally they learn a surrogate M:xy\mathcal{M}: x \to y where xΔdx \in \Delta^{d} is a mixture over dd dataset groups and yRky \in \mathbb{R}^{k} is a vector of downstream metrics across kk capability groups — coding, math reasoning, STEM knowledge, commonsense, general knowledge. Candidate mixtures are drawn near a hand-designed prior x0x_0 as xDirichlet(αx0)x \sim \text{Dirichlet}(\alpha x_0) subject to xx01<ϵ\lVert x - x_0 \rVert_1 < \epsilon, so the search stays in realistic regions. For each capability jj they fit a regressor fj(x)yjf_j(x) \approx y_j — linear in the simplified picture, y^j=βjx+bj\hat{y}_j = \beta_j^{\top} x + b_j, non-linear in practice. The mixture is then chosen by maximizing a weighted sum of the surrogates over the simplex:

maxx j=1kwjfj(x)s.t.ixi=1,  xi0,  xx01<ϵ\max_{x}\ \sum_{j=1}^{k} w_j\, f_j(x) \quad \text{s.t.}\quad \sum_i x_i = 1,\ \ x_i \ge 0,\ \ \lVert x - x_0 \rVert_1 < \epsilon

with a λDKL(xx0)\lambda\, D_{\mathrm{KL}}(x \Vert x_0) penalty keeping the answer from collapsing onto a few dominant sources. The knobs wjw_j are where intent enters: weight coding and math and the optimizer allocates data toward them.

AutoMixer · move the mixture, read the surrogate
data mixture x ∈ Δ8 · normalized to 100%
42.0
18.0
14.0
4.0
8.0
2.0
6.0
6.0
surrogate fj(x) · Δ vs prior (toy)
coding+0.0%
math reasoning+0.0%
STEM knowledge+0.0%
commonsense+0.0%
general knowledge+0.0%
objective Σ wj fj(x)+0.0% vs prior
weights favor coding + math (the paper's optimization targets); commonsense is down-weighted.

A toy linear surrogate — the coefficients are illustrative, picked so the directions track the paper. Load AutoMixer-optimized and coding and math rise while commonsense slips a little, exactly the trade the report measures (Table 3). The real AutoMixer fits non-linear surrogates over 50+ dataset groups from a swarm of ~60 proxy models, then optimizes the mixture under a KL leash to the prior.

The learned surrogate recovers relationships you'd expect — synthetic and curated code lift coding evals; conversational and knowledge corpora lift commonsense — plus finer cross-effects. On a 3B-param / 1.5T-token check, the optimized mix posts large gains on the targets (HumanEval+ +43%, CRUX-I +54%, GSM8K +41%, MultiPL-E +27%) and, encouragingly, generalizes to held-out benchmarks it wasn't optimized against (MATH +25%, LiveCodeBench +39%, BigCodeBench +16%). The cost is stated honestly and it's small: a few commonsense tasks regress (ARC-C −6.8%, the rest under 1.5%), which is exactly what you sign up for when the objective down-weights them. XS.2's final mixture — 30.6% raw code, 25.4% synthetic/code-text, 25.2% web, 9% math, the rest knowledge / instruction / academic / books (Table 4) — shifted toward web, synthetic, and math relative to M.1's while keeping the code-heavy spine. That's the thesis in one artifact: a data-mix decision made by an optimizer over a learned model, logged and re-runnable, instead of argued in a meeting.

Agentic training, from real commits

The coding ability comes from training on the actual job. Poolside turns real git commits from public repos into verifiable tasks — a problem statement, a repo checkout, and a hidden test patch, with the gold answer being the commit's own diff. A two-sided filter keeps only commits where the gold diff passes the tests and an empty patch fails them (discarding trivial or non-exercising tests), yielding 30–60k tasks from a ~236k-commit pool. Those tasks feed both SFT (as teacher-generated trajectories, sometimes wrapped in synthetic system messages for instruction-following pressure) and the RL pool (where the repo's own test suite is the verifier).

The RL stage is online: the policy itself drives the production agent harness across several thousand live containers at a time, and each rollout's reward comes from that container's verifier. The objective is CISPO — the importance-ratio-clipping surrogate from MiniMax-M1, not a Poolside invention — paired with a length-weighted leave-one-out group baseline; clipping is asymmetric, an effective [0,5][0, 5] on the ratio, so it only bites on heavily off-policy tokens. Reward is a deterministic chain of checks: a malformed tool call or template violation is 0.1-0.1, giving up before a minimum number of tool calls is 0.1-0.1, a timeout is 0.00.0, and the only positive reward is the binary task verifier (1.01.0) — unit tests for SWE tasks, bash assertions for terminal tasks, exact-match for tool-integrated math. A small 0.05-0.05 per-token penalty lands on exactly the tokens of a failing tool step to sharpen credit assignment; everything else is carried by the terminal 1/0. It's the same "make the process the trainable target" instinct as Agents-A1's verifier-graded trajectories, wired straight into the factory — the execution environment that grades RL is the one that generates data and runs evals.

The numbers, honestly

Here's where the modest framing matters. The report claims the models are "competitive with state-of-the-art open models in their respective weight classes," and that's accurate — competitive, not leading. M.1 lands mid-pack among the ~200B-class open models on SWE-bench Verified:

SWE-bench Verified — ~200B-class open models (%)
DeepSeek-V4-Flash
79%
Qwen3.5 (397B-A17B)
76.2%
Laguna M.1 (225B-A23B)
74.6%
GLM-4.7 (355B-A32B)
73.8%
Devstral 2 (123B)
72.2%
020406080
Grouped bar charts of Laguna M.1 versus Devstral 2, GLM-4.7, DeepSeek-V4-Flash, Qwen3.5 and Claude Sonnet 4.6 across four benchmarks: SWE-bench Verified, Multilingual, Pro, and Terminal-Bench 2.0.
The paper's own headline chart for M.1, across all four agentic benchmarks — not just SWE-bench Verified — versus ~200B-class open and frontier references (paper, Figure 1a).

XS.2 is the more interesting result, because it's competitive in the ~30B class while activating only 3B parameters per token — against dense 24–31B rivals:

SWE-bench Verified — ~30B-class open models (%)
Qwen3.6 (35B-A3B)
73.4%
Laguna XS.2 (33B-A3B)
69.9%
Qwen3.5 (35B-A3B)
69.2%
Devstral Small 2 (24B)
68%
Gemma 4 (31B)
52%
020406080
Grouped bar charts of Laguna XS.2 versus Devstral Small 2, Gemma 4, Qwen3.5, Qwen3.6, Claude Haiku 4.5 and GPT-5.4 Nano across SWE-bench Verified, Multilingual, Pro, and Terminal-Bench 2.0.
The same headline chart for XS.2 — competitive across all four benchmarks against ~30B-class open and frontier references while activating only 3B parameters per token (paper, Figure 1b).

XS.2 beats Devstral Small 2 and Gemma 4 and edges Qwen3.5, though Qwen3.6 leads the class. Two honesty notes the report itself makes: the baseline numbers are Poolside-selected published scores (not re-run in their harness, so there's provider-config bias), and they patched all four benchmarks to remove git-history leaks before scoring — so these differ slightly from public leaderboards by construction. It's the rare case where the methodology disclosure is more reassuring than the raw scores.

One finding from the quantization work is worth carrying away regardless of the leaderboard: bad quantization hurts agentic benchmarks far more than single-turn ones. A small per-token error that's invisible on a one-shot question compounds across a hundred-step trajectory, and the report saw exactly that — intermediate schemes that barely moved single-turn scores cratered the agentic ones. The fix started by looking at where the error comes from. Naive INT4 (AWQ, W4A16) lost quality because outlier activations pile up in the residual stream starting around layer 30 of the 40-layer network:

Line chart of residual-stream activation magnitude by layer: the median stays near zero across all 40 layers while the per-layer maximum stays small until about layer 30, then jumps to roughly 90 and stays high through the last layers.
Residual-stream activations by layer for XS.2: the median is flat near zero, but the maximum explodes after layer 30 — the outliers that make a flat low-bit scheme unsafe for the late layers (paper, Figure 7).

So they went mixed-precision: INT4 for the first 30 layers, INT8 for the last 10 (with a SpinQuant rotation as a pre-pass). NVFP4 needed more — direct post-training quantization lost too much, so they recovered it with quantization-aware distillation, training the quantized student to match a higher-precision teacher on a fixed dataset. The KV cache goes to FP8 across the full 131K context, roughly doubling how many trajectories a replica can hold. The through-line is the same as everything else here: the diverse eval harness is what caught the agentic-only regression that a single-turn benchmark would have waved through.

The take

I went in expecting an architecture paper and came out thinking about CI. The Laguna models are genuinely fine — a competent ~200B flagship and a genuinely efficient 3B-active open model that holds its own in a crowded class — but they're not what the report is selling. It's selling the claim that iteration speed is the frontier lever: if every run is reproducible code, every win ships by flipping a flag, and the same execution environment grades your RL, runs your evals, and generates your data, then you can turn out a from-scratch model in five weeks and keep pace with model complexity instead of drowning in it. Whether the "factory is the moat" thesis holds as everyone industrializes is the open question — but as a piece of honest infrastructure writing, with the models presented as outputs of a process rather than heroic artifacts, it's a refreshing shape for a technical report. XS.2's weights are open (Apache-2.0); the factory, of course, is not.


Built on the Laguna M.1/XS.2 Technical Report (Poolside, 2026) and the XS.2 model release (Apache-2.0). Benchmark figures are from the report's tables (baselines are Poolside-selected published scores on leak-patched benchmark images); SWE-bench Verified figures use the report/model-card values (74.6 / 69.9), higher than the earlier launch checkpoint.

Cite this article

For attribution, please use the following reference or BibTeX:

Satyajit Ghana, "Laguna's Model Factory: treating model development as an industrial process", ai.thesatyajit.com, July 2026.

bibtex
@misc{ghana2026lagunamodelfactory,
  author = {Satyajit Ghana},
  title  = {Laguna's Model Factory: treating model development as an industrial process},
  url    = {https://ai.thesatyajit.com/articles/laguna-model-factory},
  year   = {2026}
}
share