Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

embed function with LLMs in Ollama #447

Open
acraevschi opened this issue Feb 18, 2025 · 0 comments
Open

embed function with LLMs in Ollama #447

acraevschi opened this issue Feb 18, 2025 · 0 comments

Comments

@acraevschi
Copy link

Hello everyone!

I recently discovered that Ollama has embed function. In this repo, there is an example of using it with 'llama3.2' (3B variant, by default). The output of this function is a vector of llama's hidden_size parameter (=3072).

Does this mean the model is doing more than just passing the input through the network (excluding the output layer) and instead applying some form of pooling?

Specifically, how is the final hidden representation being transformed from shape [input_tokenized_len, hidden_size] to [1, hidden_size]?

I understand how specialized sentence transformers achieve this, but in a typical decoder-only LLM like LLaMA, the hidden states usually retain the [input_tokenized_len, hidden_size] shape before the final output. Could someone clarify what transformation is applied here?

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

No branches or pull requests

1 participant