Quantitative Framework for Production LLM Evaluation in Security Applications

Susan Chang, Pedro Jaramillo3 Feb 2025

Problem

Elastic's security team ships GenAI features (an AI Assistant chatbot, Attack Discovery, Automatic Import) to enterprise users at scale. A prompt change or a switch of LLM provider can quietly make answers worse, and nobody can tell by eye. Manual spreadsheet testing was slow. Attack Discovery was harder to test: inputs are sets of alerts for one or more attacks, and judging the narrative output needs security expertise.

Example from the article: to check that natural-language-to-ES|QL generation returns valid queries, the team kept a spreadsheet of realistic SOC queries and compared each recorded response with the expected output.

Solution in brief

Build the evaluation from five parts: test scenarios, a curated dataset of expert-approved outputs, tracing, rubric prompts for an LLM judge, and a scoring rule. Every prompt or model variant is run on the dataset, scored per rubric item, and dropped if accuracy falls below 85%. The judge prompts and rubrics are evaluated the same way.

Questions this case answers
  • How to compare prompts and model providers quantitatively when the correct output is a free-text narrative that only an expert can judge
  • How to turn expert-approved outputs into a reusable reference dataset and an automated scoring routine for generative features
  • How to know that a new prompt or LLM provider really improves a production GenAI feature?
  • How to build a golden test dataset for LLM outputs that need expert judgment?

Tools and methods

  • LangSmith — traces every LLM call, stores datasets, runs evaluations
  • LangGraph — builds and runs the agent workflows being evaluated
  • Elasticsearch — vector database behind retrieval in the agents
  • seaborn — heatmap of prompt scores
  • LLM-as-a-judge — a second LLM checks each output against rubric items
  • Golden set — expert-approved outputs per test scenario
Continue reading — it's free

Google or a one-time email code. No password.