Skip to main content

LLM evaluation guide for AI engineers

, 7 min read

As an application AI engineer, you don't need to train LLMs—but you must understand how they're built to make correct architectural decisions. Think of it like understanding database internals without writing a storage engine.

This guide consolidates the critical parameters you need to evaluate when selecting, deploying, or debugging LLMs in production.

LLM evaluation framework infographic: eight areas around a core evaluation framework — model architecture, context and position, MoE experts, tokenization, training and alignment, inference and serving, agent and tools, and production metrics


Model architecture​

Model type​

AspectDetails
What it isNext-token prediction (left-to-right) generator
Key questionsIs it decoder-only? Any special heads for classification/tooling?
Why it mattersDetermines best-fit tasks (generation vs embedding) and streaming behavior
Common optionsDecoder-only (GPT/LLaMA/Qwen), Encoder-decoder (T5), Encoder-only (BERT)
What you controlPrompting pattern, stop sequences, structured output constraints
TradeoffsDecoder-only can hallucinate; not ideal alone for retrieval/classification
Smell testCode assistant or refactor agent → decoder-only is the right choice

Parameters: total vs activated (MoE)​

AspectDetails
What it isStored capacity vs per-token compute actually used
Key questionsIs it MoE? What's the activated compute per token?
Why it mattersCost/latency can be close to a small model with large-model quality
Common optionsDense, MoE (top-k), Hybrid
What you controlBatch sizing, expert parallelism, routing config (if exposed)
TradeoffsMoE can have load imbalance; routing instability; harder to serve
Smell test"30B total, ~3B active" → cheap inference, big VRAM footprint

Depth and width​

ParameterWhat it isWhy it mattersTradeoffs
Layers (Depth)Transformer block count (24, 32, 48, 80+)Correlates with multi-step reasoning and abstractionDeeper = higher latency; harder to quantize aggressively
Hidden size (Width)Representation capacity per layer (2k–10k+)Affects richness of representations + code reasoningWider increases VRAM + compute; may not help if data mix is weak

Attention architecture​

AspectDetails
What it isAttention parallelism mechanism; GQA/MQA reduces KV cache size
Key questionsIs it MHA, GQA, or MQA? What's the Q:KV head ratio?
Why it mattersBig driver of long-context feasibility and throughput
Common optionsMHA (Multi-Head), GQA (Grouped Query), MQA (Single KV)
What you controlKV cache precision, batching, context window policy
TradeoffsToo aggressive KV sharing can slightly reduce quality
Smell testGQA (32Q/4KV) → much smaller KV cache for long context

Context and positioning​

Context length​

AspectDetails
What it isMaximum tokens handled as trained
Key questionsNative or RoPE-scaled? What's quality past 32k/64k?
Why it mattersLong-context correctness is non-linear; "supports" ≠ "understands"
Common options8k / 16k / 32k / 128k / 256k+
What you controlChunking, sliding window, retrieval strategy, summarization
TradeoffsKV cache explosion; "lost in the middle" phenomenon; higher latency
Smell testIf it forgets key constraints in long prompts → long-context weakness

Positional encoding​

AspectDetails
What it isHow the model represents token positions
Key questionsRoPE? ALiBi? Any long-context scaling (NTK/YaRN)?
Why it mattersGoverns long-range generalization
Common optionsRoPE, ALiBi, Absolute, RoPE scaling variants
What you controlPrompt structure (headings), chunking order, retrieval placement
TradeoffsScaling hacks can break beyond the trained window
Smell testNative 256k trained usually beats RoPE-hacked 256k

Mixture of experts (MoE)​

Only applicable to MoE models (e.g., Mixtral, Qwen-MoE, DeepSeek-V2)

ParameterWhat it isKey questionsTradeoffs
# ExpertsCount of expert FFNs (8–128+)How many? Are they specialized (code/math)?Bigger memory footprint; more complex routing
Activated experts (top-k)How many experts run per tokenk=2/4/8? Does it vary?Higher k = better quality, more compute; tail latency spikes
Router / load balancingMechanism selecting expertsToken-level routing? Load balance loss?"Hot" experts cause congestion; quality variance

Tokenization and internals​

ParameterWhat it isKey questionsEngineering impact
Tokenizer + vocabHow text/code becomes tokensBPE/SentencePiece? Code-optimized? Multilingual?Bad tokenizer → 20–40% extra tokens; worse code formatting
Activation functionNon-linearity in FFN layersSwiGLU? GeGLU? ReLU?Some activations quantize better than others

Training and alignment​

Training stage​

AspectDetails
What it isPretrain gives capability; post-train adds instruction-following/alignment
Key questionsHow much instruction data? RLHF? Tool-use training? Safety tuning?
Why it matters"Usable in prod" depends more on post-train than size
Common optionsSFT only, RLHF/DPO/IPO, Tool-use finetune, Safety filters
What you controlSystem prompt, policy layer, tool schema, eval harness
TradeoffsOver-alignment/refusals; shallow SFT can be prompt-fragile
Smell testIf it ignores instructions or breaks JSON easily → weak post-train

Training data mix​

AspectDetails
What it isRatio of code/text/math + freshness
Key questionsHow much code? Which languages? License-clean?
Why it mattersStrong predictor of code quality and hallucination rate
Common optionsCode-heavy, Balanced, Math-heavy
TradeoffsData contamination/licensing risk; stale frameworks
Smell testIf it's bad at modern React/TypeScript patterns → stale data mix

Inference and serving​

Precision and quantization​

ParameterWhat it isKey questionsTradeoffs
PrecisionNumerical format (FP32/BF16/FP16/FP8)FP16 vs BF16 vs FP8? Mixed precision?FP16 can overflow; FP8 needs calibration
QuantizationLower-bit weights (INT8/INT4)GPTQ/AWQ? KV quantization?Biggest lever for $/token but can break math/JSON/tool calls

Attention and memory​

ParameterWhat it isKey questionsWhy it matters
Attention kernelGPU attention algorithmFlashAttention2/3? Paged attention?Can mean 2–4× throughput difference
KV cache strategyHow past tokens' K/V are storedKV precision? Paged KV? Prefix caching?Dominant factor for long-context serving economics

Batching and parallelism​

ParameterDetails
Batching strategyStatic vs continuous batching; drives throughput and cost
Parallelism (TP/PP/EP)Tensor/Pipeline/Expert parallelism; determines scaling + infra cost

Decoding parameters​

AspectDetails
What it isSampling parameters for generation
Key questionsTemperature/top-p/top-k? Repetition penalty?
Common profilesCode mode: temp 0–0.2, low top-p; Creative: temp 0.7–1.0
TradeoffsToo creative → wrong code; too greedy → brittle phrasing

Agent and tool use​

Tool and function calling​

AspectDetails
What it isWhether model learned tool usage
Key questionsNative tool-calling? Or prompt-hacked?
Why it mattersDetermines agent reliability
Common optionsTrained function calling, XML tags, Prompt-only
What you controlTool schema design, retries, self-heal loops
Smell testIf it keeps "thinking" instead of calling a tool → weak tool training

Structured output​

AspectDetails
What it isAbility to emit valid JSON/DSL
Key questionsDoes it support JSON schema / constrained decoding?
Why it mattersCritical for agents and tool calls
Common optionsFree-form, JSON mode, CFG/constrained decoding
What you controlUse constrained decoding, schema validation + retries
Smell testIf tool calls break 5% of the time → production pain

Production metrics​

Performance​

MetricWhat to measureWhy it matters
ThroughputTokens/sec, req/sec at target context lengthReal production cost = throughput × latency
LatencyTime-to-first-token (TTFT) + per-token decode speedUX + agent planning loops
DeterminismSame input → same output?Needed for CI, debugging, compliance

Reliability​

AspectDetails
Safety/refusalGuardrails (inline or post-hoc classifier); can impact valid request completion
Context managementHow you place info in prompt; RAG placement; "lost in middle" mitigation
Failure modesKnown weak spots: Where does it hallucinate? Over-refuse? Loop?

Customization​

ParameterWhat it isKey questionsTradeoffs
Fine-tuning compatibilityWhether you can adapt itLoRA/QLoRA? Full finetune? SFT pipeline?Drift, regressions, catastrophic forgetting
Instruction tuning depthBreadth/quality of instruction-followingMulti-turn? Code-specific SFT?Overfit to chatty style; refusals

Quick evaluation checklist​

Before deploying any model, run these smell tests:

  • JSON/Structured output — Can it reliably emit valid JSON for 100 requests?
  • Tool calling — Does it call tools correctly, or does it "think" endlessly?
  • Long context — Does it remember constraints from 50k tokens ago?
  • Code patterns — Does it know modern frameworks (React 18, TypeScript 5)?
  • Determinism — Do tests flake? (1/20 runs fail = determinism gap)
  • Refusals — Does it refuse benign requests too often?

Remember: Predictability beats raw intelligence. A model that's slightly less capable but reliable is often better for production than a brilliant but brittle one.