lm-sys / lm-sys/FastChat

bge embedding model serving problem?

Open
#2,929 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Python
Stars
39.5k
Forks
4.8k
PR merge metrics
No merged PRs in 30d

Description

When I use `BAAI/bge-large-zh` embedding model,I found that ModelWorker class use` sum_embeddings = torch.sum(masked_embeddings, dim=1)` compute sentence embedding from token embeddings.
https://github.com/lm-sys/FastChat/blob/bb8aae5e60bde82e5f389c097c76a1bdd4b08341/fastchat/serve/model_worker.py#L169

But in SentenceTransformer, use cls token as sentence embedding, can check [this file](https://huggingface.co/BAAI/bge-large-zh/blob/main/1_Pooling/config.json)
Is this expected behavior?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with fastchat/serve/model_worker.py at the linked line, then compare its token-pooling calculation with SentenceTransformer and the BAAI/bge-large-zh 1_Pooling/config.json. Verify whether the serving behavior is intentional for this model; done means the expected pooling behavior and any required change are clearly established.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, pytorch
Domain
backend, machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.