mirror of
https://github.com/ollama/ollama-python.git
synced 2026-07-21 17:15:23 -04:00
embed function with LLMs in Ollama
#222
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @acraevschi on GitHub (Feb 18, 2025).
Hello everyone!
I recently discovered that Ollama has
embedfunction. 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'shidden_sizeparameter (=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?