Testing with Generative AI study guide
Semantic Similarity Testing
Semantic Similarity Testing evaluates LLM outputs by comparing the underlying meaning of the generated text against a reference text, regardless of the specific words used, typically utilizing vector embeddings and cosine similarity.
Practical example
QA converts both the Expected Result ("Turn off the lights") and the LLM Output ("Deactivate the illumination") into mathematical vectors. By calculating the angle between these vectors (Cosine Similarity), QA can measure semantic similarity (for example, a score of ~0.95), but a high score does not prove the meanings or facts match exactly.
Exam scenario and common trap
Scenario: You need to automate regression tests for a chatbot where the exact phrasing changes slightly every time. The Trap: "Use Regex assertions." The Correct Answer: Use Semantic Similarity (Vector Embeddings) to assert that the meaning of the response remains stable across regression runs.
Related syllabus material covers the broader concept; this page includes additional context. Reference sections: 2.3.1. See the official ISTQB syllabus for exam scope. Examples are independent; QA-ace is not affiliated with ISTQB.