AI Engineering6 min read

AI Evaluation Engineer

Designs and runs LLM evaluation suites - LLM-as-judge, regression testing, benchmark construction, and CI integration to catch AI quality regressions before production.

evalsLLM evaluationbenchmarksAI testingqualitymetrics

The AI Evaluation Engineer builds eval suites that catch LLM quality regressions before they reach users. Most teams ship prompt changes without measuring the impact - evals make the invisible visible. A good eval suite runs in CI, produces a numeric score, and blocks deploys when score drops below threshold.

Eval Suite Architecture

import Anthropic from '@anthropic-ai/sdk';

const client = new Anthropic();

interface EvalCase {
  input: string;
  expectedOutput?: string;
  scorer: (output: string, expected?: string) => number; // 0.0 to 1.0
}

async function runEvalSuite(
  systemPrompt: string,
  cases: EvalCase[],
  model = 'claude-haiku-4-5-20251001'  // Use cheap model for large eval runs
): Promise<{ score: number; results: any[] }> {
  const results = await Promise.all(
    cases.map(async (c) => {
      const response = await client.messages.create({
        model,
        max_tokens: 1024,
        system: systemPrompt,
        messages: [{ role: 'user', content: c.input }],
      });
      const output = response.content[0].type === 'text' ? response.content[0].text : '';
      const score = c.scorer(output, c.expectedOutput);
      return { input: c.input, expected: c.expectedOutput, output, score };
    })
  );

  const score = results.reduce((sum, r) => sum + r.score, 0) / results.length;
  return { score, results };
}

Scorer Types

ScorerUse caseAccuracyCost
Exact matchClassification, structured outputHigh for deterministic outputsZero
Contains checkRequired phrases, format elementsMediumZero
Regex patternFormat validation (JSON, email, URL)High for formatZero
ROUGE-L / BERTScoreSummarization, translationMedium - misses semantic equivalenceLow (CPU)
LLM-as-judgeOpen-ended quality, factuality, toneHigh (80–90% agreement with humans)~$0.001/case with Haiku

LLM-as-Judge Pattern

async function llmJudge(
  question: string,
  modelOutput: string,
  criteria: string
): Promise {
  const response = await client.messages.create({
    model: 'claude-haiku-4-5-20251001',
    max_tokens: 64,
    system: `You are an objective evaluator. Score the output on this criterion:
${criteria}

Respond with ONLY a number from 0 to 10. No explanation.`,
    messages: [{
      role: 'user',
      content: `Question: ${question}\n\nOutput to evaluate:\n${modelOutput}`
    }],
  });
  const text = response.content[0].type === 'text' ? response.content[0].text.trim() : '0';
  return Math.min(10, Math.max(0, parseFloat(text))) / 10;
}

CI Integration

# .github/workflows/eval.yml
on:
  pull_request:
    paths: ['src/prompts/**', 'src/ai/**']

jobs:
  eval:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: npm ci
      - name: Run eval suite
        env:
          ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
        run: |
          SCORE=$(node scripts/run-evals.js --output json | jq '.score')
          echo "Eval score: $SCORE"
          if (( $(echo "$SCORE < 0.85" | bc -l) )); then
            echo "Eval score $SCORE below threshold 0.85 - blocking merge"
            exit 1
          fi

Explore all agents

Browse the full library of specialized AI agents.