GenAI Basics · Question 27 · Hard
GenAI Basics question 27
A query embedding is q = (1, 2, 2). Four document embeddings are:
D1 = (2, 1, -2)
D2 = (1, 1, 1)
D3 = (4, 0, 4)
D4 = (0.5, 1, 1)
Which document is most similar to q by cosine similarity?
- D3
- D4
- D2
- D1
Answer and explanation
Answer: B. D4
Explanation: D4 = 0.5 × q points in exactly the same direction, so its cosine similarity is 1. D3 has the largest dot product (12) but its cosine is only 12 / (3 × 5.66) ≈ 0.71; D2 ≈ 0.96 and D1 = 0. Cosine similarity ignores vector length.
Previous: In a RAG system, what is the main purpose of a vector database? · Next: A model's two candidate next tokens have logits 2 and 0. With softmax at…
Practise genai basics
Try a fresh set of genai basics questions with an explanation after every answer, free and without signing up: GenAI Basics practice. Or sit a full placement mock test.
More genai basics questions
- What is chain-of-thought prompting?
- An AI email assistant summarises incoming emails. One email contains hidden…
- In a RAG system, what is the main purpose of a vector database?
- A model's two candidate next tokens have logits 2 and 0. With softmax at…
- In Reinforcement Learning from Human Feedback (RLHF), what is the reward model…
- Why do transformer models add positional encodings (or positional embeddings)…
More technical & programming practice
Pseudo-code · C Programming · Java · Python · Data Structures · Algorithms · Object-Oriented Programming · DBMS
LogicWiz Exams home · All practice topics · Placement mock tests · Daily 10 challenge