Educatifu
Open menu

Using LLMs well — limits, context and cost

The expert's edge isn't just knowing how models work — it's knowing what they can't do, and the practical levers that decide whether a system works in production.

ExpertArtificial Intelligence~14 min

Before this lesson

  • Lesson: From base model to assistant

Understanding how a model is built is half of expertise. The other half is a clear view of what it cannot do, and the levers that make real systems work. This lesson is the practitioner's mental model.

Hallucination is structural, not a bug

A language model is trained to produce plausible continuations, not true ones. When it doesn't know something, it does not know that it doesn't know — it generates the most likely-sounding answer, which can be confidently wrong. This is hallucination, and it follows directly from the next-token objective. You cannot prompt it away entirely. You manage it:

  • Ground the model in source text (see retrieval, below) and ask it to answer only from that.
  • Ask for citations you can check.
  • Keep a human in the loop for consequential decisions.

The context window is working memory

A model has no memory between calls. Everything it "knows" in a conversation must fit in its context window — the span of tokens it can attend to at once (prompt + conversation + any documents you include). Two consequences:

  • Retrieval-Augmented Generation (RAG) — instead of hoping facts are baked into the weights, fetch the relevant documents (often by embedding similarity, from the Core lesson) and place them in the context so the model answers from current, specific, verifiable sources.
  • Prompting is context engineering — what you put in the window, and how you structure it, is often the difference between a good and a useless answer.

Cost and latency scale with tokens

Every token in and out costs computation, money and time; attention cost grows with sequence length. Production work is largely about efficiency per token: concise prompts and retrieved context rather than dumping everything in; choosing a smaller model where it suffices; caching; and streaming output so users see progress. A system that is correct but too slow or too expensive does not ship.

The whole track, in one view

You have travelled the full arc:

  • a neuron — a weighted sum and an activation;
  • stacked into networks, trained by gradient descent and backpropagation;
  • taught to generalise, not memorise;
  • fed language through embeddings and given context by attention;
  • pretrained to predict the next token, then aligned into an assistant;
  • and finally used well, with clear eyes about its limits.

That is modern AI, from scratch to the frontier. Everything beyond — multimodal models, agents, tools, ever-larger scale — is built on exactly these foundations.

Key takeaways

  • Models predict plausible text, not truth — hallucination is a property of the objective, mitigated (not cured) by grounding.
  • The context window is the model's working memory; retrieval (RAG) and good prompting decide what goes into it.
  • Inference cost and latency scale with tokens; the practical craft is getting more capability per token.

← All Artificial Intelligence lessons

Bring us the problem, not a perfect specification

Tell us what needs to change, who it affects and any important deadline. We will review the context and reply with useful next questions.

  1. 01Share contextDescribe the workflow, constraint or risk.
  2. 02Clarify togetherWe identify missing facts and useful options.
  3. 03Choose a startAgree a focused assessment or delivery step.
Start a conversation