Local or hosted models? How I choose for a document assistant

Running AI on your own servers keeps data in-house; hosted models are often stronger and cheaper to start. The right answer depends on three questions, and it is often a mix of both.

Ashar Khalid · · 3 min read · RAG, Architecture

Every assistant that answers from a company’s documents needs two kinds of model. An embedding model turns documents and questions into vectors, so the closest passages can be found. A generation model reads those passages and writes the answer.

Each one can run on your own infrastructure (a local model, for example served with Ollama) or be called from a provider’s API (a hosted model). Teams often treat this as one big choice. In my experience it is two separate choices, and the best builds make them differently.

Three questions decide it

1. Can the data leave your infrastructure?

This comes first because it can end the discussion. Some organisations cannot send a single document to an outside provider, because of contracts, regulation or simply their own policy. For them, both embedding and generation run locally, and documents and questions never leave their servers.

That is a real constraint, not a preference, so I treat it as one: the architecture is built around it from the start rather than adding it later.

2. What quality does the job need?

Hosted models are usually stronger, especially at writing answers and at working across languages. For one multilingual build, retrieval quality across languages mattered more to the client than keeping data in-house, so a hosted model was the right choice there, even though other builds of the same kind ran fully locally.

The point is to decide this with evidence, not instinct. I build a small set of real questions with the answers the client expects, then compare options against it. A short session with real questions settles what debate cannot.

3. What will it cost to run?

The two steps have very different volumes. Embedding is the high-volume step: every document is embedded when it is added, and again whenever it changes. Generation happens only when someone asks a question.

That difference often points to a hybrid:

  • local embeddings, which removes the largest per-call cost and keeps the bulk of the text processing in-house;
  • hosted generation, where the stronger model makes a visible difference to answer quality.

Local models trade a fixed server cost for no per-question fees. Hosted models are the reverse. Neither is cheaper in general; it depends on how much the assistant is used.

Patterns that come out of those questions

Situation Embeddings Generation
Data must never leave Local Local
Quality across languages matters most Chosen for language quality Hosted
Cost matters and data can be shared Local Hosted

None of these is the “right” architecture. Each is right for a particular client’s limits.

Design so the choice can change

Whatever you choose today may change: a new model gets better, prices move, or a policy loosens or tightens. Two habits keep that cheap:

  • Keep the model behind one small interface, so switching provider is a configuration change, not a rewrite.
  • Remember that embeddings are tied to the model that made them. If you change the embedding model, the documents need to be embedded again. Plan for that, and the switch is routine.

The short version

Ask where the data may go, what quality the job needs and what it costs at your volume. Make the embedding and generation choices separately. And test every option against real questions before you commit.

These choices come from several private retrieval builds, some fully local and some hybrid. The write-up shows how they fit together.

Have a project in mind?

Tell me what you want to fix or build, in your own words. You don't need a technical brief.

  • NDA available for sensitive projects