SDE & MLE Prep

Evaluating LLMs & Hallucinations

Q: How do you evaluate an LLM application, and reduce hallucinations?

  • Benchmarks (MMLU, GSM8K, HumanEval, …) for general capability — beware contamination.
  • Task-specific evals: a curated, versioned test set from real traffic; exact match / unit tests where possible; LLM-as-judge with rubrics (validated against humans); pairwise preference win rates.
  • Track quality, latency, cost, and safety (toxicity, jailbreaks, PII leakage) per release; A/B test in production.
  • Hallucinations (fluent but false): ground with RAG and citations, constrain to the provided context, lower temperature, self-consistency (sample several answers and compare), verification steps/tools (calculators, code execution, search), and teach the model to abstain.