Skip to content

Four uses, four infrastructures

Note

In one minute

  • "Hosting AI" covers four very different jobs: training, fine-tuning, retrieval (RAG) and agents.
  • Each asks something different of the cloud: thousands of linked GPUs, a few GPUs for days, a GPU plus a search index, or a GPU plus careful access control.
  • Ask which of the four is wanted before sizing anything.

Before you start. What a model is and How a large language model answers. This page is background (Conventions).

Training

Computing a model's parameters from scratch, from a very large dataset.

  • Compute: the largest of the four, by far. Large models are trained on thousands of GPUs for weeks.
  • Memory: much more than serving the same model. Besides the weights, training keeps gradients and optimiser state: with the usual mixed-precision method, about 16 bytes per parameter before anything else (Linking GPUs explains why the model is then spread over many GPUs).
  • Network: the GPUs exchange data at every step. The links between servers become as important as the GPUs.
  • Storage: large datasets read at high speed; regular checkpoints of the full training state.

Fine-tuning

Training an existing model a little more, on your own examples, to adapt its style or teach it a task.

  • Compute: hours to days on one to a few GPUs, for most private uses.
  • Memory: full fine-tuning needs about as much as training the same model. Methods such as LoRA train a small set of extra parameters instead and need far less, often a single GPU.
  • Data: your examples, which may be sensitive: one reason to do it on a private cloud.

Retrieval-augmented generation (RAG)

Answering from your own documents without training: before the model answers, the application searches your documents and puts the relevant passages into the prompt.

  1. Each document is cut into passages, and each passage is turned into a vector (a list of numbers that captures its meaning) by a small embedding model.
  2. The vectors are stored in a vector index (a database that finds the vectors closest to a query).
  3. At question time, the question is turned into a vector, the closest passages are found, and they are given to the LLM with the question.
  • Compute: inference only, for the LLM and the embedding model.
  • Storage: the documents and the vector index.
  • Security: the index holds copies of your documents. Who can query it must match who could read the originals.

Agents

A model that can call tools (run a command, read a file, query an API) and decide the next step from the result, over several turns.

  • Compute: inference, but many calls per task, with long and growing contexts.
  • Network: access to the systems the tools act on.
  • Security: the main question. Each tool is a permission; an agent with write access to production can do anything that access allows (step 5 is about this).

At a glance

Use GPUs GPU memory Network between servers Main risk
Training Many, for weeks Very high Critical Cost
Fine-tuning One to a few, for days High Rarely needed Leaking training data
RAG One or more, all day Model + KV cache Not needed Exposing documents
Agents One or more, all day Model + long contexts Not needed Actions on real systems

Common mistakes

  • "We need to train our own model." Most needs are met by serving an existing model, with RAG for your documents, and sometimes a fine-tuning.
  • "RAG teaches the model our documents." The model is unchanged; it reads the passages given with each question.
  • "An agent is just a chat." An agent acts. Its permissions must be designed like those of any automation.

Check yourself

A team wants an assistant that answers questions from its internal runbooks. Which use is it?

Retrieval-augmented generation (RAG): an embedding model, a vector index of the runbooks, and an LLM for the answers. No training is needed.

Why does training need a fast network between servers, while serving often does not?

Training spreads one model and its state over many GPUs that exchange data at every step. Serving a model that fits in one server's GPUs needs no traffic between servers.

What does LoRA change compared with a full fine-tuning?

It trains a small set of extra parameters instead of all of them, so it needs much less GPU memory, often a single GPU.

Go further