/v1/embeddings please #310
Replies: 16 comments 15 replies
|
Hi! Adding support to return embeddings is definitely on our road map. In addition, I believe the modifications to support embedding should not be very complicated and is a very good first issue. If you're interested, feel free to contribute! |
|
I looked into it to maybe pick it up as a "good first issue", but did not find it to be straightforward to implement. I'm afraid any changes I would make, would just be hacks. If you have any pointers on how and where I could best add it, I'd be happy to give it a second look. |
|
@zhuohan123 and @yuhai-china are you talking about a multilingual or the monolingual model? |
|
@Vinno97 are you still working on it? I would love to help because I'm interested to use it too. |
|
No I haven't come back to it. I hoped I could just create a new endpoint that hooked into the model and returned the last hidden state. But I found that the LLMEngine was so written around text generation that I didn't see myself easily and cleanly adding embeddings into it. But do give it a try! I must admit I spent less than an hour looking into it. |
|
@yuhai-china @Vinno97 @bm777 Thanks for your interest in this. I previously misunderstood this API to be getting the hidden states for the generated sequence, and that should be easy. However, it turns out that this API is for a completely different set of models (i.e., BERT-like embedding models). The current vLLM mainly focuses on autoregressive generation. For embedding, both paged attention and continuous batching cannot help performance. Therefore, I think it's better to use other libraries for embedding for now. In the future, when we are extending the scope of vLLM, we will look into this again. |
|
Move this issue to discussions as it's more of a longer future plan. |
|
Does anyone have recommandation tools like vLLM for embedding models ? |
|
Waiting of this major feature of VLLM, I created a very simple merge version of VLLM and HuggingFace Text Embeddings Inference to have one API with full OpenAI endpoints : /v1/embeddings, /v1/chat/completion ... : https://github.com/leoguillaume/VLLMEmbeddings |
|
Hi all, as output in the generate() method, I would like to also get the hidden_states associated to the generated sequences. As fas as I searched, this wasnt available, has this been implemented now? |
|
Have you found an alternative method? |
|
So now you support it? |
|
Is it supported? If possible, could this be added into the vllm_worker of Fastchat? Thanks https://github.com/lm-sys/FastChat/blob/main/fastchat/serve/vllm_worker.py |
|
Any updates on this one? |
|
The Batch size normalization: OpenAI's embeddings API accepts up to 2048 inputs in one request. vLLM's batching should ideally handle this gracefully — auto-batch internally rather than requiring callers to manually split. Dimension consistency: When switching between embedding models (e.g., from Normalization by default: OpenAI returns normalized vectors. vLLM should match this behavior so cosine similarity works correctly without callers needing to normalize manually. Token counting for embeddings: Unlike generation, embedding callers need accurate token counts for cost attribution. The response Model aliasing: Production RAG stacks often hardcode For agent memory systems specifically, embedding latency matters a lot — if you're doing retrieval at every agent turn, a 200ms embedding round-trip adds up. Would love to see benchmarks comparing vLLM embeddings throughput vs the OpenAI baseline. |
Uh oh!
There was an error while loading. Please reload this page.
when will /v1/embeddings API available?
Thank you
All reactions