Skip to main content

Model Selection

The Core Mental Shift

A beginner picks one LLM. An AI Systems Engineer picks a model portfolio — multiple specialized models, each chosen for what it does best.

AI System = Embedding Model
+ Reranker
+ Generator (Frontier or Open)
+ Reasoning Model (for planning)
+ Vision Model (if documents include images)
+ Judge Model (for evaluation)
+ Optional: Fine-tuned domain model

The question is never "which LLM?" — it is "which combination of models performs retrieval, reranking, reasoning, evaluation, and generation for this workflow?"


The 12 Model Categories

#CategoryExamplesWhen to use
1FrontierClaude Opus/Sonnet, GPT-4o, Gemini 2.5 ProComplex reasoning, multi-step synthesis, enterprise copilots. Most capable, most expensive.
2Open (self-hostable)Llama 3.x, Qwen 3, Mistral, DeepSeek, GemmaSovereign/on-prem deployment, privacy, cost control. Required for regulated-industry buyers.
3Small Language Models (SLMs)Gemma 3 4B, Phi-4, Qwen 3 4B, Llama 3.2 3BClassification, extraction, routing, simple agents. SLM + good RAG often beats Frontier + poor RAG at 1/20th the cost.
4Embeddingtext-embedding-3-large, bge-large-en, e5-large-v2Every RAG system — no embeddings, no semantic retrieval.
5RerankerBGE Reranker v2, Cohere Rerank, Jina RerankerTop-100 retrieve → rerank → top-10 to LLM. Single biggest RAG quality lever after hybrid search.
6ReasoningOpenAI o3/o4, DeepSeek-R1, Qwen-3 thinking modeMulti-step agent planning, complex analysis, chain-of-thought tasks. Slower and pricier — use selectively.
7VisionGPT-4o Vision, Gemini Vision, Llama Vision, ColPaliInvoice photos, scanned PDFs, claim images, medical imaging. ColPali for visual document retrieval.
8SpeechWhisper (self-host), Deepgram, Gemini AudioCall centres, meeting transcription, voice agents.
9MultimodalGPT-4o, Gemini 2.5, Claude SonnetMixed text + image + audio pipelines.
10CodeDeepSeek Coder, Qwen Coder, CodellamaTool generation, code review agents, CI agents.
11Fine-tunedLoRA / QLoRA on Llama, Qwen, MistralDomain vocabulary, tone, structured output format. Not a substitute for RAG — use when the base model consistently fails on domain-specific phrasing.
12Domain-specificMedical AI, Legal AI, Insurance AIOften outperform frontier models on narrow tasks. Evaluate before assuming Frontier wins.

Decision Framework

Step 1 — Map the task to a model role

TaskPrimary model role
Turn query into vectorEmbedding
Retrieve candidatesEmbedding + Vector DB
Cut 100 results to 10Reranker
Generate answer from contextFrontier or Open Generator
Plan multi-step agent workflowReasoning
Score answer qualityJudge (smaller capable model)
Parse claim photo or scanned PDFVision
Transcribe meeting or callSpeech
Classify, extract, routeSLM
Generate code for toolCode model

Step 2 — Apply the constraint filter

ConstraintImplication
Data must not leave org perimeterOpen self-hosted only — no Frontier API
Budget < €0.02/querySLM + good RAG; Frontier only for escalation
p95 latency < 1sEliminate reasoning models from the hot path
Regulated industry (AI Act, GDPR)Prefer open model with signed container + SBOM
Multi-tenant SaaSShared embedding model OK; per-tenant indexes
Images / scanned docs in corpusAdd Vision model + ColPali for retrieval

Step 3 — Build the cascade

Default cascade architecture (cheapest first, escalate on low confidence):

Query

SLM classifier (is this in scope? simple or complex?)
├── Simple + in-scope → SLM generator (fast, cheap)
└── Complex or uncertain → Frontier generator (quality)

Reasoning model (only for multi-step planning)

This single pattern typically cuts cost 60–90% vs always using Frontier.


Trade-Off Matrix

Frontier API vs Self-Hosted Open Model

DimensionFrontier APISelf-Hosted Open
Quality (general)HigherLower, but closes fast
Quality (domain, with fine-tune)ModerateCan exceed Frontier
CostPer-token, predictableInfra cost (GPU), scales at zero marginal cost
LatencyNetwork + queue dependentControlled, local
Data sovereigntyData sent to vendorStays in perimeter
Compliance (AI Act, GDPR)Harder — vendor DPA requiredEasier — you control the stack
Ops burdenLowHigh (GPU infra, updates, monitoring)
When to chooseManaged cloud, speed to market, non-regulatedRegulated industries, on-prem mandates, high volume

Long Context vs RAG

DimensionLong ContextRAG
FreshnessStale (at inference time)Fresh (retrieve at query time)
CostQuadratic in some setupsRetrieval + shorter context
CitationHard (LLM must cite from a wall of text)Natural (retrieved chunks are the sources)
ScaleLimited by context windowScales to millions of documents
When to chooseSmall, stable corpus; one-shot summarizationLarge, evolving corpus; multi-source Q&A

Fine-Tuning vs Better RAG vs Better Prompting

ApproachFixesDoes not fix
Better promptingInstruction-following, output formatMissing knowledge, wrong facts
Better RAGMissing knowledge, factual errorsStyle, format, domain vocabulary
Fine-tuningStyle, vocabulary, structured output, instruction-followingMissing knowledge (still needs RAG for facts)

Rule: try better RAG first. Fine-tune only when the base model consistently fails on domain-specific phrasing, tone, or output format — not for knowledge injection.

Dense vs Hybrid Retrieval

DimensionDense onlyHybrid (BM25 + dense)
Semantic recallHighHigh
Exact-match recall (IDs, codes, names)LowHigh
CostEmbedding onlyBM25 is free
When to chooseNever in productionAlways

Model Portfolio Per Project

Project 1 — Enterprise Knowledge Platform

RoleModelRationale
Embeddingtext-embedding-3-large or bge-largeHigh recall on technical docs
RerankerBGE Reranker or Cohere RerankQuality gate before generation
GeneratorClaude Sonnet or GPT-4o (Frontier, managed cloud)Complex multi-source synthesis
JudgeClaude Haiku or GPT-4o-miniCost-efficient groundedness scoring

Benchmark to publish: SLM + RAG vs Frontier + RAG — demonstrates cost/quality trade-off reasoning.

Project 2 — Workflow Automation Platform

RoleModelRationale
PlannerDeepSeek-R1 or OpenAI o3-miniMulti-step workflow planning
SynthesizerFrontier (Claude Sonnet / GPT-4o)Final output quality
Tool executorQwen Coder or DeepSeek CoderStructured tool call generation
Classifier/routerQwen 3 4B (SLM)Route simple tasks away from Frontier
JudgeSmaller capable modelAction correctness, idempotency check

Project 3 — Insurance / Compliance Copilot

RoleModelRationale
GeneratorLlama 3.x or Qwen 3 (self-hosted, vLLM)Sovereign — data never leaves perimeter
Vision / OCRLlama Vision or ColPaliClaim photos, scanned policy docs
Embeddingbge-large (self-hosted)Embeddings carry regulated data — must stay on-prem
RerankerBGE Reranker (self-hosted)No external API calls on regulated corpus
Fine-tuneLoRA on base model, insurance corpusDomain terminology, structured output for decisions
JudgeSmaller open model (self-hosted)AI Act: judge must also stay in perimeter

Numbers to Know in Interviews

FactValue
Embedding dimensions768 (bge-base), 1024 (bge-large), 3072 (text-embedding-3-large)
Storage per 1M chunks at 1024 dims, float32~4 GB
Frontier input cost range€0.5–€5 per million tokens
SLM input cost (self-hosted, amortized GPU)€0.01–€0.10 per million tokens
Prompt caching discount50–90% off cached input tokens
Reranker latency (cross-encoder, top-100)50–200ms
GPU VRAM for 7B model at FP16 / INT8 / INT4~14 GB / ~7 GB / ~4 GB
GPU VRAM for 70B model at FP16 / INT8 / INT4~140 GB / ~70 GB / ~35 GB
Speculative decoding speedup2–3×
Cost reduction from cascade routing60–90%

Open Model Licensing Quick Reference

ModelLicenseCommercial use
Llama 3.xMeta Community LicenseYes, with acceptable-use policy; 700M-MAU clause
Qwen 3Apache-2.0 (most variants)Yes — check tokenizer/data licenses
Mistral / MixtralApache-2.0Yes
DeepSeekMIT (most variants)Yes — check per-variant
GemmaGemma Terms of UseSeparate commercial terms — read before shipping
Phi-4MITYes

Maintain this table per project. Lawyers will ask.