First native MLX port of ByteDance Research's Lance — a 3 B-parameter unified multimodal model for image/video generation, editing, and understanding. Runs natively on Apple Silicon, no CUDA required.
The architecture is Qwen2.5-VL-3B + parallel MoE-gen experts + Wan 2.2 VAE. Lance uses a "Mixture-of-Tokens" routing: every attention block and MLP has a parallel *_moe_gen branch. Text tokens go through normal weights; VAE-latent (generation) tokens go through the _moe_gen weights, in the same forward pass.
Quick start (self-contained — no external repo needed)
bash
1# 1. Download the model (one-time, ~27 GB total)2hf download RockTalk/Lance-3B-MLX --local-dir Lance-3B-MLX
34# 2. Install runtime deps5cd Lance-3B-MLX
6pip install -r requirements.txt
78# 3. Generate9python inference.py --prompt "a photo of a sunset over mountains" --out sunset.png
The first run auto-fetches the companion VAE (RockTalk/Wan2.2-VAE-MLX, ~2.6 GB, cached as wan22_vae.safetensors) so all subsequent runs are fully offline.
Same M4 Studio. AR generation with KV cache, ~29 tok/s. Question: "Describe this image briefly."
Image
Generated description
cat
"The image shows orange cats sitting closely together on a wooden surface. The wooden surface has a warm, orange hue that complements the color of the cats."
mountain
"A majestic, snow-covered mountain peak. The mountain is partially shrouded in clouds, creating a dramatic and ethereal atmosphere..."
sunset
"A stunning sunset over a mountain range, with the sky painted in rich hues of orange, red, and yellow. The sun is just below the horizon, casting a warm glow..."
Performance
Measured on M4 Studio (128 GB) at CFG=4 (one conditional + one unconditional forward per step):
Mode
Resolution × Frames
Steps
Per-step
Total
Notes
T2I
256×256 × 1
24
~400 ms
~9.6 s
CFG=4
T2I
512×512 × 1
30
~1.2 s
~36 s
CFG=4
TI2I
256×256 × 1
24
~1.5 s
~37 s
3-component CFG (3 forwards/step)
X→T
504×504 input
—
~30 tok/s
~2 s for 60 tokens
KV cache active
First-call kernel-compile penalty: ~few seconds per new resolution.
Files
File
Size
Description
model.safetensors
23 GB
LLM (Qwen2.5-VL with MoE-gen) + Lance adapters, 1021 tensors
vit.safetensors
1.25 GB
Qwen2.5-VL ViT (used by X→T and TI2I)
vae.safetensors
2.62 GB
Wan 2.2 VAE (older "nested-conv" keying, kept for archival — inference.py auto-fetches the cleanly-keyed RockTalk/Wan2.2-VAE-MLX instead)
config.json
—
Distilled architecture config
tokenizer.json, vocab.json, merges.txt
—
Qwen2.5-VL tokenizer, verbatim
samples/*.png
—
Verified outputs (T2I + TI2I edit) from this checkpoint
lance_mlx/
—
Bundled MLX implementation (model + VAE + utils)
inference.py
—
Self-contained T2I runner
requirements.txt
—
Pip dependencies
How the MoE-gen routing is implemented in MLX
Lance's checkpoint contains two sets of weights per Qwen2 block:
Each mode has its own sequence layout. The MLX port (lance_mlx/qwen2_navit_mlx.py) routes by slicing the sequence into the GEN slab vs the surrounding UND text/vision, applying the appropriate expert to each slab, and concatenating.
All tokens route through normal weights. Per-layer KV cache for the AR loop. Image positions inside <|vision_start|>..<|vision_end|> use 3D mrope grid coords (h_patches/sms × w_patches/sms).
ViT tokens and VAE-cond tokens use normal weights; only the target-noise block uses moe_gen. The Lance edit-mode system prompt is verbatim from PT and is required for the model to recognize edit intent. Three-component CFG (cfg_text, cfg_vit) gives separate control over text vs visual conditioning strength.
Conversion source
Converted from bytedance-research/Lance/Lance_3B/* using a local conversion pipeline. Layout transforms:
lm_head.weight tied to embed_tokens.weight (Qwen default)
All *_moe_gen.* keys copied verbatim under the same names
Related ports
A parallel MLX port exists at mlx-community/Lance-3B-Video-bf16 (Apache-2.0). The two checkpoints have been verified numerically equivalent: remapping this repo's F32 weights into their layout and casting to bf16 produces byte-identical pixel output through their pipeline. Use whichever fits your workflow.
License
Apache 2.0, inherited from upstream bytedance-research/Lance. The Wan 2.2 VAE component is also Apache 2.0 from Alibaba's Wan team.
Acknowledgements
ByteDance Research — original Lance training + PT release
Qwen team — Qwen2.5-VL-3B-Instruct backbone
Alibaba Wan team — Wan 2.2 VAE training
Apple mlx and mlx-vlm teams — the underlying frameworks
mlx-community Lance porters — parallel bf16 port, numerically cross-checked against this one
This MLX port — RockTalk
Citation
bibtex
1@misc{lance_mlx,
2 title = {Lance-3B-MLX — First MLX port of ByteDance's Lance},
3 author = {RockTalk},
4 year = {2026},
5 url = {https://huggingface.co/RockTalk/Lance-3B-MLX}
6}