LFM2.5-230M-MONARCH / README.md
avp's picture
Release the verified MONARCH LFM2.5-230M WebGPU layout
317e0b3 verified
|
Raw History Blame Contribute Delete
3.97 kB
---
license: other
license_name: lfm1.0
license_link: https://huggingface.co/inductiveML/LFM2.5-230M-MONARCH/blob/main/LICENSE-LFM.txt
base_model: LiquidAI/LFM2.5-230M-ONNX
pipeline_tag: text-generation
inference: false
tags:
- webgpu
- wgsl
- int4
- monarch
- browser
---
# LFM2.5-230M — MONARCH WebGPU layout
Preconverted Liquid AI LFM2.5-230M weights for Inductive ML's **MONARCH MIX_M40** browser decoder. No training or fine-tuning was performed. This is a custom packed GPU buffer, not a Transformers checkpoint.
- [Run the browser demo](https://huggingface.co/spaces/inductiveML/monarch-webgpu)
- [Readable kernel and runtime source](https://huggingface.co/spaces/inductiveML/monarch-webgpu/tree/main/src/monarch)
- [Experiment, methodology, and recorded measurements](https://inductive.ml/experiments/monarch)
## Provenance and format
Upstream: [`LiquidAI/LFM2.5-230M-ONNX`](https://huggingface.co/LiquidAI/LFM2.5-230M-ONNX/tree/c6f46e4e3f885ebcad164d14059a49f90e27eb4d), revision `c6f46e4e3f885ebcad164d14059a49f90e27eb4d`.
The published buffer contains packed int4 weights with block size 32 and f32 scales, normalization and convolution tensors, exported rotary tables, and additional slice-major copies of the feed-forward down projections. The decoder also prepares selected layouts on the GPU. `monarch-config.json` lists all 199 buffer sections, their offsets, sizes, model shape, and selected kernel configuration.
The original 145,054,720-byte buffer is preserved as a prefix. Fourteen down-projection repacks add 22,937,600 bytes. Two extended rotary tables add 655,360 bytes. The resulting buffer is **168,647,680 bytes**. Nine transport chunks reconstruct it byte for byte; the chunking does not alter values. The rotary tables came from the ONNX export rather than being recomputed with a different math implementation.
Canonical SHA-256:
```text
ca1fea89fd9f3ca7e5d6d5720705c96f457a92edd0cfc811cf8d9391ac784cb0
```
## Download and reconstruct
The demo pins a repository commit and verifies each chunk and the complete buffer before inference. To reconstruct the same buffer locally, install `huggingface_hub` and use:
```python
import hashlib, json
from pathlib import Path
from huggingface_hub import snapshot_download
folder = Path(snapshot_download("inductiveML/LFM2.5-230M-MONARCH"))
manifest = json.loads((folder / "model-manifest.json").read_text())
chunks = []
for item in manifest["chunks"]:
data = (folder / item["path"]).read_bytes()
assert len(data) == item["bytes"]
assert hashlib.sha256(data).hexdigest() == item["sha256"]
chunks.append(data)
weights = b"".join(chunks)
assert len(weights) == manifest["weightBytes"]
assert hashlib.sha256(weights).hexdigest() == manifest["weightSha256"]
Path("weights.bin").write_bytes(weights)
```
For repeatable deployments, pass `revision=` with the commit pinned in the Space's `model-source.json`.
## Scope and measurements
The working decoder uses 72 ordinary dispatches per token. It supports greedy single-stream generation in the demo. No persistent cross-workgroup decoder is included. The demo checks a known 32-token continuation before enabling inference and requires WebGPU, shader-f16, fixed 32-lane subgroups, and 1,024-thread workgroups.
The 1,574.4 tok/s figure is a recorded M4 Max / fullscreen Chromium result at context 192, not a prediction for arbitrary hardware. The research kernel retained `NO_VERDICT_SPLIT`; later persistent-kernel pricing was not formally adjudicated. See the experiment page for complete conditions and limitations.
## License and modifications
Weights and tokenizer data retain Liquid AI's **LFM Open License v1.0**, including its commercial-use conditions. See `LICENSE-LFM.txt` and `NOTICE.txt`. All files under `weights/` are modified representations prepared by Inductive ML; their associated manifest documents the changes and checksums. The MONARCH runtime is separately released under Apache-2.0.