Skip to content

[Model] Add LFM3 support - #3599

Merged
akaashrp merged 22 commits into
mlc-ai:mainfrom
JCNTH:codex/lfm3-q8-review
Nov 20, 2026
Merged

akaashrp merged 22 commits into
mlc-ai:mainfrom
JCNTH:codex/lfm3-q8-review

Conversation

@JCNTH

@JCNTH JCNTH commented Nov 15, 2026 •

Copy link
Copy Markdown
Contributor

Add LFM3 gated attention, partial RoPE, convolution layers and Hugging Face weight mapping. Use float32 projection accumulation and bounded sliding-window prefill.

Subgroup builds require apache/tvm-tirx#250. Libraries: mlc-ai/binary-mlc-llm-libs#169. WebLLM records: mlc-ai/web-llm#895. Optional q8 quantization is separate in #3610.

JCNTH and others added 18 commits October 15, 2026 21:47
LFM2 and LFM2.5 interleave gated short-convolution blocks with GQA
attention layers. The conv state lives in RNNState and the attention layers
use the paged KV cache, so the model compiles as a hybrid like Qwen3.5. The
config reads both the LFM2 and LFM2.5 spellings of the layout, FFN width,
tied embeddings and RoPE settings, and applies HF's FFN auto-adjustment. It
rejects conv_bias, non-default RoPE types and layouts without a conv layer.
max_batch_size is capped at 1 because the conv state cannot be carried
through a packed multi-sequence prefill.
Update TVM to include the Windows DLL-export fix in mlc-ai/relax#351. This resolves the missing `VLogContext::str()` symbol when linking `tvm_runtime_extra`.

Verified native TVM and MLC builds, the affected TVM tests, and the SmolLM3/LFM2 CPU tests. The TVM FFI revision is unchanged.
# Conflicts:
#	3rdparty/tvm
@JCNTH
JCNTH marked this pull request as ready for review November 15, 2026 17:35
@akaashrp akaashrp changed the title [Model] Add LFM3 and 8-bit group quantization [Model] Add LFM3 support Nov 20, 2026
@akaashrp
akaashrp merged commit 09096c6 into mlc-ai:main Nov 20, 2026
1 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants