Building a Production-Grade LLM Orchestration System for Conversational Search

perplexity · Tech · 2023 · source Agentic: yes · promotional bias: med · source-backed · extracted with prompt 0.5.4 (schema v2)

Generated from extraction.json — do not edit by hand. Every claim cites verbatim source evidence; stated means the quote directly asserts the claim, implied means it supports it indirectly.

Problem

Domain: Conversational search with live retrieval and citations

Perplexity needed to turn LLMs into a fast, reliable conversational answer engine that could search live information, cite sources, ask clarifying questions, personalize behavior, use external tools, and avoid becoming a slow or hallucination-prone LLM wrapper.

Constraints:

Architecture

Perplexity built a conversational search orchestration layer that combines LLMs with search indexes, vector databases, Wolfram Alpha, rendering libraries, database plugins, citations, personalization prompts, query classification, query reformulation, summarization, and follow-up generation. Different LLMs handle classification, reformulation into subqueries, final answer synthesis, and related-question generation, while in-house engineering controls latency across the full stack rather than relying on high-level LLM tooling libraries.

Diagram confidence: reconstructed (reconstructed from prose).

flowchart LR
  search-user-interface[Search user interface] --> orchestration-layer[Orchestration layer]
  search-user-interface --> ai-profile[AI profile]
  ai-profile --> orchestration-layer
  orchestration-layer --> query-classification-llm[Query classification LLM]
  query-classification-llm --> query-reformulation-llm[Query reformulation LLM]
  query-reformulation-llm --> search-indexes[Search indexes]
  orchestration-layer --> tool-integrations[Tool integrations]
  search-indexes --> summarization-llm[Summarization LLM]
  tool-integrations --> summarization-llm
  summarization-llm --> citation-renderer[Citation renderer]
  citation-renderer --> search-user-interface
  orchestration-layer --> follow-up-generation-llm[Follow-up generation LLM]
  follow-up-generation-llm --> search-user-interface
  orchestration-layer --> quality-eval-suite[Quality eval suite]
  product-stack[Product stack] --> search-user-interface
  product-stack --> search-indexes
  product-stack --> orchestration-layer
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
Search user interface Search bar, Copilot, Chrome extension, web, and mobile surfaces where users ask questions and follow-ups. Orchestration layer, AI profile
AI profile User-controlled personalization prompt with interests, location, language preferences, and reusable instructions. Search user interface, Orchestration layer
Orchestration layer Software layer coordinating LLM workers, search tools, retrieval, citations, and follow-up generation into one answer experience. Search user interface, AI profile, Query classification LLM, Query reformulation LLM, Search indexes, Tool integrations, Summarization LLM, Follow-up generation LLM, Quality eval suite
Query classification LLM Specialized LLM deciding what type of query is being asked. Orchestration layer, Query reformulation LLM
Query reformulation LLM LLM that expands one user query into multiple subqueries to improve recall. Query classification LLM, Search indexes
Search indexes Live search infrastructure including Elasticsearch and vector databases for current web/source retrieval. Query reformulation LLM, Summarization LLM, Orchestration layer
Tool integrations External capabilities such as Wolfram Alpha, Python interpreters, rendering libraries, and database plugins. Orchestration layer, Summarization LLM
Summarization LLM LLM that synthesizes retrieved sources and tool outputs into a conversational answer. Search indexes, Tool integrations, Citation renderer
Citation renderer Answer presentation layer that makes truth/source attribution a first-party part of the response. Summarization LLM, Search user interface
Follow-up generation LLM LLM that generates contextual related questions users can click without typing follow-ups. Orchestration layer, Search user interface
Quality eval suite AI evals and benchmarks run when prompts, search indexes, or model choices change. Orchestration layer
Product stack Kubernetes backend, React/Next.js frontend, SwiftUI iOS app, native Android app, Elasticsearch, and Quadrant vector database. Search user interface, Search indexes, Orchestration layer

Data flow

A user asks a question in Perplexity or Copilot. If needed, the system asks clarifying questions or applies profile instructions, classifies the query, reformulates it into multiple subqueries, searches live indexes and tool sources, retrieves multiple results, uses LLMs to summarize and answer with citations, and generates contextual follow-up questions. Evals run when prompts, model choices, or search indexes change.

4 supporting quotes
“the llms will come back to you with clarifying questions and then the search queries initially that you ask are potentially highly ambiguous”transcript, stated
“um and and similarly like every query needs to be classified whether what type of query it is so that's another llm and then um every query needs to be reformulated into a bunch of other uh sub queries here like for example in this query I'm”transcript, stated
“um every query needs to be reformulated into a bunch of other uh sub queries here like for example in this query I'm asking please explain to me the paper augmenting language models with long-term memory uh this is a question”transcript, stated
“that gets reformulated into like three or four follow-up queries and and then a search runs for all these follow-up queries”transcript, stated

Why this architecture

Perplexity's thesis was that production search requires LLM reasoning plus live tools, not a standalone model. The system decomposes work into specialized LLMs and tool calls, uses retrieval to avoid knowledge cutoffs, keeps citations central for trust, and controls the entire engineering stack so latency can be optimized across orchestration, retrieval, rendering, and model calls.

4 supporting quotes
“next word at a time the uh the real end game is to connect llms with a lot of other tools like search engines python interpreters um and like Leverage the tools power and robustness and like basically harness the reasoning Power of Elements too and build something that was just impossible”transcript, stated
“llms are great reasoning engines Wolfram and databases and search indexes are sort of like knowledge engines or knowledge bases knowledge graphs”transcript, stated
“truth is a first party characteristic of all the answers um in the form of citations so we are backed by great investors Nat uh Jeff Dean Bob muglia elad Andrea Yan um and so many more”transcript, stated
“um when you're controlling all parts of the stack yourself you can make it really really fast so as a company we we do not use these high level uh tool libraries like um or Lang chain or dust we don't make use of all these things uh we just do”transcript, stated

Models used: GPT-3.5 Turbo · GPT-4 · Claude · Claude Instant · MPT fine-tunes · custom embeddings · query classification LLM · query reformulation LLM · follow-up generation LLM · summarization LLM

Scale

Alternatives considered (roads not taken)

Use high-level tool libraries such as LangChain or Dust

Rejected because: Perplexity wanted end-to-end control to capture latency optimizations those libraries would hide.

“really really fast so as a company we we do not use these high level uh tool libraries like um or Lang chain or dust we don't make use of all these things uh we just do the whole engineering ourselves and I I kind of recommend that for anybody or anybody else like uh there's just so”transcript, stated
“anybody else like uh there's just so many uh latency optimizations you'll miss out on um if you rely on these uh tooling libraries and then um hallucinations so when you're using many tools uh there are so many ways in which it can fail when you're chaining things together”transcript, stated

Rely on a pure LLM without tools

Rejected because: A pure LLM lacks live search/index knowledge and cannot create the same tool-backed experiences.

“build something that was just impossible to build with just pure LMS and um I mean no need to say more like Sundar pichai the Google CEO comes and tweets of improvement of a Bard where um they they have like an implicit code”transcript, stated
“combine the LOL with the search index and then make sure that it can always be updated with the live information there's no knowledge cut off”transcript, stated

Use one search query only

Rejected because: Reformulating into several subqueries increases result diversity, recall, and context quality for the answer LLM.

“the co-pilot looks at like 16 results which would not have been possible with just like one single query right”transcript, stated
“that expands the diversity of pages of the co-pilot sees um and creates a very high recall content for the llm”transcript, stated

Use OpenAI embeddings by default

Rejected because: Perplexity trained its own embeddings and did not see OpenAI holding the same lead in embeddings as in LLMs.

“embeddings I think we don't use openai we we train our own embeddings now that that's turned out to be pretty good for us I don't think they have the market lead on embeddings as they have for llms”transcript, stated
“I don't think they have the market lead on embeddings as they have for llms I think that's basically it um so here's here's an interesting one which is actually it gets a little bit ethical in a way shiv is asking do you”transcript, stated

Choose foundation models by preference rather than evals

Rejected because: The speaker says model selection in the orchestration process should be driven by eval results.

“recommendation on how to choose the correct foundational model based on the question step in the orchestration process so so right now I feel like I mean all this should be desired based on evals um and right now the evals indicate 3.5 turbo or four are like just insanely”transcript, stated
“so so right now I feel like I mean all this should be desired based on evals um and right now the evals indicate 3.5 turbo or four are like just insanely good um I think anything to do with reasoning”transcript, stated

Patterns

rag-retrieval (conversational-search)

Perplexity combines LLM reasoning with live search indexes so answers can use current retrieved information and citations.

“retrieval augmented generation or people refer to it as rag where you combine the LOL with the search index”transcript, stated
“there's no knowledge cut off but it also retains the conversational and reasoning and referential natural language capabilities”transcript, stated

tool-use-orchestration (llm-orchestration)

The system orchestrates LLMs with search engines, Wolfram, rendering libraries, databases, and other tools instead of asking a model to do everything alone.

“we are orchestrating an llm to use many tools together in order to achieve like um amazing things”transcript, stated
“search indexes Wolfram uh rendering libraries um trying to like make sure that the image rendering works well um database plugins”transcript, stated

query-rewriting (search-recall)

User questions are reformulated into several subqueries so Copilot retrieves a more diverse and useful source set.

“every query needs to be reformulated into a bunch of other uh sub queries”transcript, stated
“that expands the diversity of pages of the co-pilot sees um and creates a very high recall content for the llm”transcript, stated

model-routing (model-selection)

Perplexity uses different models for summarization, preprocessing, classification, and reasoning, with model choices governed by evals.

“for most summarization tasks or irregular language pre-processing tasks you go with 3.5 Claude instant is also pretty good”transcript, stated
“all this should be desired based on evals”transcript, stated

eval-driven-development (quality)

Perplexity runs AI evals whenever prompts or search indexes change and uses dogfooding plus user complaints to improve quality.

“anytime we change the prompts or anytime we change the search index um we run it through all these rigorous evals”transcript, stated
“many anecdotal um complaints from people uh teach us a lot about like how to fix some things”transcript, stated

latency-optimization (production-performance)

Perplexity controls the stack in-house and avoids high-level LLM tool libraries so it can optimize the multi-tool, multi-LLM path for search latency.

“when you're controlling all parts of the stack yourself you can make it really really fast”transcript, stated
“there's just so many uh latency optimizations you'll miss out on um if you rely on these uh tooling libraries”transcript, stated

Tradeoffs

Build orchestration in-house

Chose end-to-end engineering controlled by Perplexity over LangChain, Dust, and similar high-level tooling libraries.

Rationale: Perplexity needed latency optimizations across all layers of the stack.

“we just do the whole engineering ourselves”transcript, stated
“there's just so many uh latency optimizations you'll miss out on um if you rely on these uh tooling libraries”transcript, stated

Use retrieval and tools rather than pure parametric knowledge

Chose RAG with search indexes, databases, Wolfram, and citations over LLM-only answers from model parameters.

Rationale: Search and tools provide live knowledge and robustness while LLMs provide reasoning and natural-language synthesis.

“there's no knowledge cut off but it also retains the conversational and reasoning and referential natural language capabilities”transcript, stated
“Magic happens when you combine the two together”transcript, stated

Split the search task into specialized LLM workers

Chose classification, reformulation, summarization, and follow-up generation LLMs over one model doing every step monolithically.

Rationale: Different parts of conversational search need different specialized behavior and can be orchestrated as workers.

“query formulation query categorization uh follow-up query suggestions and like um needs like separate llms”transcript, stated
“you need to orchestrate the whole thing um into like one single piece”transcript, stated

Use user-controlled prompt profiles for personalization

Chose AI profile/global instructions over traditional topic/domain preference picking only.

Rationale: Prompt profiles reduce repeated prompt engineering and let users guide the AI in natural language.

“personalization has been done in the Web 2.0 era where um we we used to pick topics that are of interest to us”transcript, stated
“if you just sort of give that as a global instruction and that's going to work for any question”transcript, stated

Train custom embeddings

Chose Perplexity-trained embeddings over OpenAI embeddings.

Rationale: Perplexity judged OpenAI's embedding advantage weaker than its LLM advantage.

“embeddings I think we don't use openai we we train our own embeddings”transcript, stated
“I don't think they have the market lead on embeddings as they have for llms”transcript, stated

Gotchas (what bit them)

Many-tool orchestration can make latency unacceptable.

Root cause: Every tool and LLM step adds work, and Perplexity's first product versions took five to seven seconds per query.

Resolution: The team controlled the full stack in-house and optimized end-to-end rather than relying on high-level tooling libraries.

“what are the challenges in orchestration like your your latency is like pretty high”transcript, stated
“the first thing anybody comes and tells me about perplexity is like how do you guys make it so fast”transcript, stated

Chained tools increase hallucination and breakage risk.

Root cause: When many components are chained together, a single wrong part can break the whole answer.

Resolution: Perplexity relies on human feedback, prompt engineering updates, prompt version control, and AI/model-quality benchmarks.

“when you're using many tools uh there are so many ways in which it can fail when you're chaining things together”transcript, stated
“we can only fix this by learning from Human feedback a lot of prompt engineering updates good discipline on prompt version controlling”transcript, stated

A conversational search product is more than an LLM wrapper.

Root cause: Search, tool integrations, rendering, database plugins, query reformulation, follow-up generation, and model orchestration are separate software layers.

Resolution: Perplexity built an orchestration suite around OpenAI/Claude models and its own backend/search stack.

“building a product is not just an llm wrapper”transcript, stated
“building the whole orchestration suit around it and doing this really well”transcript, stated

Ambiguous queries need user agency and clarification.

Root cause: Users often ask underspecified search questions, so the model needs help choosing the right part of the web.

Resolution: Copilot asks clarifying questions and the profile system lets users preload persistent preferences and instructions.

“the search queries initially that you ask are potentially highly ambiguous”transcript, stated
“you can uh clarify and reduce the ambiguity and help improve the answers”transcript, stated

Model migrations and model choice create engineering work.

Root cause: Changing model providers or using different models by task requires benchmarks, prompt migrations, and eval-driven decisions.

Resolution: Perplexity runs rigorous evals and chooses models by task, using GPT/Claude for strong reasoning and smaller models for narrower work.

“prom migrations when you're trying to migrate from one model to another there's all sorts of engineering challenges there”transcript, stated
“for most summarization tasks or irregular language pre-processing tasks you go with 3.5”transcript, stated

Evaluation

Perplexity evaluates answer quality with AI evals, benchmarks after prompt/search-index changes, dogfooding, production feedback, user complaints, and task-based model selection.

Metrics: answer quality after prompt changes · answer quality after search-index changes · model-quality benchmarks · foundation-model selection by eval results · latency per query · user complaints and dogfooding findings

4 supporting quotes
“so we run a lot of evals and you know we have this amazing 14 year old intern who came and set up like AI evals for us”transcript, stated
“anytime we change the prompts or anytime we change the search index um we run it through all these rigorous evals and then Benchmark it”transcript, stated
“we are big dog photos of our own product like you know that's necessary when you're when you're building a search product”transcript, stated
“many anecdotal um complaints from people uh teach us a lot about like how to fix some things”transcript, stated

Outcomes

The talk describes early five-to-seven-second query latency, query reformulation into three or four subqueries, Copilot considering around 16 results for one question, and orchestration intended to work reliably at scale for tens or hundreds of thousands of users.

4 supporting quotes
“perplexity is a conversational search engine”transcript, stated
“it's that slow like it used to take six to seven seconds and now it's like incredibly fast”transcript, stated
“we recently announced our Pro uh subscription plan that gives you like a lot of co-pilot uses per day and GPT 4 users per day”transcript, stated
“we use elastic and also um quadrant”transcript, stated