KEMBAR78
examples : allow extracting embeddings from decoder contexts by ggerganov · Pull Request #13797 · ggml-org/llama.cpp · GitHub
Skip to content

Conversation

@ggerganov
Copy link
Member

fix #13795
cont #13108
ref #13108 (comment)

Sometimes it might be necessary to extract embeddings from a decoder-only model. To support this, update the examples to call llama_decode() instead of llama_encode() when computing embeddings. The call will internally fallback to llama_encode() if the model is encoder-only.

@aviallon
Copy link
Contributor

@ggerganov does this mean that models that benefited from cache-less embeddings will still benefit from the feature introduced in #13108

@ggerganov
Copy link
Member Author

ggerganov commented May 26, 2025

@aviallon Yes, this change should not modify the behavior for encoder-only (a.k.a. cache-less) models like BERT.

@aviallon
Copy link
Contributor

aviallon commented May 26, 2025

@ggerganov @ngxson you just earned a new sponsor.

@ggerganov ggerganov merged commit 79c137f into master May 26, 2025
50 of 53 checks passed
@ggerganov ggerganov deleted the gg/embedding-fix-non-embd-use branch May 26, 2025 11:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Eval bug: Output NAN when use Qwen3 embedding models with FP16

3 participants