Why Embeddings Are Really a Budgeting Problem
Hatched by Gleb Sokolov
May 12, 2026
11 min read
5 views
74%
The hidden question behind every embedding API
What looks like a simple choice, local model or hosted model, is actually a decision about where intelligence should live. Do you want your embedding pipeline to behave like a machine you own, tune, and inspect? Or like a utility you consume, elastic and invisible until the bill arrives?
That is the real tension hiding inside modern embedding workflows. The code may differ only slightly, a local LlamaCppEmbeddings object here, a DeepInfraEmbeddingModel there, but the consequences are profound. One approach puts the weights on your disk, the other puts them behind someone else’s network boundary. One asks you to think about n_ctx, n_batch, and n_gpu_layers. The other asks you to think about tokens, normalization, prefixes, and asynchronous calls. Those are not just implementation details. They are clues about the kind of system you are building.
Embeddings are often treated like plumbing, a background service that quietly converts text into vectors. But plumbing is where architecture becomes expensive or elegant. If you get the embedding layer wrong, retrieval feels random, latency feels erratic, and costs feel mysterious. If you get it right, the whole system gains a kind of intellectual clarity: documents, queries, and search results start speaking the same geometric language.
The deeper insight is this: embedding strategy is budget strategy. Not only money budget, but also latency budget, cognitive budget, privacy budget, and operational budget. The choice between local and hosted embeddings is really a question about which budgets you want to spend, and which ones you want to preserve.
Two ways to buy the same sentence
Think about embedding the phrase "hello world." On the surface, it is the same operation whether it runs on your laptop or through an API. Under the hood, though, the machine doing the work changes everything.
A local setup with a GGUF model and LlamaCppEmbeddings is like owning a kitchen. You know where every pan is, how hot the stove gets, and whether the oven can handle a large batch. If the meal takes longer, you adjust n_batch. If memory gets tight, you tune n_gpu_layers. If the model needs more context, you expand n_ctx. You are not asking permission to cook, but you are responsible for the heat, the cleanup, and the ingredients.
A hosted setup with something like DeepInfraEmbeddingModel is like ordering from a professional kitchen. You can specify the dish, perhaps even the garnish, through model_id, normalize, text_prefix, and query_prefix. You can batch requests, run them asynchronously, and forget about the infrastructure. The kitchen is faster to start, easier to scale, and often more predictable for production traffic.
Both produce vectors, but the vectors are not the whole story. The real difference lies in the shape of control:
- Local models give you sovereignty.
- Hosted models give you elasticity.
- Local models reward engineering intimacy.
- Hosted models reward operational simplicity.
This is why the decision is so often misframed. Teams ask, "Which embedding model is best?" when they should ask, "Which form of dependence do we want?" Every embedding system creates dependence somewhere. If not on a vendor, then on your own hardware, deployment process, and optimization skill.
The embedding layer is never just a model choice. It is a dependency map.
That dependency map is what makes embeddings interesting. They sit at the boundary between raw language and retrieval behavior, which means they determine what your system can remember, compare, and recommend. In a search application, they effectively define what counts as "similar." In a knowledge assistant, they define which ideas are allowed to meet each other in vector space.
The three budgets no one talks about
Most teams understand financial cost. Fewer understand the other three budgets that embeddings consume.
1. Latency budget
Local embeddings can be astonishingly fast once the system is warm, especially when the workload is steady and the hardware is tuned. But they can also become fragile if memory pressure, batch size, or GPU allocation is mismanaged. Hosted embeddings can feel slower on paper because network round trips are unavoidable, yet they often win in practice because they spare you from maintenance delays and scaling bottlenecks.
Latency is not just about milliseconds. It is about predictability. A search feature that responds in 120 milliseconds every time often feels better than one that averages 80 milliseconds but occasionally spikes to 2 seconds. Users experience variance as unreliability.
2. Cognitive budget
Every system imposes a mental tax. Local embeddings require you to understand model files, memory limits, runtime behavior, and sometimes device placement. Hosted embeddings require you to understand rate limits, request shaping, authentication, and retry logic. There is no free lunch, only different cognitive invoices.
This matters because team cognition is finite. A startup building its first retrieval system may not want to spend weeks learning the quirks of n_gpu_layers. A research team running sensitive corpora may gladly accept that complexity in exchange for privacy and experiment control.
3. Privacy budget
If your text contains medical records, legal documents, internal strategy notes, or proprietary source code, the question is not merely technical. It is political and ethical. Local embedding generation keeps raw text inside your boundary. Hosted embedding generation means sending text to an external provider, even if the provider is trustworthy and secure.
This does not make hosted systems bad. It means privacy is being traded, not assumed. That trade can be entirely rational, but only if it is explicit.
4. Operational budget
A local model is not "free" just because you are not paying per request. You are paying in deployment maintenance, monitoring, scaling, updates, hardware, and failure handling. A hosted model shifts much of that burden outward, which can be a tremendous advantage, especially for teams that want to move quickly.
The practical lesson is simple: the cheapest embedding system is often the one that wastes the least attention.
Normalization, prefixes, and the geometry of meaning
Once the infrastructure question is settled, a subtler issue emerges: how should the text itself be shaped before embedding?
The hosted example exposes an important truth through its configuration options. normalize=True is not an incidental detail. Normalization changes how vectors are compared, especially when cosine similarity is used. text_prefix and query_prefix are also revealing. They remind us that text is not always text in the same way. A document and a search query are different speech acts, and the model may benefit from being told which is which.
This is one of the least appreciated ideas in retrieval: semantic similarity is partly engineered, not discovered. Embeddings do not simply reveal meaning. They operationalize a theory of meaning. Prefixes, normalization, batching, and context length all influence the shape of that theory.
A useful analogy is cartography. A map does not contain a city. It encodes choices about scale, labeling, projection, and emphasis. Two maps of the same place can support very different journeys. Likewise, two embedding pipelines can turn the same sentence into different retrieval behaviors depending on preprocessing and model constraints.
Consider a legal assistant searching case law. A query like "dismissal for lack of standing" is not the same kind of text as a full appellate opinion. Prefixing one as a query and the other as text tells the model to organize meaning around different roles. That small signal can matter more than a flashy model upgrade.
Now consider a local notebook analyzing internal design docs. If n_ctx is too short, longer passages may be truncated before they reach the embedding stage. Suddenly, the system may miss the one paragraph that actually distinguishes a product decision. The lesson is uncomfortable but important: retrieval quality often fails because meaning was lost before vectors were even created.
This is why obsessing over benchmark scores alone can be misleading. A higher quality model with poor preprocessing can underperform a simpler model with better operational discipline. Meaning is a chain, and the chain is only as strong as its earliest links.
Good embeddings are not only about representation. They are about preserving the right distinctions long enough to be compared.
A framework for choosing: sovereignty, elasticity, and fidelity
Instead of asking which embedding option is superior, it is more useful to ask which of three properties matters most for your use case.
1. Sovereignty: who owns the computation?
Choose local embeddings when control is not optional. This includes sensitive data, air-gapped environments, offline products, regulated industries, and teams that need full observability into model behavior. Sovereignty means you can inspect the full stack and modify it without asking for permission.
2. Elasticity: how quickly can the system adapt?
Choose hosted embeddings when traffic is spiky, experimentation is rapid, or infrastructure time is scarce. Elasticity means you can scale without buying capacity ahead of time. If your app needs to go from 10 queries a day to 10 million, a hosted service can remove a huge amount of friction.
3. Fidelity: how precisely does the system reflect your intent?
This is the most neglected category. Fidelity asks whether the embedding pipeline preserves the distinctions that matter in your domain. A medical search engine, a code search tool, and a customer support assistant all require different notions of similarity. Fidelity depends on the base model, yes, but also on normalization, prefixing, batching strategy, chunking, and context handling.
A powerful way to think about the tradeoff is this:
- Sovereignty protects meaning from external exposure.
- Elasticity protects the product from operational drag.
- Fidelity protects the retrieval system from conceptual blur.
A mature team does not optimize only one of these. It allocates them deliberately.
For example, a company might use local embeddings for private document ingestion but hosted embeddings for public FAQ search. Or it might prototype with a hosted model, then migrate sensitive workloads local once usage patterns stabilize. The point is not ideological purity. The point is designing a mixed portfolio of control.
That portfolio idea is especially useful because embedding systems rarely stay static. As data grows, the early decision to use a local model or an API becomes part of a larger operational story. Today’s convenience can become tomorrow’s lock-in. Today’s control can become tomorrow’s maintenance burden. The best architecture is often the one that makes later migration possible.
The practical paradox: build for simplicity, but not for sameness
The temptation in embedding systems is to reduce everything to a single universal pattern. One model. One preprocessing strategy. One deployment mode. One similarity threshold. That desire for sameness is understandable, because it promises simplicity.
But retrieval is not simple. Different corpora behave differently. A customer support archive is repetitive and formulaic. A research knowledge base is subtle and interlinked. Code snippets depend on syntax and structure. Meeting transcripts depend on speaker turns and context drift. Treating them all as the same kind of text is like using the same lens for every photograph.
This is where the local versus hosted discussion becomes more interesting. Local infrastructure invites customization because it makes the model feel tangible. Hosted infrastructure invites standardization because it makes the model feel service-like. Both impulses are useful, but neither should dominate.
The best systems often combine a stable outer shell with flexible inner rules. For instance:
- Use a hosted embedding service to move quickly during prototyping.
- Measure retrieval quality on real queries, not just sample sentences.
- Identify where meaning is lost, whether from chunking, truncation, or poor role signaling.
- Decide which workloads justify local control, especially if privacy or cost sensitivity grows.
- Preserve the ability to swap embedding backends without rewriting your whole application.
That last point is crucial. A good architecture treats embedding providers like interchangeable lenses, not sacred objects. If your application logic is too tightly coupled to one provider, you have not built a retrieval system. You have built a dependency.
A strong engineering culture recognizes that embeddings are infrastructure for thought. They do not just move text around. They shape the space in which relevance becomes possible. That means changing the embedding layer is not merely a deployment decision. It is a semantic decision.
Key Takeaways
- Treat embedding choice as a budget decision, not just a model decision. Account for money, latency, privacy, and team attention.
- Use local embeddings when sovereignty matters, especially for sensitive data, offline use, or full-stack control.
- Use hosted embeddings when elasticity matters, especially for rapid experimentation, variable traffic, or limited ops capacity.
- Pay attention to prefixes, normalization, and context limits, because retrieval quality depends on how meaning is prepared, not only on the model itself.
- Design for portability, so you can switch providers or mix local and hosted systems without rebuilding your application.
Conclusion: embeddings are where meaning meets governance
The most important thing about embeddings is not that they turn words into numbers. Many systems do that. The important thing is that they decide which similarities become actionable, which distinctions survive, and which tradeoffs are hidden inside the pipeline.
That is why the local versus hosted choice feels larger than it first appears. One side gives you more control over the machine that thinks with your data. The other gives you more freedom from the machine itself. Neither is universally better. Each is a different philosophy of trust.
If you remember only one thing, remember this: an embedding system is not just a vector generator, it is a governance layer for meaning. It determines who controls the computation, how much context is preserved, and what kind of similarity your application will believe in.
Once you see embeddings this way, the question changes. You stop asking, "Should I run this locally or via API?" and start asking, "What kind of intellectual system am I trying to build, and what am I willing to depend on to make it work?" That is the question worth keeping open.
Sources
Hatch New Ideas with Glasp AI 🐣
Glasp AI allows you to hatch new ideas based on your curated content. Let's curate and create with Glasp AI :)
Start Hatching 🐣