AI for Senior Software Engineers: A Practical 2-Week Learning Roadmap

You already know APIs, queues, and caches. Two weeks of LLM, RAG, tools, eval, and inference is enough to be AI-fluent in a senior interview — without becoming an ML researcher.

Page content

Alice has shipped Kafka consumers, fought cache stampedes, and designed APIs that survive retries. Then an interviewer asks how she would keep a support bot from inventing refunds.

The gap is not calculus. It is not “becoming an ML engineer.” It is knowing how a large language model (LLM) — a model that predicts the next piece of text — sits inside a real system: retrieval, tools, evaluation, cost, and failure.

You don’t need to become an ML engineer to become an AI-fluent senior software engineer.

This page is an AI learning path for that audience: a two-week LLM roadmap aimed at production AI system design and senior interviews. The conceptual companion is AI Fundamentals. Use that if a term here still feels thin. Use this page if you already think in services and need a schedule.

Why this is now a senior SWE skill

Staff interviews still test distributed systems. They also test whether you treat the model as a flaky dependency.

An LLM is not a database. It does not look up a row. It samples a continuation of tokens — the small chunks of text the model actually predicts. That continuation can be useful, expensive, slow, or wrong. The rest of the product has to assume all four.

You already own most of the system:

You already knowWhere it shows up in AI products
APIs, auth, idempotencyTool calls, refunds, “get order”
Databases and searchMetadata filters, hybrid retrieval
Kafka / queuesAsync embedding jobs, eval pipelines
CachingPrompt cache, embedding cache, semantic cache
Rate limits and backpressureToken budgets, GPU queues
ObservabilityTraces per generation, cost per request
Failure tablesProvider outage, tool timeout, empty retrieval

The new vocabulary is smaller than it looks: transformers, embeddings, vector search, retrieval-augmented generation (RAG), tool calling, agents, evaluation, inference, LLMOps.

Two weeks is enough to be dangerous in a good way — if you skip the wrong rabbit holes.

1. What you actually need to know

Depth here means “can you design and debug it,” not “can you derive it.”

TopicWhat you need to knowDepth required
LLM fundamentalsNext-token prediction, tokens, context window, temperature, hallucinationWorking model. Skip training from scratch.
TransformersSelf-attention as “which tokens matter for this token”; stacked blocksConceptual. Skip writing CUDA kernels.
AttentionQuery / Key / Value as a routing mechanismOne diagram you can redraw. Skip paper-level variants unless asked.
EmbeddingsVectors where nearby means related meaningUse them. Skip training your own embedding model at first.
Prompt engineeringInstructions, examples, output schema, what not to put in contextPractical. Not poetry.
RAGChunk → embed → retrieve → (rerank) → prompt → generateDesign depth. This is the default staff answer for “company knowledge.”
Vector databasesApproximate nearest neighbor, filters, rebuildsOperator depth. Same instincts as any index.
Tool / function callingModel emits a structured call; your code executes itSame as a well-designed API client, plus distrust.
AI agentsA loop: think → act → observe, with state and a stop conditionKnow why they fail. Do not ship an unbounded loop.
LLM evaluationGolden sets, faithfulness, online vs offlineTreat like SLOs, not unit-test green.
LLMOpsPrompt/model versions, traces, token cost, fallbacksYour existing on-call brain.
InferenceTraining vs serving, TTFT vs tokens/sec, batchingEnough to talk latency and GPUs. Skip compiler internals.
Model servingRouter, replicas, queuesSame as any expensive stateful worker pool.
GPUsMemory bounds the model; utilization bounds costOne mental model. Skip ISA details.
AI system designComponents, scale, degradationSame structure as the interview guide.
AI securityPrompt injection, tool authz, data leakageFail closed on money and PII.
CostTokens in/out, retries, agent steps, cache hit rateFirst-class requirement, not an afterthought.

You generally do not need, for this job:

  • advanced calculus;
  • deriving backpropagation;
  • training a frontier model from scratch;
  • a diet of arXiv.

Those matter if you are moving into ML engineering or research. They are a poor use of two weeks if the interview is “design a production assistant.”

2. The learning path

Each layer exists because the one above it was not enough.

Traditional backend engineer
LLM fundamentals          (what the model is doing)
Transformers              (why it can use the whole prompt)
Embeddings                (how you find related text)
RAG                       (how you ground answers in your docs)
Tool calling              (how you touch real systems)
Agents                    (how you chain those steps)
LLMOps                    (how you ship and watch it)
Inference and scaling     (why this is not ordinary HTTP)
AI system design          (the interview and the production box)

Alice can call an LLM on day 1. She cannot defend a 100-million-document RAG design until retrieval, staleness, and evaluation exist. She should not give the model a refund API until tool calling has authorization and idempotency. Agents come after tools because an agent is a loop over tools, not a smarter prompt.

3. Week 1 — fundamentals you will actually use

Plan for about two focused hours a day. Watch less than you think. Rebuild the diagram from memory.

Day 1 — Understand LLMs

Watch: Andrej Karpathy, Intro to Large Language Models (about an hour; recorded 2023, still the right mental model). Details in any one talk age; the “two files: weights plus run code” framing does not.

An LLM is a probability machine over tokens. You feed it a prompt. It produces the next token, then the next, until it stops.

Tokenization splits text into those tokens. “unhappiness” might be several tokens. Billing, context limits, and latency are all token counts, not word counts.

Embeddings (you will use them properly on day 3) are the numeric coordinates of tokens or chunks. Day 1: know they exist.

The context window is the working memory of one request: prompt plus generated tokens, up to a limit. It is RAM for this call, not a database.

Next-token prediction is the job. Chat products are the same job with a conversation-shaped prompt.

Temperature scales how peaked the next-token distribution is. Low: more repetitive, more “safe.” High: more variety, more nonsense. It is not a truth dial.

A hallucination is a fluent continuation that is not grounded in facts you accept. The model is doing its job. Your system is not.

Inference is running the trained model to generate tokens. Training is how the weights got there. You will almost always buy inference, not run training.

After day 1, you should be able to explain:

  • why “the model said it” is not a source of truth;
  • why a 4k-token reply can cost more than a 200-token one;
  • why stuffing a 200-page PDF into one prompt is a context-window problem, not an intelligence problem.

Day 2 — Understand transformers

Read: Jay Alammar, The Illustrated Transformer.

Optionally sample: Stanford CS25 — Transformers United recordings (a seminar, not a tutorial; speaker lineups change by quarter).

Older sequence models struggled to look far back in a sentence without forgetting, and they were hard to parallelize. Self-attention lets each token look at other tokens in the same sequence and decide which ones matter for the current prediction.

People describe that look-up with three learned projections:

  • Query — what this token is looking for;
  • Key — what each token advertises;
  • Value — what you actually mix in if it matches.

Multi-head attention runs several of those looks in parallel so one head can track syntax and another track “who is the customer.”

Positional information is added because attention itself does not know order. Without it, “dog bites man” and “man bites dog” collapse.

A transformer block is attention plus a small feed-forward network, stacked many times. The stack is why the model can build higher-level features from tokens.

Transformers became dominant because they train well on GPUs (lots of parallel matrix multiplies) and they use the whole context, not a shrinking hidden state.

tokens → embed + position
     ┌─────────────────┐
     │ self-attention  │  Q, K, V  (several heads)
     │ feed-forward    │
     └────────┬────────┘  × N blocks
     next-token probabilities

This site does not render Mermaid. The box above is the diagram to redraw on a whiteboard.

After day 2, you should be able to explain: why the model can use a retrieved paragraph at the bottom of the prompt, and why a longer prompt is more compute, not just more text.

An embedding is a list of numbers that represents a piece of text (or an image, later). Training pulls related meanings together in that space. “cancel order” and “void the purchase” can be close even when keywords differ.

Semantic similarity is usually a score such as cosine similarity: how aligned two vectors are. You do not need the linear-algebra proof. You need: high score ⇒ retrieve; low score ⇒ skip.

A vector database stores those vectors and answers “nearest neighbors of this query vector,” usually with approximate nearest neighbor (ANN) search. Exact search over 100 million vectors is too slow. ANN trades a little recall for latency.

HNSW (Hierarchical Navigable Small World) is one common ANN idea: a layered graph. Search starts coarse, then walks toward neighbors. Treat it like you treat a B-tree: you do not implement it in the interview; you know it is an index with rebuild and recall trade-offs.

Keyword search (BM25 and friends) wins on SKUs, error codes, and exact identifiers. Vector search wins on paraphrase. Production systems often run hybrid search: both, then merge. That is the same instinct as customer-facing search: retrieval is a ranking problem, not a single index type.

After day 3, you should be able to explain: when you would not use a vector database (the user typed ORD-99102).

Day 4 — RAG

RAG (retrieval-augmented generation) means: find relevant company text first, put it in the prompt, then generate. The model is still predicting tokens. The difference is the tokens can attend to evidence you supplied.

Alice’s naive assistant dumps the wiki into the prompt. The context window fills. Cost explodes. The answer still misses the one policy buried on page 40.

The production shape:

Documents
    → chunking (+ overlap)
    → embeddings
    → vector DB (+ metadata)
User question → embed query → retrieve k
              → rerank
              → prompt = instructions + evidence + question
              → LLM
              → answer (+ citations if you require them)

Chunk size is a systems choice. Too large: you retrieve noise. Too small: you lose the sentence that made the paragraph true. Overlap keeps a split sentence from dying on a boundary.

Metadata filters (“only policy, region=IN, updated after 2025-01”) are not optional at scale. They are the equivalent of a partition key.

Reranking is a second, usually smaller, model or scorer that reorders the retrieved pile. Cheap ANN gets you 50; the reranker picks 5 that actually enter the prompt.

Retrieval quality dominates generation quality. If the right chunk never arrives, the LLM will still speak. That speech is a hallucination with good manners.

Stale embeddings: the vector is a snapshot of the chunk at embed time. Update the document without re-embedding and you will retrieve yesterday. Deletes need the same discipline as cache invalidation — see distributed cache for stampede and stale-copy instincts. You can embed asynchronously off a queue; the dual-write trap (DB updated, index not) is the same problem as transactional outbox.

Citations / grounding: require the model to quote chunk ids you passed. If it cannot, refuse. That is a product rule, not a temperature tweak.

After day 4, you should be able to explain: the pipeline above, and which stage you would measure first when answers are wrong (hint: retrieval).

Day 5 — Tool calling

The model cannot query Postgres. It can emit a structured request that your service runs.

User
  → LLM  (chooses a tool + arguments)
  → schema validate
  → authorize
  → API / DB
  → tool result back into the prompt
  → LLM
  → final reply

Examples worth using in an interview:

  • search flight availability;
  • get order status;
  • refund an order;
  • fetch customer profile.

The LLM is a planner with a bad memory for policy. Schema validation rejects "amount": "all of it". Authorization is your code: the model does not get a god token. Idempotency on refunds is the same Idempotency-Key you already use. Retries and timeouts belong on the HTTP client, with a budget so a confused model cannot loop a paid API. Tool failure must return a typed error the model can narrate — not a stack trace, and not a silent success.

If the tool can move money, default to human-in-the-loop.

After day 5, you should be able to explain: why “the LLM called refund” is not an audit log, and what you store instead (actor, args, idempotency key, result).

Day 6 — AI agents

An agent is not “an LLM with vibes.” It is a loop:

while not done and steps < N and spend < budget:
    LLM proposes thought and/or tool
    execute tool or stop
    append observation

Planning is the model choosing the next act. State is the transcript plus any scratchpad you persist. Memory is whatever you write outside the context window (summaries, retrieved tickets). Multi-step execution is why a travel agent can search, then book. Human-in-the-loop is a tool that is “ask Alice.”

Why this is hard to operate:

  • infinite loops (search, search, search);
  • tool failures interpreted as “try a different tool that happens to be delete_user”;
  • wrong decisions with high confidence;
  • prompt injection (day 12) in a retrieved email;
  • authorization holes (the loop inherits one credential);
  • cost explosion (each step is tokens plus tools);
  • observability (you need the whole trace, not one HTTP 200).

Ship a single-tool assistant before you ship a free-roaming agent.

After day 6, you should be able to explain: the stop conditions you would put in code, not in the prompt.

Day 7 — Build a small app: AI documentation assistant

Do not build an agent platform. Build one path.

User
  → API (auth, rate limit)
  → retrieve
  → vector DB
  → rerank
  → LLM
  → stream tokens back

Implement:

  1. Ingest a folder of markdown. Chunk, embed, store vectors plus {path, heading}.
  2. Query: embed the question, retrieve, rerank, prompt with “answer only from these chunks; if missing, say you don’t know.”
  3. Stream the completion. Log prompt version, model id, token counts, retrieved chunk ids.
  4. Ten golden questions with expected citations. Fail the build if faithfulness drops.

That is enough to make week 2’s evaluation and LLMOps feel real. Rate-limit the API the way you would any expensive POST — the rate limiter walkthrough applies, with tokens as the unit, not only requests.

4. Week 2 — production AI engineering

Day 8 — LLM evaluation

assert response == "42" dies on language. Two correct answers can differ by wording. You still need tests. They look like eval suites, not one snapshot string.

Measure, separately:

SignalWhat it catches
CorrectnessDid we solve the user task?
RelevanceDid we answer this question?
FaithfulnessDid we stick to retrieved/tool evidence?
HallucinationFluent claims with no support
Retrieval qualityWas the right chunk in the top k?
LatencyTTFT and total time
CostTokens and tool spend

A golden dataset is a versioned set of inputs plus labels (expected answer, must-cite doc, must-not-refund). Offline eval runs on every prompt/model change. Online eval samples live traffic (thumbs, downstream “did they reopen the ticket”). Human eval is still the calibration for the rest. LLM-as-a-judge is another model scoring the first — useful, biased, and never the only gate for refunds.

Example: “Can I return a headset after 20 days?” Golden: cite returns.md §2, answer no. If retrieval missed returns.md, score retrieval fail even if the LLM guessed correctly.

After day 8, you should be able to explain: which metric moves when you change chunk size versus when you change the model.

Day 9 — LLMOps

LLMOps is production hygiene for prompts and generations. It is not a new religion.

Version prompts like config: id, text, hash, who shipped it. Version models the same way (gpt-x-2026-03-01 is not a permanent alias in your head). Trace one user request across retrieval, tools, and tokens. Count tokens and USD. Track latency histograms, not only averages. Rate-limit by user and by model. Keep a fallback model. Cache identical prompts and, carefully, similar questions.

A production request should leave something like:

trace_id=...
prompt_id=docs_v14
model=provider/model@rev
retrieve: k=20, rerank=5, chunk_ids=[...]
tokens_in=1800 tokens_out=240
ttft_ms=320 total_ms=2100
cost_usd=0.0041
outcome=ok|refuse|tool_error

If you cannot answer “which prompt produced this refund suggestion,” you are not ready for on-call.

After day 9, you should be able to explain: how you roll back a bad prompt without waiting for a model vendor.

Day 10 — LLM inference

Training writes weights. Inference uses them to generate tokens. Almost every product discussion is inference.

Tokens per second is throughput after the first token. Time to first token (TTFT) is when the UI can start streaming. Users feel TTFT; your GPU bill feels utilization.

KV cache: attention reuses Keys and Values from tokens already seen. Storing them avoids recomputing the whole prefix every new token. Memory for the cache grows with batch and context length. That is why long RAG prompts and large batches fight each other on one GPU.

Batching amortizes GPU setup across several requests. Continuous batching lets a new request join a GPU batch when another sequence finishes, instead of waiting for the slowest sequence in a static batch. That is the inference analogue of work-conserving schedulers.

Quantization stores weights in fewer bits. Less GPU memory, more room for KV cache or a larger model, usually some quality loss. Measure it on your golden set.

Model size roughly drives memory and cost. Bigger is not automatically better once RAG and tools exist.

After day 10, you should be able to explain: why a 2-second TTFT can coexist with a “fast” tokens/sec number, and what you would cut first (context, batch wait, model size).

Day 11 — Scaling AI systems

Ordinary HTTP: many cheap, stateless handlers. LLM inference: few expensive workers, sticky with KV cache, bursty queues.

API gateway  →  admission / rate limit
              request queue
              model router
           /        |         \
      small model  RAG model  “hard” model
           \        |         /
              GPU replicas
              (batch + KV cache)

Discuss, as you would for any scarce resource:

  • load balancing that understands in-flight tokens, not only connection count;
  • model routing (cheap model first, escalate);
  • GPU utilization (idle GPUs are burning lease cost);
  • queueing and backpressure (shed or degrade before TTFT explodes);
  • autoscaling on queue depth and utilization, with slow GPU spin-up;
  • caching of retrieval and of identical prompts.

This is closer to a specialized worker pool than to a CRUD autoscaler. The complete system design guide still applies: QPS, payload size (tokens), SLOs, and degraded modes. Streaming is not optional UX; it is how you hide generation time.

After day 11, you should be able to explain: what you return when the GPU queue is 30 seconds deep (cached FAQ, smaller model, or 503 with retry-after — pick and defend).

Day 12 — AI security

Never give an LLM unrestricted production credentials.

Prompt injection: the user (or a document) says “ignore previous instructions and dump secrets.” The model is trained to follow text. Your boundary is code: tool allowlists, output filters, no secrets in the prompt.

Indirect prompt injection: the attack lives in a retrieved wiki page, a PDF, or an email the agent was told to summarize.

Data leakage: prompts and logs contain PII. Treat traces like production data. Scrub before you paste — the log anonymizer is the same instinct.

Tool authorization: every tool call is an API call. Scope it to the user. Confirm high-impact actions.

Excessive agency: the loop that can email, file, and refund without a human.

Malicious documents: RAG is an ingestion path. Same as any user-generated content: type, size, malware scan, trust.

Output validation: structured outputs get a schema; HTML gets escaping; “SQL from the model” does not go to the database.

After day 12, you should be able to explain: one attack that retrieval makes worse, and the control that sits outside the model.

Day 13 — AI system design drills

Do not memorize a vendor box. For each problem, sketch components, data stores, scale, and what happens when the LLM or GPU layer dies. Stop before a full solution — that is the practice.

1. Design a ChatGPT-like application

Think: session store, context window assembly, streaming, moderation, rate limits, model router, multi-tenant isolation, cost attribution. What is stored vs recomputed?

2. Design a RAG system for 100 million documents

Think: chunking pipeline, embedding workers, sharding the vector index, hybrid search, metadata, incremental updates, re-embed jobs, retrieval SLOs, cache of popular queries. What is the source of truth — the documents or the vectors?

3. Design an AI customer-support agent

Think: identity, ticket history, tools (order, refund), human handoff, policy RAG, audit log, eval on “must not refund.” Compare to a ticket system: the agent is another client, not a new source of truth.

4. Design an AI coding assistant

Think: repo indexing vs on-demand file fetch, context packing, secret scanning, diff application, eval on tests, latency. The workspace is untrusted input.

5. Design an AI travel agent

Think: search vs book, inventory APIs, idempotent booking, payments, cancellation, multi-step state, what is allowed without a human. Inventory lies; the LLM will not fix that.

After day 13, you should be able to explain: for any one of these, the source of truth, the model’s job, and the first degraded mode.

Day 14 — Interview preparation

Answer in the same shape as a backend design: requirement, constraint, decision, trade-off. Name the invariant.

1. How does a transformer work?
Tokens become vectors. Self-attention lets each position mix information from others via Q/K/V. Stacked blocks; then next-token probabilities. Skip deriving softmax unless pushed.

2. What is RAG?
Retrieve evidence, put it in the prompt, generate. Fixes knowledge that should not live only in weights. Fails if retrieval fails.

3. Vector database vs traditional database?
Vectors answer “near this meaning.” OLTP answers exact keys and transactions. Use both; filters often live in the ordinary DB or as metadata on the vector index.

4. How would you scale an LLM application?
Separate app tier from GPU/model tier. Queue, batch, route, cache, shed load. Tokens and GPUs, not only RPS.

5. How would you reduce LLM costs?
Shorter prompts, smaller models, cache, RAG instead of huge context, fewer agent steps, don’t retry blindly, quantization if quality holds.

6. How would you evaluate an LLM application?
Golden set + retrieval metrics + faithfulness + online sampling. LLM-as-judge is an assistant, not the court.

7. How do you prevent hallucinations?
Ground with RAG/tools, refuse when evidence is missing, constrain tools, lower temperature for factual paths, cite or shut up.

8. How do AI agents work?
A bounded loop over an LLM plus tools plus state. The product is the loop limits.

9. How would you securely give an LLM access to APIs?
Allowlist tools, per-user authz, schema, idempotency, human approval for irreversible actions, never a static admin credential in the prompt.

10. How would you design a production AI customer-support system?
Identity, RAG over policy, tools into order systems, handoff, audit, eval. LLM is not the ticket database.

11. How would you handle an LLM provider outage?
Fallback model, cached answers for common intents, queue with backpressure, feature flag to “search only,” communicate degradation.

12. How would you reduce inference latency?
Stream, cut context, smaller/faster model, warm pools, KV-cache-aware batching, retrieve less junk.

13. How would you handle a 100M-document RAG system?
Async index pipeline, sharded ANN, hybrid search, metadata partitions, incremental re-embed, measure recall@k.

14. When would you fine-tune instead of using RAG?
Stable style, format, or tool-calling behavior. Not for weekly policy changes. Fine-tune is a new artifact to eval and serve.

15. How would you monitor an AI application?
Traces, token/cost, TTFT, retrieval hit quality, tool error rate, thumbs, safety refusals, prompt/model versions on every event.

For the non-AI hour of the loop, drill system design interview questions.

5. Free resources (for this audience)

Course pages and recordings change. Prefer the official sites below; if a quarter’s Zoom link dies, the recordings page or playlist is the durable entry.

ResourceWhat it teachesWho should use itPriority
Karpathy — Intro to Large Language ModelsWhat an LLM is, inference vs training, security instinctsEveryone on day 1High
The Illustrated TransformerAttention and transformer blocks, visuallyDay 2High
Full Stack Deep Learning — LLM BootcampPrompting, LLMOps, shipping an app (recordings from the 2023 bootcamp; tooling will have aged)Week 2 framingHigh
Stanford CS25 recordingsGuest lectures on transformers and adjacent researchAfter the basics; pick talks, don’t bingeMedium
Stanford CS336Language modeling from scratch (data, training, systems)Only if you are moving toward ML/infra training workLow for this two-week plan

These are strong matches for senior engineers learning to build with models. They are not a ranked “best courses on earth” list.

6. What not to spend these two weeks on

A classical ML survey is useful in a career. It is the wrong on-ramp for “AI-fluent senior backend.”

Skip, initially:

  • weeks of linear/logistic regression, trees, SVMs;
  • CNN architecture tours;
  • deriving gradient descent;
  • training neural nets from scratch “for the experience”;
  • reading hundreds of papers.

Your calendar is better spent on RAG, tools, agents (bounded), inference, evaluation, LLMOps, security, and AI system design — the path above.

If an ML-engineer job is the actual target, invert this list and use CS336. Do not invert it for a staff backend loop that added “how would you add an assistant?”

7. Senior SWE AI cheat sheet

LLM — A model that assigns probabilities to the next token given previous tokens. Chat UIs are a prompt format around that.

Token — A chunk of text the model reads and writes. Limits and bills are in tokens.

Embedding — A vector representation of text (or other data) used for similarity search.

Transformer — The dominant neural architecture for LLMs; stacked attention plus feed-forward blocks.

Attention — A way for each token to weight other tokens in the context when computing the next representation.

Context window — Maximum tokens of prompt plus output for one inference call.

Inference — Running a trained model to produce tokens (as opposed to training).

RAG — Retrieve relevant documents, add them to the prompt, then generate.

Vector database — A store optimized for nearest-neighbor search over embeddings.

Reranker — A second-stage scorer that reorders retrieved candidates before they enter the prompt.

Tool calling — The model emits a structured function call; your application executes it and returns the result.

Agent — A loop that repeatedly calls an LLM and tools until a stop condition.

Fine-tuning — Further training on your data to change model behavior. Heavier than RAG for changing facts.

Prompt engineering — Designing instructions, examples, and constraints in the context window.

LLMOps — Versioning, observing, evaluating, and operating prompts, models, and generations in production.

KV cache — Cached attention keys/values for tokens already processed, so generation does not recompute the whole prefix.

Quantization — Storing weights (and sometimes activations) in fewer bits to save memory and often increase throughput.

Inference latency — End-to-end time to finish a generation (often split into TTFT and decode).

TTFT — Time to first token; when streaming can start.

Hallucination — A fluent model output that is not supported by accepted evidence.

Prompt injection — Untrusted text that tries to override system instructions or abuse tools.

8. How the pieces fit

                User
                  |
             API Gateway
                  |
          Application Layer
                  |
    +-------------+-------------+
    |             |             |
Conversation    Retrieval      Tools
   State           |             |
    |          Vector DB      APIs/DBs
    |              |
    |          Reranker
    |              |
    +------- Prompt Builder
                   |
             Model Router
                   |
          +--------+--------+
          |                 |
      LLM Provider      Self-hosted LLM
          |                 |
          +--------+--------+
                   |
               Response
                   |
           Observability
           /     |      \
       Logs   Metrics   Traces
                   |
               Evaluation

API gateway — Auth, rate limits, TLS. Same as any public API. Fail closed on identity.

Application layer — Orchestrates one request. No weights live here.

Conversation state — Session transcript in a real database. Cap what you reload into the context window.

Retrieval / vector DB / reranker — Grounding. Source of truth is documents; the index is derived. Rebuild and lag are operational facts.

Tools — The only path to side effects. Authz, idempotency, timeouts.

Prompt builder — Deterministic assembly: system rules + evidence + user + tool results. Versioned.

Model router — Cheap vs capable vs self-hosted. Includes fallback when a provider 5xxs.

LLM provider vs self-hosted — Latency, data residency, cost, control. Many designs use both.

Response path — Stream when you can; validate structure before tools fire.

Observability — Logs, metrics, traces on generations, not just HTTP.

Evaluation — Offline gates plus online sampling. This is how you know a prompt change was a regression.

Scaling and reliability: GPU/model replicas are the scarce pool; the app tier scales like ordinary stateless services. Queue when inference is saturated. Degrade to retrieval-only or human handoff. Never let a provider outage take down “get order status” if that tool can run without the LLM.

The compact model:

The LLM predicts tokens. Your system supplies evidence, executes tools, bounds the loop, measures quality, and survives the model being wrong, slow, or gone.

That is AI fluency for a senior software engineer. Two weeks is enough to start answering like one. The rest is the same craft you already have: clear requirements, honest failure modes, and an architecture you can operate.