← All news

News / Learn / LLM fundamentals

What is a large language model?

You'll be able to explain what a large language model is and how it turns text into a reply.

A large language model is a program trained to predict the next piece of text. You give it some text, and it writes more, one small piece at a time. It learns this skill by reading huge amounts of written material and adjusting its internal numbers until its guesses get good.

Almost every AI product you build sits on top of one of these models. If you understand what the model actually does, you can predict where it will be strong and where it will fail. That shapes your design, your costs, and what you promise users.

A language model reads text as a sequence of tokens, which are small chunks such as words or word parts. It converts each token into a list of numbers. Layers of math then mix those numbers together, so the model can weigh which earlier words matter for the current one. This mixing step is usually called attention, and it is the core of the transformer design most models use.

Training works by hiding the next token and asking the model to guess it. When the guess is wrong, the training process nudges the model's internal settings a little toward the right answer. Repeat this across a very large body of text and the model picks up grammar, facts, reasoning patterns, and styles, all as a side effect of predicting well.

At use time, the model runs in inference mode. It takes your input, predicts one token, adds that token to the input, and predicts again. This loop continues until it produces a stop signal or hits a length limit. The output is not looked up from a database. It is generated fresh each time.

Because the model only predicts likely text, it can sound confident while being wrong. It has no built-in check that a statement is true. Treat its output as a draft that needs verification when accuracy matters.

A minimal call to a chat model. The exact client library depends on the provider, so this sketch uses a generic HTTP request.

import os
import requests

API_URL = os.environ["LLM_API_URL"]
API_KEY = os.environ["LLM_API_KEY"]

response = requests.post(
    API_URL,
    headers={"Authorization": f"Bearer {API_KEY}"},
    json={
        "messages": [
            {"role": "user", "content": "In one sentence, what is a token?"}
        ]
    },
    timeout=30,
)
response.raise_for_status()
print(response.json())

A short sketch to show the idea. Check the official docs of the tool you use.

  • Treating output as verified fact The model generates likely text, not checked text. Add a verification step, such as a lookup against your own data, before users rely on a factual claim.
  • Assuming the model knows recent events A model only knows what was in its training data. Supply current information in the prompt or through retrieval instead of trusting its memory.
  • Expecting identical answers every time Generation is probabilistic. Run the same input twice and you may get different text. Design your product and tests to tolerate variation.
  • Ignoring that it reads and writes tokens, not characters Costs, limits, and length checks are measured in tokens. Measure with the provider's tokenizer rather than counting words or characters.

Read about tokens and context windows next. Then look at how training and inference differ in cost and speed. Those two topics explain most of the practical limits you will meet when building.

Is a large language model the same as a chatbot?

No. A chatbot is an application. A large language model is the engine inside many chatbots. The same model can power a chat window, a summarizer, a code helper, or a search feature.

Does the model look things up on the internet?

Not by default. It generates text from patterns learned during training. Some products add search or retrieval tools so the model can read fresh sources, but that is a separate system around the model.

Why does it sometimes make things up?

The model is trained to produce plausible text. When it lacks solid information, it can still produce a fluent answer that is false. This is called hallucination, and it is a known property of these systems.

Does the model remember my past conversations?

Not on its own. Each request is processed from the text you send. Any memory across sessions comes from the application storing and resending earlier messages or summaries.

Do I need to understand the math to build with it?

No. You need a working mental model: it predicts text, it uses tokens, it has limited input size, and it can be wrong. That is enough to design good products.

Written with AI by CapyLaunch. Spotted a mistake? Email hello@capylaunch.com.