Skip to content

Add typed encoder backend and dense XLM-RoBERTa embed - #605

Closed
Aryan4443 wants to merge 5 commits into
vllm-project:mainfrom
Aryan4443:feature/encoder-backend-xlm-r
Closed

Add typed encoder backend and dense XLM-RoBERTa embed#605
Aryan4443 wants to merge 5 commits into
vllm-project:mainfrom
Aryan4443:feature/encoder-backend-xlm-r

Conversation

@Aryan4443

@Aryan4443 Aryan4443 commented Aug 13, 2026

Copy link
Copy Markdown

Summary

  • Restart of encoder support after Add dense BGE-M3 / XLM-RoBERTa embed via native Apache encoder #594: pooling, lifecycle, cache setup, and the runner talk only to a small EncoderEmbeddingBackend + family registry. XLM-R / BGE names stay in the family module.
  • First dense family is native Apache-2.0 XLM-RoBERTa / RoBERTa (no GPLv3 mlx-embeddings), with CLS pooling on the existing pooling path.
  • Adds real tiny-checkpoint load plus CLS pooling parity coverage, and a guard that shared pooling files do not mention family names.

Fixes #589 (dense embed only; sparse token_classify remains follow-up).

Test plan

  • python -m pytest tests/test_encoder_embeddings.py tests/test_v1_pooling.py
  • CI lint + tests
  • Optional: offline LLM.embed on mlx-community/bge-m3-mlx-8bit with tight memory (VLLM_METAL_MEMORY_FRACTION=0.35, max_model_len=128)

Aryan4443 and others added 5 commits August 10, 2026 17:32
Unblock encoder embedding checkpoints on Metal by loading through the
optional mlx-embeddings extra and serving CLS dense embed. Sparse
token_classify remains a follow-up for vllm-project#589.

Signed-off-by: Aryan <aryannlakhani21@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Encoder embedding models own bidirectional attention and have no
mlx-lm-style layer list to wrap. Skipping patch setup unblocks the
offline LLM.embed path for BGE-M3 / XLM-RoBERTa.

Signed-off-by: Aryan <aryannlakhani21@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Move load, bidirectional segment forward, CLS pooling defaults, and
paged-attention patch skipping behind EncoderEmbeddingAdapter so the
encoder path is reviewable as a single ownership boundary.

Signed-off-by: Aryan <aryannlakhani21@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Drop the incompatible mlx-embeddings dependency and load BGE-M3 /
XLM-RoBERTa through an in-tree MLX encoder that keeps the adapter-owned
load, forward, CLS defaults, and patch-skip boundary.

Signed-off-by: Aryan <aryannlakhani21@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Keep pooling, lifecycle, cache setup, and the runner family-agnostic
behind EncoderEmbeddingBackend, and register XLM-RoBERTa as the first
dense family with real load plus CLS pooling parity.

Signed-off-by: Aryan <aryannlakhani21@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>

@LxYuan0420 LxYuan0420 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for working on this, but I don’t think this PR is the right base.

It mixes the pooling seam, encoder lifecycle, cache behavior, and native XLM-R/BGE-M3 model code in one stack. I’m submitting a smaller PR first to make the current decoder pooling path clean and extensible:

vLLM pooling API
  -> runner scheduling/output
  -> pooling backend
      -> decoder now
      -> encoder later
          -> XLM-R/BGE-M3 later

After that lands, encoder support should restart on top of this seam in smaller PRs.

@Aryan4443

Copy link
Copy Markdown
Author

Thanks for the direction, that split makes sense.

I'll wait for #606 to land, then restart encoder support on that seam in smaller PRs. Happy to take PR 2 (encoder pooling backend + no-KV lifecycle) or PR 3 (native XLM-R dense embed) once the decoder backend is in.

@LxYuan0420 LxYuan0420 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Closing as superseded.

#606/#608 established the pooling backend seam, and #612 now carries BGE-M3 support on that structure.

@LxYuan0420 LxYuan0420 closed this Aug 15, 2026
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.

[Feature] Support BGE-M3 sparse embeddings with token-level pooling

2 participants