Skip to content
49 / Answers

An LLM predicts the next token. Everything else follows.

A large language model is a transformer neural network with billions of parameters, trained on an enormous amount of text to predict the next token. From that one objective, plus a tuning stage that makes it follow instructions, come chat, summarisation, code, reasoning and tool use. Knowing what it is tells you how it fails and how to test it.

Stands for
Large language model
Does
Predicts the next token, very well
Steered by
System prompt, examples, tools, retrieval
Tested with
Evals on your own inputs, not vibes
  • 5production AI apps
  • 14engineers led
  • 200+students mentored
01

Questions students ask

The LLM questions searched most, answered from building on them daily.

What does LLM stand for?

Large language model. Large because of the parameter count, from a few billion to over a trillion, and the training data, trillions of tokens of text. Language model because the underlying task is modelling the probability of text: given a sequence of tokens, what comes next. The term became common around 2020 when scaling such models produced abilities that smaller ones lacked. (In law, LLM is a master's degree; search results mix them.) In AI it means the models behind ChatGPT, Claude, Gemini, Llama and their peers.

What are LLMs?

LLMs are neural networks built on the transformer architecture that take text in as tokens and produce text out, one token at a time. A base model is trained on a large slice of the written internet, books and code to predict the next token; it learns grammar, facts, styles, reasoning patterns and programming in the process. An instruct or chat model is the base model after further training to follow instructions and prefer helpful, safe answers. Multimodal variants also accept images and audio. They are available as hosted APIs from providers and as open-weight models you can run yourself.

How LLM works

Text is split into tokens, each mapped to a vector. Those vectors pass through dozens of transformer layers, where attention lets every token gather information from every other token in the context, and feed-forward layers transform the result. The final layer outputs a probability for every token in the vocabulary as the next one. The model samples a token, appends it, and repeats until it emits a stop token. Everything the model knows is encoded in its weights, learned during training; everything it is told for this request is in the context window. It has no memory between requests unless the application supplies one.

What is system prompt in LLM?

The system prompt is the instruction text placed at the start of the conversation that sets the model's role, rules, tone and constraints before any user message: 'You are a support assistant for product X. Answer only from the provided documents. Cite sources. If the documents do not answer, say so.' Chat models are trained to give it priority over user messages. In applications it carries the behaviour specification, the output format, the tool descriptions and often the retrieved context. It is the most important piece of prompt engineering in a product, it should be versioned and tested, and it is also what attackers try to override with prompt injection.

What is function calling in LLM?

Function calling (tool calling) lets a model request that your code run a function. You describe available functions in the request, name, purpose and a JSON schema of arguments; the model, instead of answering in prose, can return a structured call such as get_weather with city set to Lucknow. Your application executes it, returns the result as a tool message, and the model continues with that information. The model never runs anything itself; it only asks. This is how LLMs read databases, search documents, call APIs and act in the world, and it is the foundation of agents and of the Model Context Protocol.

How does tool calling work in LLMs?

  • You send the conversation plus a list of tool definitions with schemas.
  • The model decides whether a tool is needed; if so it emits a tool-use block with the tool name and arguments as JSON, often while streaming.
  • Your code validates the arguments, runs the function, and sends the result back as a tool-result message.
  • The model reads the result and either calls another tool or writes the final answer.
  • Limits, timeouts and logging around the loop keep it safe; argument validation against the schema catches malformed calls.
  • The model was trained on examples of this pattern, which is why it formats calls correctly; descriptions of the tools determine how well it chooses among them.

What are LLM evals?

Evals are evaluations: a fixed set of inputs with expected outputs or grading criteria, run against a model or an application to measure quality in numbers. For a product, the inputs come from real usage; the grading is exact match or schema validity for structured tasks, a rubric for free text (applied by humans or by a model judge validated against humans), and retrieval metrics for RAG. Evals are what turn 'it seems better' into 'faithfulness rose from 0.91 to 0.96 and latency held'. Every pipeline I ship has an eval set in CI, because a prompt or model change that looks harmless can break a case that mattered.

How to test LLM applications

Test the application, not only the model. Unit-test the deterministic parts: chunking, retrieval, parsing of tool calls, schema validation, prompt templates. Build an eval set of real inputs with expected outputs and run it on every change, with temperature at zero where possible so results are repeatable. Add adversarial cases: prompt injection in retrieved documents, inputs that should be refused, malformed data. Test the failure paths: what happens when the model times out, returns invalid JSON or calls a tool with bad arguments. Log production traffic with outputs and user feedback, and feed failures back into the eval set. The RAG.NextUpgrad test suite follows this shape.

What is LLM security?

LLM security covers the new attack surface language models add to software. Prompt injection: text in a document, web page or user message that instructs the model to ignore its rules, leak data or call tools it should not. Data leakage: secrets or other users' data appearing in outputs. Over-privileged tools: a model that can send email or delete records when it only needed to read. Insecure output handling: trusting generated code or HTML. Supply chain: models and adapters from untrusted sources. Defences are familiar engineering: least-privilege tools, validation of every tool argument, treating all retrieved and user text as untrusted data, human confirmation for consequential actions, and tests for injection in the eval set.

How to become LLM engineer

Build on the models until you understand them from the outside. Learn Python and web services. Build a retrieval-augmented assistant with citations and an eval set; build a tool-using agent with strict limits; fine-tune a small open model and compare it honestly with the base. Learn the cost and latency side: token counting, caching, streaming, routing between models. Learn the security side above. Publish the projects with write-ups, and prepare for interviews with the kinds of questions teams actually ask, which I collected in the GenAI interview guide. The title varies, LLM engineer, GenAI engineer, AI engineer, but the portfolio that gets the job is the same.

02

Use an LLM well

Four habits that separate demos from products.

  1. 01

    Specify in the system prompt

    Role, rules, format, refusal conditions; versioned and tested.

  2. 02

    Ground it

    Retrieve the facts; tell it to answer only from them and to cite.

  3. 03

    Constrain the tools

    Few tools, clear descriptions, validated arguments, confirmation for anything consequential.

  4. 04

    Eval everything

    A labelled set in CI; adversarial cases included; production failures fed back.

03

In the room

Where these systems get explained to students.

Building on LLMs and want it to hold up?

I design the prompts, tools, evals and guardrails that make a model safe to ship.