LFM3-Omni-2B โ Core ML / Apple Neural Engine
LiquidAI/LFM3-Omni-2B converted to Core ML and running on the Apple Neural Engine. This repository holds the converted programs only; the runtime, the conversion code and the measurements live in vladimir-voinea/lfm3-omni-ane.
This is a quantized conversion of the base model (LUT8 palettization of the text programs), not a merge and not a fine-tune. No weights were retrained.
Contents
| file | what |
|---|---|
layer{N}_conv.mlpackage |
13 short-convolution layers, history passed as I/O tensors |
layer{N}_full.mlpackage |
6 full-attention layers, 28,672-row MLState cache |
layer{N}_slide.mlpackage |
5 sliding-attention layers, 256-row cache |
final_norm.mlpackage |
the final norm |
lm_head.mlpackage |
the 128,000-way head (whole) |
lm_head_a/b.mlpackage |
the same head split into 2 x 64,000 rows, which is what runs on the engine |
vision.mlpackage |
vision tower and projector, 224 x 224 |
audio_encoder.mlpackage |
audio encoder and projector, up to 30 s |
depth_decoder.mlpackage, codec.mlpackage |
speech output, up to 10.2 s through the codec program |
speech_tables.npz |
tables the host needs for speech |
embed_tokens.npy |
the embedding table |
rope.npz, layer_types.json |
rotary tables and the layer map |
~3.5 GB. Text programs are palettized to 8 bits; the multimodal programs are fp16.
Use
huggingface-cli download vladimir94/lfm3-omni-2b-ane-coreml --local-dir lfm3-omni-2b-ane-coreml
git clone https://github.com/vladimir-voinea/lfm3-omni-ane
LFM3_MODEL=$PWD/lfm3-omni-2b-ane-coreml python lfm3-omni-ane/tools/lfm3_serve.py
Context
Context length is fixed when the model is built, because the full-attention caches hold a
fixed number of rows inside the compiled programs. These programs hold 28,672 tokens, all
attended exactly. A request needing more is refused with 400 context_exceeded.
Measured
- about 30 tok/s decode, flat across the whole context: 29.9 at 1,000 tokens, 29.7 at 16,000, 31.1 at 28,000
- prefill at the same rate one token at a time, so a 28,500-token prompt reads in about 14.5 minutes
- at 28,500 tokens it recalled a code stated at the very start of the prompt
- against the official model on a 241-token prompt mixing English, Romanian, code and arithmetic: top-1 agreement 96.3 %, top-5 overlap 4.83 of 5, mean KL 0.0036, logit cosine 1.0000 (the earlier 6-bit build here measured 81.7 % and 0.2034)
- an end-to-end smoke test passes: text, tool call, tool result, image in, audio in, speech out and the context guard
What changed the fidelity
The Neural Engine loses accuracy on a large projection whose input values are small, and on silu.
These programs avoid both with forms that equal the originals. The measurements are in notes/STATE.md
in the code repository.
Limits
- Exact attention at 78k is not reachable at speed on this hardware. The arithmetic does not close: exact 78k needs ~109 GFLOPS for attention alone at 20 tok/s, and the best measured ANE tile delivers 92.
- Fidelity against the official model is measured up to position 4,039 (top-1 100 % and mean KL 0.0046 over positions 4,000-4,039), not across the whole context.
- Speech quality has only been compared numerically (waveform correlation 0.996 against the PyTorch codec on random codes).
- Multimodal limits: audio input over 30 s and speech over 10.2 s fall back to PyTorch, which
needs
towers.safetensors(0.88 GB, also in this repository; skip it otherwise). PyTorch is still imported by the runtime. - Audio output works. The depth decoder, sampler and codec are numerically exact (rms and spectrum checked against the reference decode over 24 frames); the loop runs on the engine and produces speech-level audio.
- Core ML will not place a 128,000-way matmul on the engine whole, so the runtime uses the
split head (
lm_head_a/b).
- Downloads last month
- 3,224
Model tree for vladimir94/lfm3-omni-2b-ane-coreml
Base model
LiquidAI/LFM3-Omni-2B