Skip to content

Commit 0d24392

Browse files
Merge pull request #17 from LatticeLabsAI/docs/centralize-site-metrics-and-commands
docs(site): single-source metrics + MLX command paths; standardize terminology
2 parents 2b2ebd3 + 497cdd1 commit 0d24392

15 files changed

Lines changed: 204 additions & 44 deletions

File tree

site/astro.config.mjs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,20 @@
22
import { defineConfig } from 'astro/config';
33
import starlight from '@astrojs/starlight';
44
import starlightLinksValidator from 'starlight-links-validator';
5+
import remarkMetrics from './src/plugins/remark-metrics.mjs';
56

67
// https://astro.build/config
78
// Deployed as a GitHub Pages project site: https://latticelabsai.github.io/ll_toolkit/
89
export default defineConfig({
910
site: 'https://latticelabsai.github.io',
1011
base: '/ll_toolkit/',
12+
// Inject canonical model metrics (src/data/metrics.mjs) and MLX command paths
13+
// (src/data/scripts.mjs) at build time via src/plugins/remark-metrics.mjs.
14+
// @astrojs/mdx extends this markdown config by default, so the plugin applies
15+
// to `.md` and `.mdx` alike.
16+
markdown: {
17+
remarkPlugins: [remarkMetrics],
18+
},
1119
integrations: [
1220
starlight({
1321
// Fails the build on any broken internal link (SPEC-2 FR-20).

site/src/content/docs/concepts/how-neural-cad-generation-works.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,8 +78,9 @@ This shows up concretely in [ll_gen](/ll_toolkit/ll_gen/overview/): a diffusion
7878
denoises **independent face grids** and sews them reaches **0** valid solids on the
7979
honest solid+volume gate — the sampled faces never mate. Re-targeting the same idea to
8080
diffuse a **construction-program** latent and decode it autoregressively (so the kernel
81-
*builds* the solid) reaches **0.934** sampled-z validity, and the autoregressive command
82-
model reaches **0.914** — both measured through the real kernel. These are the toolkit's
81+
*builds* the solid) reaches **{{metric.ll_gen.latentDiffusion.sampledZValidity}}** sampled-z
82+
validity, and the autoregressive command model reaches **{{metric.ll_gen.ar.validity}}**
83+
both measured through the real kernel. These are the toolkit's
8384
own numbers, not the literature figures above.
8485
:::
8586

site/src/content/docs/concepts/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Text2CAD, and others) and describe what the *field* has achieved. They are kept
1616
distinct from **the toolkit's own measured results**, which are now real and
1717
reproducible — e.g. [ll_brepnet](/ll_toolkit/ll_brepnet/overview/) segmentation at
1818
test mIoU 0.828, and [ll_gen](/ll_toolkit/ll_gen/overview/)'s program-based generators
19-
producing measured-valid CAD (0.914 / 0.934, gated on real non-degenerate solids). Where
19+
producing measured-valid CAD ({{metric.ll_gen.ar.validity}} / {{metric.ll_gen.latentDiffusion.sampledZValidity}}, gated on real non-degenerate solids). Where
2020
a page shows a LatticeLabs number it is labeled as such; field numbers frame what is
2121
realistic, package pages report what this codebase outputs.
2222

site/src/content/docs/concepts/the-reality-of-ai-cad-generation.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,9 @@ These are architecturally unrelated and routinely confused:
7777
The toolkit now ships **trained** generators — and they confirm the thesis above. The
7878
[ll_gen](/ll_toolkit/ll_gen/overview/) generators that produce valid CAD are the ones
7979
that generate the **construction program** and execute it: an autoregressive command
80-
model (**0.914** valid) and a latent diffusion over a program autoencoder (**0.934**
81-
valid), both measured through the real kernel and gated on a non-degenerate solid. The
80+
model (**{{metric.ll_gen.ar.validity}}** valid) and a latent diffusion over a program
81+
autoencoder (**{{metric.ll_gen.latentDiffusion.sampledZValidity}}** sampled-z valid), both
82+
measured through the real kernel and gated on a non-degenerate solid. The
8283
route that *doesn't* work is the one that generates raw B-rep faces to be sewn — its
8384
independently-sampled faces never mate, so honest validity is **0**. That is the
8485
"code → kernel → validate" lesson made concrete in this codebase: validity comes from

site/src/content/docs/get-started/quickstart.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ embedding = encoder(token_ids, topology_data=topology) # [1, 1024]
6969
Several models now ship **trained** with reproducible, honest metrics:
7070
**ll_brepnet** (B-Rep segmentation, test mIoU 0.828), **ll_stepnet** (face-count
7171
classifier, val acc 0.976), **ll_ocadr** (geometry-grounded, 0.919 vs 0.313 shuffled),
72-
and **ll_gen**'s program-based generators (valid CAD: AR 0.914 / latent diffusion 0.934).
72+
and **ll_gen**'s program-based generators (valid CAD: AR {{metric.ll_gen.ar.validity}} / latent diffusion {{metric.ll_gen.latentDiffusion.sampledZValidity}}).
7373
The neural models train and run natively in **MLX on Apple Silicon** as well as PyTorch.
7474
Remaining task heads (e.g. ll_stepnet property prediction/QA) ship as architectures —
7575
train them on your data before relying on their outputs.
@@ -81,11 +81,11 @@ Each neural package has an `mlx/` trainer that runs on Apple Silicon. The ones w
8181
existing PyTorch checkpoints convert the real weights and prove parity:
8282

8383
```bash
84-
python ll_stepnet/mlx/train_classification_mlx.py --mode parity # acc 0.976, argmax 1.0 vs PyTorch
85-
python ll_brepnet/mlx/train_brepnet_mlx.py --mode parity # mIoU parity vs PyTorch
86-
python ll_gen/mlx/ar_generator_mlx.py --mode train # valid CAD generation 0.914
87-
python ll_gen/mlx/latent_diffusion_mlx.py --mode train # latent-diffusion generation 0.934
88-
python ll_ocadr/mlx/train_ocadr_mlx.py --mode train # geometry-grounded multimodal
84+
python {{script.ll_stepnet.classification}} --mode parity # acc 0.976, argmax 1.0 vs PyTorch
85+
python {{script.ll_brepnet.train}} --mode parity # mIoU parity vs PyTorch
86+
python {{script.ll_gen.arGenerator}} --mode train # valid CAD generation {{metric.ll_gen.ar.validity}}
87+
python {{script.ll_gen.latentDiffusion}} --mode train # latent-diffusion generation {{metric.ll_gen.latentDiffusion.sampledZValidity}}
88+
python {{script.ll_ocadr.train}} --mode train # geometry-grounded multimodal
8989
```
9090

9191
## Where to go next

site/src/content/docs/index.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ what is planned.
5959
/>
6060
<LinkCard
6161
title="ll_gen"
62-
description="Generation orchestration: neural propose, deterministic dispose in a kernel sandbox. Trained program-based generators produce measured-valid CAD (AR 0.914 / latent diffusion 0.934)."
62+
description="Generation orchestration: neural propose, deterministic dispose in a kernel sandbox. DeepCAD-trained program-based generators produce measured-valid CAD (AR {{metric.ll_gen.ar.validity}} / latent diffusion {{metric.ll_gen.latentDiffusion.sampledZValidity}})."
6363
href={base + 'll_gen/overview/'}
6464
/>
6565
<LinkCard
@@ -87,8 +87,8 @@ what is planned.
8787
<a href={base + 'roadmap/ll_brepnet/'}>Roadmap</a>. <Badge text="Trained" variant="success" />
8888

8989
**ll_gen generation** now produces measured-valid CAD via the construction-program
90-
route (autoregressive command generator + latent diffusion), gated on real
91-
non-degenerate solids. <Badge text="Generates valid CAD" variant="success" />
90+
route (autoregressive command generator + latent diffusion), trained on the DeepCAD
91+
distribution and gated on real non-degenerate solids. <Badge text="Generates valid CAD" variant="success" />
9292

9393
Still experimental: **vLLM serving** for ll_ocadr (the HF-native path works today).
9494
<Badge text="Planned" variant="caution" />

site/src/content/docs/ll_brepnet/overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ running on Apple Silicon (the conversion handles Conv `OIHW→OHWI`/`OIW→OWI`
8989
inference-mode BatchNorm running stats):
9090

9191
```bash
92-
python ll_brepnet/mlx/train_brepnet_mlx.py --mode parity # convert real weights + verify
92+
python {{script.ll_brepnet.train}} --mode parity # convert real weights + verify
9393
```
9494

9595
:::note[Scope]

site/src/content/docs/ll_gen/overview.md

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: ll_gen — Overview
3-
description: Generation orchestration for CAD — neural propose, deterministic dispose in a sandbox. Ships trained generators that produce measured-valid CAD via the construction-program route.
3+
description: Generation orchestration for CAD — neural propose, deterministic dispose in a sandbox. Ships DeepCAD-trained generators that produce measured-valid CAD via the construction-program route.
44
sidebar:
55
label: Overview
66
order: 1
@@ -37,13 +37,15 @@ trained generators take this route and run natively in **MLX on Apple Silicon**:
3737

3838
- **Autoregressive command generator** (`ll_gen/mlx/ar_generator_mlx.py`) — a causal
3939
transformer over the CAD command vocabulary, trained on ~38k real DeepCAD programs,
40-
sampled token-by-token → executed. **Measured validity 0.914** (234/256), **104
41-
distinct** shapes.
40+
sampled token-by-token → executed. **Measured validity {{metric.ll_gen.ar.validity}}**
41+
({{metric.ll_gen.ar.validFraction}}), **{{metric.ll_gen.ar.distinct}} distinct** shapes.
4242
- **Latent diffusion** (`ll_gen/mlx/latent_diffusion_mlx.py`) — diffuses the latent of
43-
a program autoencoder and decodes autoregressively. **Sampled-z validity 0.934**
44-
(239/256), **138 distinct**. The validity comes from the execution-respecting
45-
decoder; the diffusion contributes the diverse latent prior (138 distinct vs a
46-
predict-the-mean baseline's 14).
43+
a program autoencoder and decodes autoregressively. **Sampled-z validity
44+
{{metric.ll_gen.latentDiffusion.sampledZValidity}}** ({{metric.ll_gen.latentDiffusion.validFraction}}),
45+
**{{metric.ll_gen.latentDiffusion.distinct}} distinct**. The validity comes from the
46+
execution-respecting decoder; the diffusion contributes the diverse latent prior
47+
({{metric.ll_gen.latentDiffusion.distinct}} distinct vs a predict-the-mean baseline's
48+
{{metric.ll_gen.latentDiffusion.baselineDistinct}}).
4749

4850
Two earlier routes are superseded because of their *representation*, not their
4951
training: the command-VAE's parallel (non-autoregressive) decoder is primitive-limited
@@ -64,10 +66,10 @@ is visible, not hidden. (`GenerationMetrics.is_valid_solid`.)
6466

6567
```bash
6668
# train + measure the autoregressive command generator (Apple Silicon / MLX)
67-
python ll_gen/mlx/ar_generator_mlx.py --mode train
69+
python {{script.ll_gen.arGenerator}} --mode train
6870

6971
# train the latent-diffusion generator and measure sampled-z validity
70-
python ll_gen/mlx/latent_diffusion_mlx.py --mode train
72+
python {{script.ll_gen.latentDiffusion}} --mode train
7173

7274
# the orchestration / RL training entry point
7375
python -m ll_gen.training.run --help
@@ -78,8 +80,9 @@ python -m ll_gen.training.run --help
7880
:::tip[Generators trained; validity measured through the real kernel]
7981
The orchestration, dispose sandbox, verification, and RL loop run end-to-end, and
8082
ll_gen now ships **trained generators that produce measured-valid CAD** on the DeepCAD
81-
distribution — the autoregressive command generator (0.914 valid) and the latent
82-
diffusion (0.934 valid), each gated on real non-degenerate solids. Native-MLX trainers
83+
distribution — the autoregressive command generator ({{metric.ll_gen.ar.validity}} valid)
84+
and the latent diffusion ({{metric.ll_gen.latentDiffusion.sampledZValidity}} valid), each
85+
gated on real non-degenerate solids. Native-MLX trainers
8386
run on Apple Silicon. Scope is stated honestly: these are trained on DeepCAD parametric
8487
command sequences (sketch + extrude), and validity is measured on that distribution.
8588
:::

site/src/content/docs/ll_gen/usage.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,15 @@ non-degenerate solid (closed solid with positive volume):
6969

7070
```bash
7171
# Autoregressive command generator — trained on real DeepCAD programs.
72-
# Result: validity 0.914 (234/256), 104 distinct, non-degenerate.
73-
python ll_gen/mlx/ar_generator_mlx.py --mode train
72+
# Result: validity {{metric.ll_gen.ar.validity}} ({{metric.ll_gen.ar.validFraction}}), {{metric.ll_gen.ar.distinct}} distinct, non-degenerate.
73+
python {{script.ll_gen.arGenerator}} --mode train
7474

7575
# Latent diffusion over a program autoencoder.
76-
# Result: sampled-z validity 0.934 (239/256), 138 distinct.
77-
python ll_gen/mlx/latent_diffusion_mlx.py --mode train
76+
# Result: sampled-z validity {{metric.ll_gen.latentDiffusion.sampledZValidity}} ({{metric.ll_gen.latentDiffusion.validFraction}}), {{metric.ll_gen.latentDiffusion.distinct}} distinct.
77+
python {{script.ll_gen.latentDiffusion}} --mode train
7878
```
7979

80-
For the latent diffusion the headline metric is **sampled-z** validity
80+
For the latent diffusion, the headline metric is **sampled-z** validity
8181
(noise → denoise → decode → execute), reported against a `z=0` predict-the-mean
8282
baseline so a diverse generator is distinguishable from one that repeats the mean shape.
8383
A faithful MLX port of the command-VAE (`python ll_gen/mlx/vae_mlx.py --mode parity`)
@@ -120,7 +120,7 @@ per-epoch curve.
120120

121121
:::note[Two generator generations — know which you're running]
122122
The **program-based** generators (`ar_generator_mlx.py`, `latent_diffusion_mlx.py`) are
123-
**trained** and produce measured-valid CAD (0.914 / 0.934 valid). The **legacy**
123+
**trained** and produce measured-valid CAD ({{metric.ll_gen.ar.validity}} / {{metric.ll_gen.latentDiffusion.sampledZValidity}} valid). The **legacy**
124124
neural generators reachable from the orchestrator (`vae`, `vqvae`, `diffusion` via the
125125
REINFORCE loop) are randomly initialized out of the box — their prior samples are mostly
126126
invalid until trained, and the raw-geometry diffusion is limited by representation

site/src/content/docs/ll_ocadr/overview.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,8 @@ control of 0.313** (majority 0.374) — i.e. the model genuinely *reads the geom
6868
verbalizes it, rather than guessing from the text prior.
6969

7070
```bash
71-
python ll_ocadr/mlx/faithful_tower_mlx.py --mode parity # prove the tower == real encoders
72-
python ll_ocadr/mlx/train_ocadr_mlx.py --mode train # train encoder + projector + LoRA
71+
python {{script.ll_ocadr.faithfulTower}} --mode parity # prove the tower == real encoders
72+
python {{script.ll_ocadr.train}} --mode train # train encoder + projector + LoRA
7373
```
7474

7575
## Status

0 commit comments

Comments
 (0)