Prompt
What's the most cost-effective way to run semantic search using an LLM API provider at scale?
Latest observation
The most cost-effective approach is usually not to use the LLM API for every search query. Instead:
Best-practice architecture
-
Use an embedding model once per document/chunk
- Generate embeddings for your corpus offline or during ingestion.
- Store them in a vector index / vector database.
-
At query time, embed the user query
- Use a small, cheap embedding model.
- Compare the query embedding against your precomputed document embeddings.
-
Only use the LLM for reranking or answer generation when needed
- Retrieve top-K candidates with vector search.
- If needed, pass only those candidates to a more expensive LLM for reranking, summarization, or final response.
Why this is cheapest
- Embeddings are much cheaper than using a chat/completion model for retrieval.
- You pay the expensive model cost only on:
- ambiguous queries,
- reranking,
- or final synthesis.
- Most search workloads are retrieval-dominant, so cheap embeddings + vector search give the best scale economics.
Cost-saving tactics
- Chunk documents intelligently: don’t embed huge blobs or tiny fragments.
- Deduplicate similar content before embedding.
- Cache query embeddings for repeated searches.
- Use a two-stage pipeline:
- Stage 1: vector search over all content
- Stage 2: cross-encoder/LLM rerank over top 20–100 results
- Batch embedding requests if your provider supports it.
- Choose the smallest embedding model that preserves acceptable recall.
- Re-embed only changed content instead of the whole corpus.
When to use the LLM directly
Use a full LLM search approach only if:
- your corpus is very small,
- semantic accuracy matters more than cost,
- or you need reasoning over retrieved text, not just retrieval.
Rule of thumb
For large-scale semantic search:
- Embeddings + ANN vector index = primary solution
- LLM = optional second-stage tool, not the retrieval engine
If you want, I can also give you:
- a reference architecture,
- a cost model formula, or
- a provider-by-provider comparison.
Observation history
Unlock observation history
Create a free Obsurfable account to unlock historical responses, model comparisons, and deeper brand intelligence.
How did Obsurfable measure this prompt?
Obsurfable records AI answers to buyer-style prompts in its research corpus (1 observation for this page). Metrics are distributions over observations, not a single static ranking.
Which AI systems does Obsurfable collect answers from?
OpenAI, ChatGPT, Google, Gemini, Google AI Mode, Anthropic, Claude, Perplexity, Grok, DeepSeek, Mistral, Copilot, and Meta AI.