Embeddings and Vector Search: Similarity, Dimensionality, and Model Choice; Storing Text in pgvector
Understand what an embedding actually encodes through the coordinate-system analogy, get clear on the difference between cosine similarity and dot product and normalization's precondition, weigh model choice and dimensionality against a leaderboard, then write a corpus into pgvector and query its nearest neighbors.
Understand what an embedding actually encodes through the coordinate-system analogy, get clear on the difference between cosine similarity and dot product and normalization's precondition, weigh model choice and dimensionality against a leaderboard, then write a corpus into pgvector and query its nearest neighbors.
Interview questions
When are cosine similarity and inner product equivalent? What goes wrong if you rank by inner product on vectors that are not normalized?余弦相似度和内积什么时候等价?如果向量没有归一化,用内积排序会出什么问题?
Common in ChinaCommon overseasBasic#embeddings#similarity#normalisation🔒 Unlock this chapter to see the answer keys.
What do you lose when you cut embedding dimensions from 1536 to 512, and when is that loss acceptable?把 embedding 维度从 1536 降到 512,你会损失什么?什么场景下这个损失可以接受?
Common in ChinaCommon overseasIntermediate#embeddings#dimensions#cost🔒 Unlock this chapter to see the answer keys.
Why do some embedding models require different prefixes for queries and documents? What happens if you skip them, and how would you catch it before shipping?为什么有些 embedding 模型要求查询和文档加不同的前缀?不加会怎样,你怎么在上线前发现这个问题?
Common in ChinaCommon overseasIntermediate#embeddings#model-selection#evaluation🔒 Unlock this chapter to see the answer keys.
Can vector search fully replace keyword search? Give a query where vectors are bound to fail, and say how you would fix it.向量检索能完全取代关键词检索吗?举一个向量必然失手的查询,并说说你会怎么补。
Common in ChinaCommon overseasIntermediate#hybrid-search#embeddings#retrieval-failure🔒 Unlock this chapter to see the answer keys.
