Skip to content

Add llama.cpp support for LFM2.5-ColBERT-350M and LFM2.5-Embedding-350M - #24782

Closed
vincentzed wants to merge 1 commit into
ggml-org:masterfrom
vincentzed:vincentzed/lfm2.5-bidir-upstream
Closed

vincentzed wants to merge 1 commit into
ggml-org:masterfrom
vincentzed:vincentzed/lfm2.5-bidir-upstream

Conversation

@vincentzed

Copy link
Copy Markdown

Overview

Additional information

Requirements

  • I have read and agree with the contributing guidelines
  • AI usage disclosure:
    Yes AI was used, to do testing, as well as locating small improvements, such as avoiding duplicating some weights that are unused. Also some c++ work.

Single-commit squash of vincentzed/lfm2.5-bidir-release (feature + bench
strip + graph dedup + test exclusion + memory fixes + README docs):

- LLM_ARCH_LFM2_BIDIR (lfm2-bidir): non-causal LFM2 encoder for
  LFM2.5-Embedding-350M (dense bi-encoder, CLS) and LFM2.5-ColBERT-350M
  (late-interaction, dense_2 128-d) - no-cache bidirectional attention +
  centered depthwise short-conv (ggml_conv_1d_dw_ph) with per-sequence
  span splitting.
- Graph folded into llama_model_lfm2::graph<iswa, embed> per the
  llama-embed precedent (ggml-org#18220); no separate model class.
- Encoder-only memory hygiene: arch joins the create_memory nullptr group
  (no KV cache - graph is no-cache attention only) and skips the unused
  lm_head/output tensor (no token_embd duplication). Peak footprint
  1927 -> 422 MiB (llama-embedding defaults, M4 Max).
- Conversion: Lfm2BidirectionalModel registration, CLS/MEAN/LAST pooling
  auto-detect, dense_2 projection + embedding_length_out for ColBERT.
- tests: lfm2-bidir joins the embedding-arch exclusion in
  test-llama-archs (generation-mode harness; see LLAMA_EMBED FIXME).
- docs: README models-section entry.

Verified: per-token cosine 1.000000 vs HF (both models, Metal; CPU
0.999997), ColBERT MaxSim ranking identical, multilingual parity 1.0 in
all 11 languages, quantization Q8_0 cosine >0.9999 both models, causal
LFM2-350M token-identical pre/post refactor, test-llama-archs
lfm2/lfm2moe OK, test-backend-ops IM2COL/SSM_CONV green, llama-server
/v1/embeddings OK with memory == nullptr.
@github-actions github-actions Bot added model Model specific testing Everything test related python python script changes labels Jun 18, 2026
@vincentzed vincentzed changed the title release-ii (iterated): lfm2-bidir upstream candidate, squashed Add llama.cpp support for LFM2.5-ColBERT-350M and LFM2.5-Embedding-350M Jun 18, 2026
@CISC

CISC commented Jun 19, 2026

Copy link
Copy Markdown
Member

This seems to be duplicating work that has already been done to support LFM2 Colbert/Embedding, esp. with the 3D vs 2D shortconv... cc/ @tdakhran

@tdakhran

Copy link
Copy Markdown
Contributor

Thanks for tagging @CISC , haven't seen this code before, will check internally.

@vincentzed

Copy link
Copy Markdown
Author

It's been replaced by #24913 since the implementations and ggufs differ. For all future use please refer to that pr.

@vincentzed vincentzed closed this Jun 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

model Model specific python python script changes testing Everything test related

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants