Skip to main contentSkip to user menuSkip to navigation

LLM Models & Families

Explore LLM model families: GPT, BERT, Claude, and others - their architectures, capabilities, and use cases.

30 min readIntermediate
Not Started
Loading...

What is a large language model?

A large language model (LLM) is a neural network trained to predict tokens in sequences. A token may be a word, part of a word, punctuation, or another encoded unit. During generation, the model repeatedly estimates what token should come next, samples or selects one, appends it to the context, and continues.

In plain language: an LLM is a powerful pattern model for language and other tokenized data. It can draft, transform, classify, summarize, reason over supplied context, and call tools, but its next-token objective does not guarantee truth, policy compliance, or successful task completion.

The core production invariant is:

Product behavior comes from the complete model bundle and request path, not from a model name alone. The base weights, adaptation, prompt, retrieved evidence, tools, decoding settings, safety controls, runtime, and release policy all affect the result.

Tokens

Input and output units

The tokenizer defines how text or other inputs become model-readable IDs.

Weights

Learned parameters

Pretraining adjusts numerical parameters to reduce prediction error.

Context

Request-time state

Instructions, examples, evidence, tool results, and prior turns condition generation.

Evidence

Release requirement

Representative quality, safety, latency, and cost tests decide whether a bundle ships.

Follow the model through its full lifecycle

An LLM is not created by one training job and then dropped into an API. Its lifecycle connects data decisions, optimization, adaptation, serving, and evaluation. A failure at any stage can appear later as a wrong answer, unsafe behavior, excessive latency, or an unmanageable rollback.

  1. 1

    Data contract

    Define and curate data

    Select lawful, relevant sources; remove harmful or low-value duplication; define mixtures, filters, provenance, and holdout boundaries.

  2. 2

    General capability

    Pretrain a base model

    Optimize token prediction over large corpora while tracking loss, data quality, compute use, contamination, and checkpoint health.

  3. 3

    Product fit

    Adapt behavior

    Use prompts, retrieval, supervised examples, or preference data to satisfy a task without making change more persistent than necessary.

  4. 4

    Runtime

    Serve token generation

    Schedule prefill and decode work, manage per-request attention state, enforce quotas, call tools, and validate outputs.

  5. 5

    Release loop

    Evaluate and operate

    Gate versions on task, safety, latency, cost, and failure evidence; monitor drift and keep a tested rollback path.

A model family is a set of compatible bundles

A family may include base and instruction-tuned checkpoints, multiple sizes, quantized variants, multimodal versions, adapters, tokenizers, and runtime-specific packages. Compare the exact bundle you can deploy. Two checkpoints with a shared family name can have different context contracts, tool behavior, memory needs, licenses, and failure profiles.

Pretraining learns a distribution, not a fact database

Autoregressive pretraining presents a sequence of tokens and asks the model to predict the next token. The training system compares predicted probabilities with the observed token, computes a loss, and updates weights through backpropagation. Repeating this over diverse sequences creates reusable representations and generation behavior.

One autoregressive training step

The target token supervises the probability distribution; it is not copied into a lookup table.

Input

Tokenized sequence

Convert source content into token IDs and position information under a versioned tokenizer.

Model

Transformer blocks

Attention and feed-forward layers mix information from the visible prefix into contextual representations.

Prediction

Next-token probabilities

Project the final representation into a probability distribution over the vocabulary.

Learning

Loss and weight update

Compare the distribution with the target token, then update parameters to reduce future error.

Data quality is an architecture decision

  • Define source ownership, permitted use, retention, provenance, and removal procedures before training.
  • Measure duplication, language and domain balance, toxicity, sensitive data, and evaluation-set contamination.
  • Keep preprocessing, tokenizer, mixture weights, filters, and dataset snapshots versioned with the checkpoint.
  • Preserve held-out slices that represent real product tasks and difficult failure conditions.
  • Treat synthetic data as generated evidence with its own lineage, filtering, and feedback-loop risks.

Scale parameters, tokens, and compute together

Scaling-law research shows that loss changes predictably with model size, data, and compute within studied regimes. The practical lesson is not one permanent ratio. It is that an oversized model trained on too few useful tokens can waste a fixed compute budget, while more low-quality or duplicated data can also fail to buy useful capability.

For a dense Transformer, a common planning approximation makes training work proportional to parameters x training tokens. The real budget must also include optimizer state, activation memory, communication, failed work, evaluation, checkpoints, and data processing.

Do not infer product reliability from falling pretraining loss. The objective rewards token prediction, so factuality, instruction following, tool correctness, safety, and task completion need separate adaptation and evaluation evidence.

Adapt only the layer that needs to change

Many teams reach for fine-tuning before they have named the missing capability. First decide whether the requirement is temporary behavior, fresh knowledge, a stable domain pattern, or a broad ranked preference. Each belongs in a different state boundary.

Request state

Prompt and examples

Use for temporary instructions, output shape, and demonstrations that must remain easy to inspect and change.

External knowledge

Retrieval grounding

Use for volatile or private evidence that needs source identity, authorization, freshness, and independent deletion.

Learned pattern

Supervised adaptation

Use when representative examples define a stable behavior and lighter request-time mechanisms remain insufficient.

Broad behavior

Preference optimization

Use ranked or scored outputs to shape general response behavior, with explicit analysis of evaluator quality and reward misspecification.

Use the workbench to move the same requirement across adaptation layers. Watch how state location changes update speed, rollback, latency, and evaluation burden.

Loading adaptation boundaries...

Make adaptation evidence match its persistence

The more persistent the change, the stronger its data and release contract must be.

Prompt and retrieval checks

  • Version the complete prompt template, examples, tool schema, and truncation policy.
  • Test instruction conflicts, prompt injection, missing evidence, low-recall retrieval, stale indexes, and unauthorized sources.
  • Require citations to support generated claims rather than merely appearing in the response.
  • Define empty-result and degraded-dependency behavior before relying on external evidence.

Learned-adaptation checks

  • Compare against prompt and retrieval baselines at matched evaluation coverage and serving cost.
  • Split training, validation, and test data by meaningful entities or time boundaries to reduce leakage.
  • Track base checkpoint, tokenizer, adapter, training code, data snapshot, hyperparameters, and evaluator versions together.
  • Measure general-capability regressions, memorization, safety shifts, calibration, and important subgroup slices.
  • Roll back the complete model bundle; an adapter may not remain compatible with a different base or runtime.
Select the least persistent adaptation that satisfies the requirement

Inference has two different compute phases

At request time, the serving system tokenizes the input, constructs the context, and runs the model. Decoder-style generation then has two operationally different phases:

  • Prefill processes the supplied prompt in parallel and creates attention state for its tokens. Long prompts directly increase this work.
  • Decode emits output tokens one step at a time. Each step reads prior attention state, so token latency and memory pressure matter across active sequences.
  • KV cache stores per-request attention keys and values. It grows with context, active sequences, architecture, and precision even when model weights already fit.
  • Scheduling trades queue delay against batching efficiency. A larger batch can improve throughput while hurting an individual request's first-token latency.
  • Prefix reuse can skip repeated prefill work only when the cached prefix identity includes every input that changes its result.

Time to first token and time per output token describe different user experiences. Report both, including tail percentiles and the request-shape distribution that produced them.

Loading inference envelope...

Build a production request path around the model

The model server should not own authentication, evidence authorization, business side effects, or final policy by itself. Keep those responsibilities visible in the system architecture.

Production LLM request path

Each boundary has its own timeout, version, telemetry, and degraded behavior.

Trust boundary

Admission gateway

Authenticate, authorize, rate-limit, normalize, assign request identity, and reject work that cannot meet quota or deadline.

Evidence

Context builder

Assemble instructions, conversation state, retrieved sources, and tool contracts under a token and permission budget.

Compute

Inference scheduler

Route the pinned model bundle, batch compatible work, manage KV memory, stream tokens, and propagate cancellation.

Control

Tools and validators

Execute bounded actions, validate structured outputs, enforce policy, and make side effects idempotent.

Learning loop

Evaluation ledger

Record versions, timing, evidence use, policy outcomes, task signals, sampled review, and rollback decisions.

Bound failure before adding fallback

  • Set independent deadlines for context assembly, model queueing, generation, tools, validation, and streaming.
  • Cancel abandoned work and account every retry against the original quota and deadline.
  • Retry only idempotent operations or reconcile an unknown result before trying again.
  • Use a fallback model only after validating its context, tool, safety, and output-schema compatibility.
  • Protect downstream tools with least privilege, argument validation, rate limits, and explicit user confirmation for consequential actions.
  • Degrade visibly when retrieval, safety, or tool dependencies are unavailable; do not silently remove a mandatory control.
Estimate prefill, decode, and KV-memory constraints

Evaluate the task and the complete system

A public benchmark can provide one signal, but production selection must use representative prompts, adversarial cases, operational load, and human review where automated scoring is weak. Keep the candidate, baseline, evaluator, dataset, prompt template, and sampling configuration versioned.

Does it work?

Task quality

  • exact or structured correctness where a deterministic oracle exists;
  • groundedness and citation support for evidence-based answers;
  • tool-selection, argument, and end-to-end task success;
  • human preference with evaluator agreement for open-ended output.

Where does it fail?

Robustness and safety

  • prompt injection, unsafe requests, sensitive data, and policy edge cases;
  • language, domain, user, and long-context slices;
  • malformed tool results, missing evidence, and adversarial formatting;
  • calibration, abstention, and escalation behavior.

Can it operate?

Serving performance

  • queue, prefill, decode, tool, validation, and end-to-end latency;
  • throughput and tail behavior by prompt and output length;
  • device memory, cache reuse, batch fill, cancellation, and retry waste;
  • cold start, rollout, rollback, and dependency-failure recovery.

Is it worth it?

Product economics

  • cost per accepted, useful task rather than cost per raw token alone;
  • retries, human review, tool calls, retrieval, storage, and idle capacity;
  • quality and safety losses caused by compression or model routing;
  • migration and operational burden across the bundle lifecycle.

Release with thresholds, not impressions

  1. Freeze the candidate bundle and evaluation manifest.
  2. Compare it with the current production baseline on the same cases and operating envelope.
  3. Require thresholds for critical failures, not only a better average score.
  4. Shadow or canary the complete path with bounded exposure and version-separated telemetry.
  5. Promote only when online task, safety, latency, and cost signals agree with release assumptions.
  6. Keep the prior bundle runnable until rollback and replay drills pass.

Select a model family from constraints

Do not begin with a vendor leaderboard. Begin with the workload and eliminate bundles that violate hard constraints.

  • Task contract: required languages, modalities, tool use, structured output, context behavior, and minimum quality by critical slice.
  • Serving contract: first-token and per-token latency, concurrency, throughput, memory, availability, and geographic placement.
  • Data contract: retention, training use, residency, encryption, access, deletion, auditability, and model-license obligations.
  • Adaptation contract: prompting, retrieval, adapter support, preference tuning, tokenizer stability, and version compatibility.
  • Operational contract: observability, quotas, deprecation policy, reproducible bundles, rollback, incident support, and fallback behavior.
  • Economic contract: complete task cost at representative input/output lengths, retries, tools, review, and reserved capacity.

Choose the smallest bundle that clears the complete contract with enough headroom. A larger model can be justified by measured task value, but parameter count by itself is not a quality, safety, or reliability guarantee.

Primary papers and maintained guidance

No quiz questions available
Could not load questions file
Spotted an issue or have a better explanation? This page is open source.Edit on GitHub·Suggest an improvement