Add Step 3.7 Flash lazy-loading article assets
Browse files- README.md +24 -0
- assets/step37-architecture.png +3 -0
- assets/step37-lazy-loading-flow.png +3 -0
- assets/step37-memory-budget.png +3 -0
- assets/step37-proof-metrics.png +3 -0
- assets/step37-roadmap.png +3 -0
- build_step37_blog_assets.py +284 -0
- step37_lazy_loading_hf_article.md +255 -0
README.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Step 3.7 Flash Lazy Loading Article Assets
|
| 2 |
+
|
| 3 |
+
This dataset hosts static diagrams and the Markdown source for the Hugging Face article:
|
| 4 |
+
|
| 5 |
+
Smart Lazy Loading Step 3.7 Flash q8 on Apple Silicon
|
| 6 |
+
|
| 7 |
+
The diagrams explain the expert-granular lazy-loading runtime used in a local research proof on an M3 Max MacBook Pro with a 96 GiB model-memory ceiling and a 2 GiB context/KV ceiling.
|
| 8 |
+
|
| 9 |
+
Primary article source:
|
| 10 |
+
|
| 11 |
+
- `step37_lazy_loading_hf_article.md`
|
| 12 |
+
|
| 13 |
+
Figures:
|
| 14 |
+
|
| 15 |
+
- `assets/step37-architecture.png`
|
| 16 |
+
- `assets/step37-lazy-loading-flow.png`
|
| 17 |
+
- `assets/step37-memory-budget.png`
|
| 18 |
+
- `assets/step37-proof-metrics.png`
|
| 19 |
+
- `assets/step37-roadmap.png`
|
| 20 |
+
|
| 21 |
+
Related live MLX quant repos:
|
| 22 |
+
|
| 23 |
+
- https://huggingface.co/osmapi/Step-3.7-Flash-MXFP4-mlx
|
| 24 |
+
- https://huggingface.co/osmapi/Step-3.7-Flash-OptiQ-3.7bpw-mlx
|
assets/step37-architecture.png
ADDED
|
Git LFS Details
|
assets/step37-lazy-loading-flow.png
ADDED
|
Git LFS Details
|
assets/step37-memory-budget.png
ADDED
|
Git LFS Details
|
assets/step37-proof-metrics.png
ADDED
|
Git LFS Details
|
assets/step37-roadmap.png
ADDED
|
Git LFS Details
|
build_step37_blog_assets.py
ADDED
|
@@ -0,0 +1,284 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
#!/usr/bin/env python3
|
| 2 |
+
"""Build static diagrams for the Step 3.7 Flash lazy-loading article."""
|
| 3 |
+
|
| 4 |
+
from __future__ import annotations
|
| 5 |
+
|
| 6 |
+
import textwrap
|
| 7 |
+
from pathlib import Path
|
| 8 |
+
|
| 9 |
+
from PIL import Image, ImageDraw, ImageFont
|
| 10 |
+
|
| 11 |
+
|
| 12 |
+
ROOT = Path(__file__).resolve().parent
|
| 13 |
+
ASSETS = ROOT / "assets"
|
| 14 |
+
ASSETS.mkdir(parents=True, exist_ok=True)
|
| 15 |
+
|
| 16 |
+
FONT = "/System/Library/Fonts/Supplemental/Arial.ttf"
|
| 17 |
+
BOLD = "/System/Library/Fonts/Supplemental/Arial Bold.ttf"
|
| 18 |
+
MONO = "/System/Library/Fonts/SFNSMono.ttf"
|
| 19 |
+
|
| 20 |
+
|
| 21 |
+
def font(size: int, bold: bool = False, mono: bool = False) -> ImageFont.FreeTypeFont:
|
| 22 |
+
path = MONO if mono else (BOLD if bold else FONT)
|
| 23 |
+
return ImageFont.truetype(path, size=size)
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
def text(draw: ImageDraw.ImageDraw, xy: tuple[int, int], value: str, size: int = 28, fill="#13202c", bold: bool = False, mono: bool = False) -> None:
|
| 27 |
+
draw.text(xy, value, font=font(size, bold=bold, mono=mono), fill=fill)
|
| 28 |
+
|
| 29 |
+
|
| 30 |
+
def wrapped(draw: ImageDraw.ImageDraw, xy: tuple[int, int], value: str, width: int, size: int = 24, fill="#334155", bold: bool = False, line_gap: int = 8) -> int:
|
| 31 |
+
avg = max(size * 0.52, 1)
|
| 32 |
+
chars = max(int(width / avg), 8)
|
| 33 |
+
y = xy[1]
|
| 34 |
+
for line in textwrap.wrap(value, width=chars):
|
| 35 |
+
draw.text((xy[0], y), line, font=font(size, bold=bold), fill=fill)
|
| 36 |
+
y += size + line_gap
|
| 37 |
+
return y
|
| 38 |
+
|
| 39 |
+
|
| 40 |
+
def card(
|
| 41 |
+
draw: ImageDraw.ImageDraw,
|
| 42 |
+
box: tuple[int, int, int, int],
|
| 43 |
+
title: str,
|
| 44 |
+
body: list[str],
|
| 45 |
+
fill: str,
|
| 46 |
+
outline: str,
|
| 47 |
+
accent: str | None = None,
|
| 48 |
+
title_size: int = 30,
|
| 49 |
+
body_size: int = 22,
|
| 50 |
+
) -> None:
|
| 51 |
+
draw.rounded_rectangle(box, radius=26, fill=fill, outline=outline, width=3)
|
| 52 |
+
x1, y1, x2, _ = box
|
| 53 |
+
if accent:
|
| 54 |
+
draw.rounded_rectangle((x1, y1, x1 + 16, box[3]), radius=18, fill=accent)
|
| 55 |
+
text(draw, (x1 + 34, y1 + 26), title, size=title_size, bold=True, fill="#0f172a")
|
| 56 |
+
y = y1 + 68
|
| 57 |
+
for line in body:
|
| 58 |
+
y = wrapped(draw, (x1 + 34, y), line, width=x2 - x1 - 68, size=body_size, fill="#334155", line_gap=5)
|
| 59 |
+
y += 2
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
def arrow(draw: ImageDraw.ImageDraw, start: tuple[int, int], end: tuple[int, int], fill="#475569", width=5) -> None:
|
| 63 |
+
draw.line((start, end), fill=fill, width=width)
|
| 64 |
+
sx, sy = start
|
| 65 |
+
ex, ey = end
|
| 66 |
+
if abs(ex - sx) >= abs(ey - sy):
|
| 67 |
+
sign = 1 if ex > sx else -1
|
| 68 |
+
pts = [(ex, ey), (ex - sign * 18, ey - 10), (ex - sign * 18, ey + 10)]
|
| 69 |
+
else:
|
| 70 |
+
sign = 1 if ey > sy else -1
|
| 71 |
+
pts = [(ex, ey), (ex - 10, ey - sign * 18), (ex + 10, ey - sign * 18)]
|
| 72 |
+
draw.polygon(pts, fill=fill)
|
| 73 |
+
|
| 74 |
+
|
| 75 |
+
def canvas(title: str, subtitle: str) -> tuple[Image.Image, ImageDraw.ImageDraw]:
|
| 76 |
+
im = Image.new("RGB", (1800, 1100), "#f8fafc")
|
| 77 |
+
draw = ImageDraw.Draw(im)
|
| 78 |
+
draw.rectangle((0, 0, 1800, 140), fill="#0f172a")
|
| 79 |
+
text(draw, (64, 34), title, size=48, fill="#ffffff", bold=True)
|
| 80 |
+
text(draw, (66, 92), subtitle, size=24, fill="#cbd5e1")
|
| 81 |
+
return im, draw
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
def architecture() -> None:
|
| 85 |
+
im, draw = canvas(
|
| 86 |
+
"Step 3.7 Flash q8: model shape and residency target",
|
| 87 |
+
"The runtime treats routed experts as the pageable unit, not the whole model.",
|
| 88 |
+
)
|
| 89 |
+
card(draw, (70, 195, 470, 470), "Dense entry", [
|
| 90 |
+
"Tokenizer, embeddings, norms, attention blocks, and the first dense decoder layers remain resident.",
|
| 91 |
+
"Measured q8 text core estimate: 6.63 GiB.",
|
| 92 |
+
], "#e0f2fe", "#38bdf8", "#0284c7", body_size=21)
|
| 93 |
+
card(draw, (535, 195, 930, 470), "MoE stack", [
|
| 94 |
+
"45 decoder layers total. Layers 3-44 are routed MoE layers.",
|
| 95 |
+
"42 MoE layers x 288 routed experts = 12,096 expert slices.",
|
| 96 |
+
], "#ecfeff", "#22d3ee", "#0891b2", body_size=21)
|
| 97 |
+
card(draw, (995, 195, 1395, 470), "Router", [
|
| 98 |
+
"Each MoE layer scores 288 experts.",
|
| 99 |
+
"Top-8 experts are selected per token or micro-batch.",
|
| 100 |
+
], "#fef9c3", "#facc15", "#ca8a04", body_size=21)
|
| 101 |
+
card(draw, (1450, 195, 1730, 470), "Active compute", [
|
| 102 |
+
"Top-8 x 42 layers = 336 dynamic active slots.",
|
| 103 |
+
"Active is an event, not a permanent category.",
|
| 104 |
+
], "#dcfce7", "#4ade80", "#16a34a", title_size=27, body_size=20)
|
| 105 |
+
arrow(draw, (470, 332), (535, 332))
|
| 106 |
+
arrow(draw, (930, 332), (995, 332))
|
| 107 |
+
arrow(draw, (1395, 332), (1450, 332))
|
| 108 |
+
|
| 109 |
+
card(draw, (90, 570, 430, 900), "Active", [
|
| 110 |
+
"Router-selected top-k for the current token.",
|
| 111 |
+
"336 possible layer-token slots in a full pass.",
|
| 112 |
+
"Must be available immediately.",
|
| 113 |
+
], "#dcfce7", "#22c55e", "#16a34a", body_size=21)
|
| 114 |
+
card(draw, (500, 570, 840, 900), "Up Next", [
|
| 115 |
+
"672 bootstrap references.",
|
| 116 |
+
"Predicted near-future experts from routing priors and transitions.",
|
| 117 |
+
"Loaded only when free budget exists.",
|
| 118 |
+
], "#fef3c7", "#f59e0b", "#d97706", body_size=21)
|
| 119 |
+
card(draw, (910, 570, 1250, 900), "Backup / Standby", [
|
| 120 |
+
"514 protected experts.",
|
| 121 |
+
"8.59 GB q8 residency floor.",
|
| 122 |
+
"Never evicted in the clean indexed proof.",
|
| 123 |
+
], "#ede9fe", "#8b5cf6", "#7c3aed", body_size=21)
|
| 124 |
+
card(draw, (1320, 570, 1660, 900), "Inactive", [
|
| 125 |
+
"11,582 experts remain on disk.",
|
| 126 |
+
"193.55 GB of q8 slices not resident by default.",
|
| 127 |
+
"Rare router demand triggers exact slice load.",
|
| 128 |
+
], "#f1f5f9", "#94a3b8", "#64748b", body_size=21)
|
| 129 |
+
text(draw, (92, 970), "Measured target: 96 GiB model ceiling + 2 GiB context/KV ceiling on a 128 GiB M3 Max MacBook Pro.", size=30, bold=True)
|
| 130 |
+
im.save(ASSETS / "step37-architecture.png", quality=95)
|
| 131 |
+
|
| 132 |
+
|
| 133 |
+
def flow() -> None:
|
| 134 |
+
im, draw = canvas(
|
| 135 |
+
"Smart lazy-loading flow",
|
| 136 |
+
"An indexed safetensors map turns each routed expert into an addressable q8 page.",
|
| 137 |
+
)
|
| 138 |
+
boxes = [
|
| 139 |
+
((80, 215, 390, 410), "SWE-bench-Live prompt", "Random coding issue prefix; 64 tokens in the full proof."),
|
| 140 |
+
((470, 215, 780, 410), "Resident core", "Embeddings, attention, dense layers, norms, and router weights."),
|
| 141 |
+
((860, 215, 1170, 410), "Router top-k", "Choose top-8 experts per MoE layer."),
|
| 142 |
+
((1250, 215, 1640, 410), "MLX expert forward", "Load exact q8 expert pack; run gate/up/down projections."),
|
| 143 |
+
]
|
| 144 |
+
for box, title, body in boxes:
|
| 145 |
+
card(draw, box, title, [body], "#ffffff", "#cbd5e1", "#0ea5e9", title_size=29, body_size=22)
|
| 146 |
+
for a, b in [((390, 312), (470, 312)), ((780, 312), (860, 312)), ((1170, 312), (1250, 312))]:
|
| 147 |
+
arrow(draw, a, b)
|
| 148 |
+
|
| 149 |
+
card(draw, (180, 520, 610, 790), "Indexed q8 slice loader", [
|
| 150 |
+
"JSONL index stores layer, expert, shard, tensor names, byte offsets, and byte lengths.",
|
| 151 |
+
"No-cache reads reduce macOS file-backed memory pollution.",
|
| 152 |
+
], "#f8fafc", "#94a3b8", "#475569")
|
| 153 |
+
card(draw, (690, 520, 1120, 790), "Policy cache", [
|
| 154 |
+
"24 GiB hard expert-cache budget in the final indexed run.",
|
| 155 |
+
"514 Backup/Standby experts are protected; warm probation experts are evictable.",
|
| 156 |
+
], "#f8fafc", "#94a3b8", "#475569")
|
| 157 |
+
card(draw, (1200, 520, 1625, 790), "q8 KV/context cache", [
|
| 158 |
+
"Separate 2 GiB context ceiling.",
|
| 159 |
+
"Full proof used q8 affine KV: 7,050,240 bytes for the bounded sample.",
|
| 160 |
+
], "#f8fafc", "#94a3b8", "#475569")
|
| 161 |
+
arrow(draw, (1015, 410), (395, 520), fill="#64748b")
|
| 162 |
+
arrow(draw, (610, 655), (690, 655), fill="#64748b")
|
| 163 |
+
arrow(draw, (1120, 655), (1200, 655), fill="#64748b")
|
| 164 |
+
arrow(draw, (1415, 520), (1415, 410), fill="#64748b")
|
| 165 |
+
|
| 166 |
+
draw.rounded_rectangle((110, 870, 1690, 1030), radius=28, fill="#0f172a")
|
| 167 |
+
text(draw, (150, 905), "Core idea", size=34, fill="#ffffff", bold=True)
|
| 168 |
+
wrapped(draw, (150, 952), "Instead of loading a 199.74 GiB q8 tensor set, keep the core and protected floor resident, then fetch only the expert slices demanded by the router.", width=1500, size=24, fill="#dbeafe", line_gap=4)
|
| 169 |
+
im.save(ASSETS / "step37-lazy-loading-flow.png", quality=95)
|
| 170 |
+
|
| 171 |
+
|
| 172 |
+
def memory_budget() -> None:
|
| 173 |
+
im, draw = canvas(
|
| 174 |
+
"Memory budget from target to proof",
|
| 175 |
+
"The proof tracked model memory, context memory, process RSS, and macOS platform memory.",
|
| 176 |
+
)
|
| 177 |
+
left, top, width, height = 170, 300, 1320, 100
|
| 178 |
+
segments = [
|
| 179 |
+
("resident core", 6.63, "#38bdf8"),
|
| 180 |
+
("policy cache peak", 24.00, "#8b5cf6"),
|
| 181 |
+
("other model path", 8.00, "#22c55e"),
|
| 182 |
+
("remaining slack", 57.37, "#e2e8f0"),
|
| 183 |
+
]
|
| 184 |
+
x = left
|
| 185 |
+
for label, val, color in segments:
|
| 186 |
+
w = int(width * val / 96.0)
|
| 187 |
+
draw.rectangle((x, top, x + w, top + height), fill=color)
|
| 188 |
+
if w > 130:
|
| 189 |
+
text(draw, (x + 14, top + 32), f"{label}\\n{val:.2f} GiB", size=20, fill="#0f172a", bold=True)
|
| 190 |
+
x += w
|
| 191 |
+
draw.rectangle((left, top, left + width, top + height), outline="#0f172a", width=3)
|
| 192 |
+
text(draw, (left, top - 54), "96 GiB model ceiling", size=34, bold=True)
|
| 193 |
+
text(draw, (left + width + 24, top + 32), "Target", size=30, bold=True)
|
| 194 |
+
|
| 195 |
+
left2, top2, width2, height2 = 170, 550, 1320, 82
|
| 196 |
+
draw.rectangle((left2, top2, left2 + width2, top2 + height2), fill="#e2e8f0", outline="#0f172a", width=3)
|
| 197 |
+
used = int(width2 * 0.00657 / 2.0)
|
| 198 |
+
draw.rectangle((left2, top2, left2 + max(used, 7), top2 + height2), fill="#0ea5e9")
|
| 199 |
+
text(draw, (left2, top2 - 52), "2 GiB context/KV ceiling", size=34, bold=True)
|
| 200 |
+
text(draw, (left2 + 24, top2 + 24), "q8 affine KV in proof: 7.05 MB", size=24, bold=True)
|
| 201 |
+
|
| 202 |
+
metrics = [
|
| 203 |
+
("external top peak", "42.00 GiB"),
|
| 204 |
+
("vm_stat used peak", "43.52 GiB"),
|
| 205 |
+
("process RSS peak", "29.43 GiB"),
|
| 206 |
+
("estimated model peak", "38.63 GiB"),
|
| 207 |
+
]
|
| 208 |
+
x = 180
|
| 209 |
+
for title, value in metrics:
|
| 210 |
+
draw.rounded_rectangle((x, 760, x + 330, 930), radius=26, fill="#ffffff", outline="#cbd5e1", width=3)
|
| 211 |
+
text(draw, (x + 24, 795), value, size=38, bold=True, fill="#0f172a")
|
| 212 |
+
wrapped(draw, (x + 24, 850), title, width=280, size=24, fill="#475569")
|
| 213 |
+
x += 385
|
| 214 |
+
im.save(ASSETS / "step37-memory-budget.png", quality=95)
|
| 215 |
+
|
| 216 |
+
|
| 217 |
+
def results() -> None:
|
| 218 |
+
im, draw = canvas(
|
| 219 |
+
"Clean indexed proof metrics",
|
| 220 |
+
"Bounded q8 run: 64 prompt tokens, 8 decode steps, q8 KV, Step 3.7 Flash on MLX.",
|
| 221 |
+
)
|
| 222 |
+
cards = [
|
| 223 |
+
("Max platform used", "43.52 GiB", "vm_stat used; top reported 42.0 GiB"),
|
| 224 |
+
("Process RSS", "29.43 GiB", "Peak Python worker resident set"),
|
| 225 |
+
("TTFT", "41.96 s", "Setup plus prefill to first sampled token"),
|
| 226 |
+
("Prefill", "1.65 tok/s", "Prompt ingestion throughput"),
|
| 227 |
+
("Decode", "0.693 tok/s", "Closest number to chat-app tok/s"),
|
| 228 |
+
("q8 KV", "7.05 MB", "Context cache for this bounded proof"),
|
| 229 |
+
("Indexed loads", "6,916", "Exact q8 expert-slice loads"),
|
| 230 |
+
("Backup kept", "514/514", "No Backup/Standby misses or evictions"),
|
| 231 |
+
]
|
| 232 |
+
for i, (title, value, body) in enumerate(cards):
|
| 233 |
+
col = i % 4
|
| 234 |
+
row = i // 4
|
| 235 |
+
x = 95 + col * 425
|
| 236 |
+
y = 220 + row * 350
|
| 237 |
+
draw.rounded_rectangle((x, y, x + 360, y + 260), radius=30, fill="#ffffff", outline="#cbd5e1", width=3)
|
| 238 |
+
text(draw, (x + 28, y + 34), value, size=46, bold=True, fill="#0f172a")
|
| 239 |
+
text(draw, (x + 30, y + 100), title, size=28, bold=True, fill="#334155")
|
| 240 |
+
wrapped(draw, (x + 30, y + 145), body, width=300, size=22, fill="#64748b")
|
| 241 |
+
draw.rounded_rectangle((145, 930, 1655, 1010), radius=22, fill="#ecfeff", outline="#22d3ee", width=3)
|
| 242 |
+
text(draw, (180, 952), "Interpretation: memory proof succeeded; throughput is research-runtime slow because cold indexed expert loads still dominate decode.", size=26, bold=True, fill="#164e63")
|
| 243 |
+
im.save(ASSETS / "step37-proof-metrics.png", quality=95)
|
| 244 |
+
|
| 245 |
+
|
| 246 |
+
def roadmap() -> None:
|
| 247 |
+
im, draw = canvas(
|
| 248 |
+
"Failures became the roadmap",
|
| 249 |
+
"Each negative run turned into an engineering constraint for the final indexed proof.",
|
| 250 |
+
)
|
| 251 |
+
steps = [
|
| 252 |
+
("Dirty file cache", "macOS file-backed pages made earlier under-100 claims indefensible."),
|
| 253 |
+
("Clean baseline gate", "Require low used memory, low file-backed memory, and enough free+speculative memory before proof."),
|
| 254 |
+
("No-cache slice reads", "Avoid polluting platform memory with large safetensors file cache pages."),
|
| 255 |
+
("Indexed expert map", "Load exact q8 experts by byte offset instead of scanning tensor dictionaries."),
|
| 256 |
+
("Protected Backup floor", "Keep 514 Standby experts resident while evicting warm probation entries."),
|
| 257 |
+
("Next speed target", "Batch/fuse MoE loads and reduce cold-loads before chasing 10 tok/s."),
|
| 258 |
+
]
|
| 259 |
+
y = 210
|
| 260 |
+
for i, (title, body) in enumerate(steps):
|
| 261 |
+
x = 130 if i % 2 == 0 else 950
|
| 262 |
+
color = "#fee2e2" if i == 0 else "#ffffff"
|
| 263 |
+
outline = "#ef4444" if i == 0 else "#cbd5e1"
|
| 264 |
+
card(draw, (x, y, x + 650, y + 150), title, [body], color, outline, "#0ea5e9")
|
| 265 |
+
if i < len(steps) - 1:
|
| 266 |
+
if i % 2 == 0:
|
| 267 |
+
arrow(draw, (780, y + 75), (950, y + 75), fill="#64748b")
|
| 268 |
+
else:
|
| 269 |
+
arrow(draw, (950, y + 150), (780, y + 225), fill="#64748b")
|
| 270 |
+
y += 225
|
| 271 |
+
im.save(ASSETS / "step37-roadmap.png", quality=95)
|
| 272 |
+
|
| 273 |
+
|
| 274 |
+
def main() -> None:
|
| 275 |
+
architecture()
|
| 276 |
+
flow()
|
| 277 |
+
memory_budget()
|
| 278 |
+
results()
|
| 279 |
+
roadmap()
|
| 280 |
+
print(f"Wrote diagrams to {ASSETS}")
|
| 281 |
+
|
| 282 |
+
|
| 283 |
+
if __name__ == "__main__":
|
| 284 |
+
main()
|
step37_lazy_loading_hf_article.md
ADDED
|
@@ -0,0 +1,255 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Smart Lazy Loading Step 3.7 Flash q8 on Apple Silicon
|
| 2 |
+
|
| 3 |
+
Authors: Arjun Reddy, osmAPI Research Team, and Terv Team
|
| 4 |
+
|
| 5 |
+
Base model: [stepfun-ai/Step-3.7-Flash](https://huggingface.co/stepfun-ai/Step-3.7-Flash)
|
| 6 |
+
|
| 7 |
+
Live MLX quant artifacts:
|
| 8 |
+
|
| 9 |
+
- [osmapi/Step-3.7-Flash-MXFP4-mlx](https://huggingface.co/osmapi/Step-3.7-Flash-MXFP4-mlx)
|
| 10 |
+
- [osmapi/Step-3.7-Flash-OptiQ-3.7bpw-mlx](https://huggingface.co/osmapi/Step-3.7-Flash-OptiQ-3.7bpw-mlx)
|
| 11 |
+
|
| 12 |
+
This post documents a local research run on an M3 Max MacBook Pro with 128 GiB unified memory. The goal was deliberately narrow: execute the q8 MLX version of Step 3.7 Flash under a hard 96 GiB model-memory ceiling plus a 2 GiB context/KV ceiling by lazily loading routed experts instead of fully materializing the model.
|
| 13 |
+
|
| 14 |
+
## TLDR
|
| 15 |
+
|
| 16 |
+
- Step 3.7 Flash is a sparse MoE VLM from StepFun. The public architecture reports a 198B-class model, a Step-3.5-derived language backbone, 45 language layers, 42 routed MoE layers, 288 routed experts per MoE layer, and top-8 expert activation per token.
|
| 17 |
+
- Our local q8 MLX tensor set is 199.74 GiB. Loading it naively is outside the target budget.
|
| 18 |
+
- We indexed all 12,096 routed experts and categorized them into Active, Up Next, Backup/Standby, and Inactive.
|
| 19 |
+
- Active is dynamic: it means "the router selected this expert now." Backup/Standby is durable: 514 q8 experts stay protected in RAM. Inactive means the expert remains on disk unless the router actually asks for it.
|
| 20 |
+
- A clean indexed run completed with 64 prompt tokens and 8 decode steps using q8 KV. Peak external memory stayed far below 100 GiB: 42.0 GiB by `top`, 43.52 GiB by `vm_stat`, and 29.43 GiB process RSS.
|
| 21 |
+
- The measured model-path estimate was 38.63 GiB and the context/KV cache was 7.05 MB, both inside the 96 GiB + 2 GiB target.
|
| 22 |
+
- Throughput was not production-fast yet: TTFT 41.96 s, prefill 1.65 tok/s, decode 0.693 tok/s. The proof is about memory residency first. The speed work begins after this.
|
| 23 |
+
|
| 24 |
+
## Abstract
|
| 25 |
+
|
| 26 |
+
Large sparse MoE models create an interesting local-inference problem. Per token, they only need a small fraction of their parameters, but common inference stacks often assume that the full checkpoint, or at least very large portions of it, should be resident. Step 3.7 Flash makes that tension visible on Apple Silicon: the model is sparse enough to invite selective residency, but its q8 tensor set is still much larger than a 96 GiB target budget.
|
| 27 |
+
|
| 28 |
+
Inspired by Apple researchers' [LLM in a Flash](https://arxiv.org/abs/2312.11514), we explored whether the "flash as a memory extension" idea can be adapted to a modern routed MoE. Our unit of paging is not a whole layer and not a matrix row block. It is a routed expert slice: a small q8 tensor pack containing the gate, up, and down projections for one expert in one MoE layer.
|
| 29 |
+
|
| 30 |
+
We built an indexed expert map, a protected Backup/Standby floor, a policy cache, q8 compressed KV accounting, clean-baseline macOS memory gates, and an MLX smoke runner. The final clean indexed proof executed a bounded Step 3.7 Flash q8 language path under the target memory envelope while recording TTFT, prefill throughput, decode throughput, policy-cache residency, indexed load counts, and platform memory.
|
| 31 |
+
|
| 32 |
+
## Why This Is Hard
|
| 33 |
+
|
| 34 |
+
Step 3.7 Flash is exactly the kind of model that makes local inference exciting and slightly inconvenient.
|
| 35 |
+
|
| 36 |
+
The official model card positions it as a high-throughput sparse MoE model for agentic workflows, with a 256k context window, multimodal support, and roughly 11B active parameters per token. NVIDIA's public model notes describe the language module as 45 layers with 288 experts and 8 activated experts per token.
|
| 37 |
+
|
| 38 |
+
That architecture is friendly to selective compute. But a q8 local checkpoint is still large:
|
| 39 |
+
|
| 40 |
+
| Quantity | Value |
|
| 41 |
+
| --- | ---: |
|
| 42 |
+
| Decoder layers | 45 |
|
| 43 |
+
| MoE layers | 42, layers 3-44 |
|
| 44 |
+
| Routed experts per MoE layer | 288 |
|
| 45 |
+
| Routed experts total | 12,096 |
|
| 46 |
+
| Router top-k | 8 |
|
| 47 |
+
| Dynamic active slots per token pass | 336 |
|
| 48 |
+
| Resident text core estimate | 6.63 GiB |
|
| 49 |
+
| All routed experts q8 estimate | 188.26 GiB |
|
| 50 |
+
| Total indexed q8 tensor set | 199.74 GiB |
|
| 51 |
+
|
| 52 |
+
If the whole q8 model is treated as resident, the experiment is over before it begins. The useful question is narrower:
|
| 53 |
+
|
| 54 |
+
Can we keep only the core, the current active experts, and a small protected standby floor in RAM, while leaving most experts on disk until the router demands them?
|
| 55 |
+
|
| 56 |
+

|
| 57 |
+
|
| 58 |
+
## The Residency Categories
|
| 59 |
+
|
| 60 |
+
We ended up using four main categories.
|
| 61 |
+
|
| 62 |
+
| Category | Meaning | Residency behavior |
|
| 63 |
+
| --- | --- | --- |
|
| 64 |
+
| Active | The router selected this expert for the current token or micro-batch. | Must be available immediately. Dynamic, not permanent. |
|
| 65 |
+
| Up Next | Experts predicted from near-future layer priors and recent routing transitions. | Prefetch candidates when memory pressure allows. |
|
| 66 |
+
| Backup / Standby | A durable hot floor of experts with strong trace evidence. | Protected from eviction. In the final proof: 514 experts, 8.59 GiB. |
|
| 67 |
+
| Inactive | All other routed experts. | Stay on disk unless the router asks for them. |
|
| 68 |
+
|
| 69 |
+
The important correction is that "agentic coding layers" did not mean removing decoder layers. Every decoder layer still runs. What we carved out was an expert-residency policy from coding-agent prompts: which experts should be protected, which are worth prefetching, and which should remain cold.
|
| 70 |
+
|
| 71 |
+
For this, we used random coding-inference questions from [microsoft/SWE-bench-Live](https://github.com/microsoft/SWE-bench-Live). The prompts are useful because they resemble real agentic coding work: issue text, repository context, multi-file reasoning, and patch-planning behavior. They are not a full quality benchmark here. They are a routing probe.
|
| 72 |
+
|
| 73 |
+
## The Lazy-Loading Runtime
|
| 74 |
+
|
| 75 |
+
The runtime has three practical pieces.
|
| 76 |
+
|
| 77 |
+
First, a JSONL index maps every routed expert to exact safetensors byte ranges. Each row knows the layer, expert id, shard, tensor names, byte offsets, byte lengths, q8 format, and role labels. That lets the runtime materialize a single expert pack without scanning the full checkpoint.
|
| 78 |
+
|
| 79 |
+
Second, an MLX policy cache admits expert packs by category. Backup/Standby experts are protected. Warm probation experts can be evicted. Up Next experts are admitted only if the cache policy says the memory budget can afford them.
|
| 80 |
+
|
| 81 |
+
Third, context memory is tracked separately from model memory. The user-facing budget was 96 GiB for model residency and 2 GiB for context/KV. For this bounded proof, q8 affine KV used only 7,050,240 bytes. For long context, the estimator recommends more aggressive compression: q8 KV under 2 GiB at 65k, q4 KV around 128k, and q2-style emergency compression for 256k. A TQ3-like 256k estimate was about 2.45 GiB, so it did not meet the strict 2 GiB target by itself.
|
| 82 |
+
|
| 83 |
+

|
| 84 |
+
|
| 85 |
+
## Where "LLM in a Flash" Fits
|
| 86 |
+
|
| 87 |
+
Apple's LLM in a Flash paper studies inference when model parameters exceed available DRAM. The paper's core direction is to make flash storage part of the inference plan: predict what will be needed, load it efficiently, and avoid moving unnecessary weights.
|
| 88 |
+
|
| 89 |
+
Our experiment borrows that philosophy but changes the unit of movement.
|
| 90 |
+
|
| 91 |
+
In this Step 3.7 Flash q8 runtime, the natural unit is a routed expert. Every MoE layer has 288 candidates, but only top-8 are active for a token. Instead of asking "can we load the whole model?", the runtime asks:
|
| 92 |
+
|
| 93 |
+
1. Which expert did the router select right now?
|
| 94 |
+
2. Is it already Active or Backup/Standby?
|
| 95 |
+
3. If not, is it in Up Next or Inactive?
|
| 96 |
+
4. Can we load only that expert slice by byte offset?
|
| 97 |
+
5. Which warm probation slice can be evicted without touching the protected Backup floor?
|
| 98 |
+
|
| 99 |
+
That is the whole idea in small form: flash-aware selective residency, adapted to a routed MoE.
|
| 100 |
+
|
| 101 |
+
## Clean Proof Setup
|
| 102 |
+
|
| 103 |
+
The final proof used:
|
| 104 |
+
|
| 105 |
+
| Item | Value |
|
| 106 |
+
| --- | --- |
|
| 107 |
+
| Machine | MacBook Pro, M3 Max, 128 GiB unified memory |
|
| 108 |
+
| Runtime | Python 3.14.3, MLX 0.31.2 |
|
| 109 |
+
| Model path | local Step 3.7 Flash q8 MLX checkpoint |
|
| 110 |
+
| Prompt source | SWE-bench-Live prompt `thlorenz__doctoc-329` |
|
| 111 |
+
| Prompt tokens | 64 |
|
| 112 |
+
| Decode steps | 8 |
|
| 113 |
+
| KV codec | q8 affine KV |
|
| 114 |
+
| Model ceiling | 96 GiB |
|
| 115 |
+
| Context/KV ceiling | 2 GiB |
|
| 116 |
+
| Hard expert-cache budget | 24 GiB |
|
| 117 |
+
| Backup/Standby floor | 514 q8 experts |
|
| 118 |
+
|
| 119 |
+
The clean-baseline gate mattered. Earlier attempts were polluted by macOS file-backed cache from large safetensors reads, which made under-100 GiB claims ambiguous. The final proof required a clean baseline before launching:
|
| 120 |
+
|
| 121 |
+
- baseline clean: true
|
| 122 |
+
- baseline used memory: 14.48 GiB
|
| 123 |
+
- baseline file-backed memory: 25.49 GiB
|
| 124 |
+
- free plus speculative memory: 113.52 GiB
|
| 125 |
+
|
| 126 |
+

|
| 127 |
+
|
| 128 |
+
## Results
|
| 129 |
+
|
| 130 |
+
The full indexed-manifest run completed successfully.
|
| 131 |
+
|
| 132 |
+
| Metric | Value |
|
| 133 |
+
| --- | ---: |
|
| 134 |
+
| Exit status | 0 |
|
| 135 |
+
| Prompt tokens | 64 |
|
| 136 |
+
| Decode steps | 8 |
|
| 137 |
+
| Peak `top` memory used | 42.00 GiB |
|
| 138 |
+
| Peak `vm_stat` used | 43.52 GiB |
|
| 139 |
+
| Peak process RSS | 29.43 GiB |
|
| 140 |
+
| Estimated model peak | 38.63 GiB |
|
| 141 |
+
| q8 KV/context bytes | 7,050,240 bytes |
|
| 142 |
+
| Fits 96 GiB model ceiling | true |
|
| 143 |
+
| Fits 2 GiB context ceiling | true |
|
| 144 |
+
| Policy cache peak | 25,769,410,560 bytes, about 24.00 GiB |
|
| 145 |
+
| Loaded policy-cache slices | 1,542 |
|
| 146 |
+
| Indexed expert loads | 6,916 |
|
| 147 |
+
| Indexed expert load time | 41.49 s |
|
| 148 |
+
| Policy evictions | 5,374 |
|
| 149 |
+
| Backup/Standby loaded | 514 / 514 |
|
| 150 |
+
| Backup/Standby missing | 0 |
|
| 151 |
+
| Backup/Standby evicted | 0 |
|
| 152 |
+
| TTFT | 41.96 s |
|
| 153 |
+
| Prefill throughput | 1.65 tok/s |
|
| 154 |
+
| Decode throughput | 0.693 tok/s |
|
| 155 |
+
| End-to-end sampled throughput | 0.168 tok/s |
|
| 156 |
+
|
| 157 |
+

|
| 158 |
+
|
| 159 |
+
The headline is not "this is fast." It is:
|
| 160 |
+
|
| 161 |
+
We executed the q8 model path under 100 GiB live memory including context, without fully loading the 199.74 GiB q8 tensor set, and without evicting the 514-expert Backup/Standby floor.
|
| 162 |
+
|
| 163 |
+
That gives us a defensible base for the next phase: performance.
|
| 164 |
+
|
| 165 |
+
## What Failed First
|
| 166 |
+
|
| 167 |
+
The best part of this work is that the failures were informative.
|
| 168 |
+
|
| 169 |
+
The first under-100 GiB attempts could run bounded prompts, but macOS file-backed memory made the proof messy. A run could appear to fit by process RSS while the system had quietly filled much of unified memory with cached checkpoint pages. That is not a good academic claim.
|
| 170 |
+
|
| 171 |
+
Then a full protected-Backup run kept the idea alive but exceeded the live-memory line and evicted Backup entries. That became the reason to add:
|
| 172 |
+
|
| 173 |
+
- clean-baseline gating
|
| 174 |
+
- no-cache core and expert reads
|
| 175 |
+
- token-scoped Active protection
|
| 176 |
+
- exact indexed expert loading
|
| 177 |
+
- explicit Backup/Standby eviction accounting
|
| 178 |
+
|
| 179 |
+

|
| 180 |
+
|
| 181 |
+
The final indexed proof is the result of those negative runs rather than a straight line from idea to success.
|
| 182 |
+
|
| 183 |
+
## Why Decode Is Still Slow
|
| 184 |
+
|
| 185 |
+
The decode number was 0.693 tok/s. If you are used to LM Studio, llama.cpp, or hosted inference dashboards, that is the number closest to the familiar "tokens per second" readout.
|
| 186 |
+
|
| 187 |
+
The bottleneck is obvious in the trace: 6,916 indexed expert loads took 41.49 seconds. The runtime is memory-efficient, but it is still cold-load-heavy. This is the price of proving expert-granular paging before optimizing the hot path.
|
| 188 |
+
|
| 189 |
+
The path toward 10 tok/s on this Mac is not a single flag. It likely needs:
|
| 190 |
+
|
| 191 |
+
- fewer decode-time cold loads through a larger and better hotset
|
| 192 |
+
- batched expert-pack reads
|
| 193 |
+
- fused or grouped MoE expert execution in MLX
|
| 194 |
+
- stronger Up Next prediction without creating churn
|
| 195 |
+
- mixed precision for cold or low-impact experts
|
| 196 |
+
- a speculative or MTP path after the base runtime is stable
|
| 197 |
+
|
| 198 |
+
The current result is a fit proof. The next result should be a speed proof.
|
| 199 |
+
|
| 200 |
+
## Live Quant Artifacts
|
| 201 |
+
|
| 202 |
+
The lazy-loading proof in this post used a local q8 affine MLX checkpoint. Alongside that research path, we published live MLX quant artifacts for broader experimentation:
|
| 203 |
+
|
| 204 |
+
| Repo | Status | Notes |
|
| 205 |
+
| --- | --- | --- |
|
| 206 |
+
| [osmapi/Step-3.7-Flash-MXFP4-mlx](https://huggingface.co/osmapi/Step-3.7-Flash-MXFP4-mlx) | public | MXFP4 / microscaling FP4 MLX artifact for Apple Silicon experiments. |
|
| 207 |
+
| [osmapi/Step-3.7-Flash-OptiQ-3.7bpw-mlx](https://huggingface.co/osmapi/Step-3.7-Flash-OptiQ-3.7bpw-mlx) | public | Mixed-precision OptiQ 3.7 bpw MLX artifact. |
|
| 208 |
+
| Step 3.7 Flash q8 affine MLX | local research artifact | Used for the indexed q8 lazy-loading proof; public large-blob release was still being staged at the time of this post. |
|
| 209 |
+
|
| 210 |
+
The important distinction is that this article's under-100 GiB proof is for the q8 lazy-loading runtime, not a claim that the public MXFP4 or OptiQ repos already implement the same smart paging policy. Those repos are live quant artifacts. The lazy loader is the research runtime that will inform the next release path.
|
| 211 |
+
|
| 212 |
+
## What This Means
|
| 213 |
+
|
| 214 |
+
This experiment suggests that sparse MoE models should not be judged only by total parameter count when we talk about local inference. The routing structure is an opportunity. If the runtime can cheaply answer "which expert do I need now?" and "where exactly is that expert on disk?", then storage, memory, and compute can be coordinated more intelligently.
|
| 215 |
+
|
| 216 |
+
Step 3.7 Flash is a good stress case because it is big enough to force the issue, sparse enough to reward selectivity, and agentic enough that coding prompts produce meaningful routing traces.
|
| 217 |
+
|
| 218 |
+
The academic claim we can safely make today is modest but useful:
|
| 219 |
+
|
| 220 |
+
A q8 Step 3.7 Flash language-path inference can be executed on an M3 Max MacBook Pro under a 96 GiB model-memory ceiling and 2 GiB context ceiling by using expert-granular indexed lazy loading, protected Standby residency, and compressed KV accounting.
|
| 221 |
+
|
| 222 |
+
The engineering claim is sharper:
|
| 223 |
+
|
| 224 |
+
The runtime no longer needs to choose between "load all q8 experts" and "do not run the model." It can keep a small protected floor in RAM and fetch the rare experts it needs.
|
| 225 |
+
|
| 226 |
+
## Limitations
|
| 227 |
+
|
| 228 |
+
- This is a bounded smoke proof: 64 prompt tokens and 8 decode steps.
|
| 229 |
+
- Vision and MTP/speculative layers were excluded from this proof.
|
| 230 |
+
- The prompt set was used for routing and systems evidence, not for a full quality benchmark.
|
| 231 |
+
- Decode throughput is still low because cold expert loads dominate.
|
| 232 |
+
- The q8 checkpoint used for the proof was local; public q8 large-blob release work was still in progress.
|
| 233 |
+
- A production runtime still needs broader prompt coverage, long-context runs, quality comparisons, and deeper MLX kernel optimization.
|
| 234 |
+
|
| 235 |
+
## Acknowledgements
|
| 236 |
+
|
| 237 |
+
Thank you to the [osmAPI](https://huggingface.co/osmapi) team and the Terv team for the research loop, infrastructure patience, quant publication work, and the many small operational decisions that make this kind of local systems experiment possible.
|
| 238 |
+
|
| 239 |
+
Thank you to [StepFun](https://huggingface.co/stepfun-ai/Step-3.7-Flash) for releasing Step 3.7 Flash with open weights and enough ecosystem support to make local experiments plausible.
|
| 240 |
+
|
| 241 |
+
Thank you to Apple Machine Learning Research and the [MLX](https://github.com/ml-explore/mlx) team. This work leans directly on MLX's Apple Silicon-friendly execution model and is conceptually inspired by [LLM in a Flash](https://arxiv.org/abs/2312.11514).
|
| 242 |
+
|
| 243 |
+
Thank you to [Microsoft SWE-bench-Live](https://github.com/microsoft/SWE-bench-Live) for the live coding-agent prompt source used to probe routing behavior.
|
| 244 |
+
|
| 245 |
+
Related references and ecosystem links:
|
| 246 |
+
|
| 247 |
+
- StepFun official model: [stepfun-ai/Step-3.7-Flash](https://huggingface.co/stepfun-ai/Step-3.7-Flash)
|
| 248 |
+
- StepFun GitHub release repo: [stepfun-ai/Step-3.7-Flash](https://github.com/stepfun-ai/Step-3.7-Flash)
|
| 249 |
+
- StepFun launch post: [Step 3.7 Flash](https://static.stepfun.com/blog/step-3.7-flash/)
|
| 250 |
+
- Apple paper: [LLM in a Flash](https://arxiv.org/abs/2312.11514)
|
| 251 |
+
- Apple MLX: [ml-explore/mlx](https://github.com/ml-explore/mlx)
|
| 252 |
+
- Microsoft SWE-bench-Live: [microsoft/SWE-bench-Live](https://github.com/microsoft/SWE-bench-Live)
|
| 253 |
+
- NVIDIA public Step 3.7 notes: [NVIDIA NIM model card](https://build.nvidia.com/stepfun-ai/step-3.7-flash/modelcard)
|
| 254 |
+
|
| 255 |
+
Tags for sharing: Apple Silicon, MLX, LLM in a Flash, StepFun, Step 3.7 Flash, osmAPI, Terv, SWE-bench-Live, MoE, quantization, lazy loading, local inference.
|