← ALL GUIDES

GUIDE · AI CONCEPTS

10 AI Concepts Every JavaScript Engineer Should Know

You always fear things you don't understand. Developers watch AI hype on YouTube and conclude learning is pointless. It isn't. This guide breaks the AI ecosystem into ten concrete mental models, from the **model spec** to **model distillation**.

The goal is first-principles thinking, not hype. Learn the vocabulary, understand what each technique actually does under the hood, and you stop being afraid of being replaced by an **LLM** tomorrow.

THE CONCEPTS

The mental models, one by one

  1. 01

    The Model Spec: Software as a Projection of Specs

    The model spec idea, released by OpenAI: stop writing code, write specifications. You put your specs in markdown files — from high-level rules like 'assume best intentions' down to which library to use — and an agent generates the software from them. Software becomes a projection of the specs, the way the UI in React is a function of state and props.

    Projection is a deterministic operation. A compiler transpiling JavaScript to machine code, React building the DOM, a vector projected onto a plane — same input, same output, no randomness. Civilization runs on deterministic systems: engines, CPUs, banking software. Nobody trusts an elevator that failed even once.

    LLM code generation is not that. Whatever the agent or model, output is at best an interpretation of the context provided, and different models interpret the same specs differently. Randomness and hallucinations are not a bug of large language models — they are the main feature. That is the gap between the pitch and the practice.

    model specdeterminismLLMcode generation
  2. 02

    Context Engineering

    Prompt engineering died; context engineering replaced it. The claim: you get bad AI results because you feed it too little. So you feed it everything — specs, rule files like Cursor rules or Claude files, your indexed codebase, documentation sites, internal docs, existing tests — vectorize it all and pass it to the LLM.

    It works better than a bare prompt, but calling it engineering is generous. It is context stuffing, made possible only because context windows exploded. And as the next concept shows, more context is not free.

    context engineeringpromptingLLM
  3. 03

    Context Rot: Bigger Windows, Worse Answers

    Context windows got huge. Gemini 1.5 Pro takes 2 million tokens. A token is roughly 3 to 4 characters — a debounce function is about 51 tokens, and 2 million tokens is four copies of Cracking the Coding Interview in a single prompt. Most companies have less written-down process than that.

    So the window looks like a solved problem. It isn't. Model performance decreases as you add tokens, and it decreases exponentially — context rot. Accuracy is much better when the context is small.

    Which puts you back at square one: it is easy to get an LLM to write code, and extremely hard to get one to build software.

    context windowtokenscontext rot
  4. 04

    Retrieval Augmented Generation (RAG)

    RAG solves a real problem: the model was trained on React 18, but you want React 19 answers, not class components. Instead of prompt-to-model directly, you build a context store — your company's docs, your product specs — and vectorize it.

    When the user asks something, a secondary model embeds the prompt, runs semantic search to find similar content in the store, and stitches it into a bigger prompt. The LLM answers with knowledge it was never trained on.

    This is a genuinely good technique, and likely the future of AI in the enterprise. The good news: building this kind of system requires knowing a lot of software development, not a lot of AI.

    RAGembeddingssemantic searchvector store
  5. 05

    Agentic Coding: A Recursive LLM in a While Loop

    Strip the hype and an agent is a recursive self-calling LLM. It makes a pseudo plan, extracts a success criteria from your prompt — that is the base case — and keeps querying itself, or a sub-agent, until it thinks the criteria is met. Pretty much a while loop around a model.

    Look under the hood of Claude Code and you find prompts — literal English instructions like 'when you have completed a task, you must run the lint and type check commands.' Telling a statistical machine what to do in English means repeating clauses over and over, like teaching a child, with no guarantee it complies. It only works because a 200,000-token context window makes all that repetition affordable.

    English as a programming language is not a new idea, and Dijkstra called it decades ago: machines programmed in native tongues would be as damn difficult to make as to use. High-level languages exist precisely because we wanted something English-like but precise and deterministic. Programming languages are an evolution of English, not the other way around.

    agentsClaude CodepromptsLLM
  6. 06

    MCP: Model Context Protocol

    MCP is Anthropic's open standard for connecting models to external services: an MCP client used by the model, and an MCP server wrapping your existing API. The model wants to query Google Maps on your behalf — it calls the client, which calls the server, and the answer comes back digested. Because it is a universal standard, OpenAI and the others comply too: swap models, keep the same servers.

    Under the hood it is familiar: JSON-RPC — remote procedure calls, around since the 90s, the same idea as tRPC. It combines resource-style access with callable functions on one server, adds per-tool descriptions the model consumes, and supports native HTTP streaming for token traffic.

    The honest take: we already had REST and GraphQL with description fields and the OpenAPI standard for defining what endpoints do. MCP is a glorified REST API with RPC bolted on — real standardization value, but technically underwhelming. Nobody cared at launch; Anthropic built the first ten or twenty servers themselves before it blew up.

    MCPJSON-RPCRESTOpenAPI
  7. 07

    Chain of Thought

    Reasoning models appear to break tasks down like humans: query one and it shows you steps before the answer. Chain of thought blew up when DeepSeek came out. But the AI companies themselves found the visible steps are a placeholder: inject specific solution steps into the prompt and they never appear in the displayed reasoning, even when they are part of the answer.

    Under the hood the model is still doing token prediction. The visible steps are generated by a helper LLM and constructed for you, the human, to feel like the model is thinking sequentially. Ask GPT itself: it will tell you chain of thought is not a transcript of its internals.

    Mental model: it is a fancy loading indicator.

    chain of thoughtreasoning modelstoken prediction
  8. 08

    Test-Time Compute

    Test-time compute: the model generates three to five candidate solutions, an internal reward model ranks them, and it iterates until it settles on the best-ranked output. Sold as a major breakthrough, and the term shows up in every AI talk.

    Then DeepMind measured it. For easy questions — the colors of the US flag — accuracy improves. For hard problems like math, it is actually detrimental. Another technique that makes sense for certain problems with certain models, not a jet-engine leap.

    test-time computereward modelDeepMind
  9. 09

    LCM: Large Concept Models

    The LCM, from Meta, changes the unit of thought. Instead of parsing text into tokens, turning those into embeddings, and predicting the next token, the model represents the world in concepts.

    It is early stage, but it is the most interesting item on this list: a step past the LLM toward machines that can break down concepts and actually help humans work. One to keep an eye on.

    LCMMetatokensembeddings
  10. 10

    Model Distillation

    Model distillation: a big teacher model trains a small student model. It is how many claim DeepSeek copied ChatGPT — ask DeepSeek who it is and it used to answer 'ChatGPT.'

    The numbers make the case: a distilled Qwen 2.5 hits 85.6% accuracy; the full model buys you roughly 3 more points at ten times the size. Diminishing returns in accuracy mean you have to verify the output anyway — so run the model that is ten times cheaper. Smaller models are the future.

    The plateau confirms it. GPT-5 landed disappointing: slightly better, nicer UI, web search and reasoning bolted on, but it feels like the models from a year or two ago. Like the combustion engine, the field had its burst of innovation, scaled vertically, and hit the flat part of the curve.

    distillationteacher-studentsmall models
A preview of the free Senior training

Free Senior Training.

One session, the whole system: the fundamentals, the interview strategy, and the plan to the offer. Watch it free.