Skip to content

What exactly does llama_get_embeddings return? #3643

Answered by adamamer20
Trawczynski asked this question in Q&A
Discussion options

You must be logged in to vote

Just in case anyone is still wondering, the question has been answered in #7087. llama_get_set_embeddings returns the embeddings in the last hidden layer and thus the embeddings are contextualized (i.e. have been processed by the transformer) and should be meaningful.
For example, in Phi3:

Phi3ForCausalLM(
  (model): Phi3Model(
    (embed_tokens): Embedding(32064, 3072, padding_idx=32000)
    (embed_dropout): Dropout(p=0.0, inplace=False)
    (layers): ModuleList(
      (0-31): 32 x Phi3DecoderLayer(
        (self_attn): Phi3Attention(
          (rotary_emb): Phi3RotaryEmbedding()
          (o_proj): QuantLinear()
          (qkv_proj): QuantLinear()
        )
        (mlp): Phi3MLP(
     …

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by Trawczynski
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants