Scaling AI-Powered File Understanding with Efficient Embedding and LLM Architecture

dropbox · Tech · 2024 · source Agentic: no · promotional bias: low · source-backed · extracted with prompt 0.5.6 (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: AI-powered file summarization and question answering

Dropbox needed to make summaries and Q&A work inside web file previews across many file types and multiple files, while controlling latency, cost, hallucinations, privacy, and context selection.

Constraints:

Architecture

Dropbox extended Riviera, its file-conversion framework, so text extraction, embeddings, summarization, and Q&A are treated as conversion plugins. Riviera routes requests through jailed plugins and caches intermediate states. Text is chunked into paragraphs and embedded; summarization uses k-means clustering to choose semantically diverse representative chunks; Q&A embeds the user question and selects chunks by similarity. Multi-file Q&A uses relevance-score spread over top chunks to choose context, while real-time processing preserves user-controlled file sharing.

Diagram confidence: explicit (topology described by the source).

flowchart LR
  A["File preview surface"] --> B["Riviera conversion framework"]
  B --> C["Jailed plugins"]
  B --> D["Text extraction plugin"]
  D --> E["Embedding plugin"]
  E --> F["Riviera cache"]
  E --> G["Summary plugin"]
  E --> H["Q&A plugin"]
  H --> I["Multi-file selector"]
  G --> J["LLM"]
  H --> J
Drag to pan · scroll or use +/− to zoom · reconstructed from the source's described component topology

Components

Component Role Interacts with
File preview surface Web UI where users preview files, request summaries, ask questions, and see follow-up prompts. Riviera conversion framework
Riviera conversion framework Dropbox file-conversion system routing work through plugins and caching intermediate conversion states. Jailed plugins, Text extraction plugin, Embedding plugin, Summary plugin, Q&A plugin
Jailed plugins Isolated containers for running third-party file conversion tools safely. Riviera conversion framework
Text extraction plugin Converts documents, videos, audio, and other file formats into raw text or transcripts. Embedding plugin
Embedding plugin Chunks text into paragraphs and computes reusable embeddings for summary and Q&A. Summary plugin, Q&A plugin, Riviera cache
Riviera cache Caching layer that reuses file conversions, transcripts, and embeddings across interactions. Embedding plugin, Riviera conversion framework
Summary plugin Selects diverse chunks with k-means clustering and generates a summary from representative context. Embedding plugin, LLM
Q&A plugin Ranks chunks by query similarity, selects relevant context, and generates answers. Embedding plugin, LLM
Multi-file selector Chooses relevant chunks/files for multi-file questions using relevance-score spread and power-law behavior. Q&A plugin
LLM Generates summaries, answers, and structured follow-up questions from selected context. Summary plugin, Q&A plugin

Data flow

A file preview request enters Riviera, which converts files to browser-consumable forms and raw text through isolated plugins. The embedding plugin chunks text and produces embeddings that are cached like other conversions. Summaries select dissimilar representative chunks via k-means and make one LLM call. Q&A embeds the user question, ranks chunks by vector similarity, selects relevant chunks and files, then sends the query and context to the LLM. Follow-up questions are requested via function calling and structured outputs.

3 supporting quotes
“Riviera consists of a frontend which routes requests through one or more plugins that convert a file from one type to another.”article, stated
“Riviera treats embeddings like any other file conversion”article, stated
“The Q&A plugin takes in the embeddings and text chunks from the embedding plugin and generates a new embedding for the user question.”article, stated

Why this architecture

Dropbox reused Riviera because file preview conversion, plugin isolation, conversion graphs, and caching already existed at Dropbox scale. Treating embeddings as conversions lets summaries and Q&A share cached chunks and embeddings. K-means provides diverse summary context with a single LLM call, while similarity ranking and power-law cutoffs keep Q&A context focused. Real-time LLM calls preserve file-sharing control for users.

3 supporting quotes
“By separating the embedding generation from the actual summary generation we can reuse the cache features built into Riviera.”article, stated
“Using k-means clustering, we discovered that the summaries covered a broader range of topics—approximately 50% more than with map-reduce”article, stated
“we settled on computing responses in real time because of one main factor: it allows the user to choose which files to share with the LLM—and only those files.”article, stated

Models used: large language models · embedding models · k-means clustering · function calling · structured outputs

Scale

Alternatives considered (roads not taken)

Summary-of-summaries / map-reduce

Rejected because: It repeated similar information, lost content, and compounded hallucination risk across multiple LLM calls.

“Many individual summaries before reaching the final summary of summaries often repeat similar information.”article, stated

Send the entire file directly through multiple summary calls

Rejected because: Each LLM call creates another chance for hallucination and makes errors harder to pinpoint.

“each call made to the LLM presents a chance for hallucination, making the problem exponentially worse when summarizing summaries.”article, stated

Precompute embeddings and AI responses ahead of time

Rejected because: Real-time processing lets users choose exactly which files are shared with the LLM and avoids unused precompute cost.

“Computing these transformations ahead of time allows for lower latency, but we settled on computing responses in real time”article, stated

Do not cache embeddings

Rejected because: The initial version made repeated LLM calls for the same document.

“In our initial version, embeddings were not cached, resulting in multiple calls to the LLM for the same document.”article, stated

Patterns

rag-retrieval (retrieval)

Q&A embeds the query, retrieves similar text chunks, and sends selected context to the LLM for answering.

“By calculating the closeness of each chunk to the query in vector space, the most relevant chunks are selected.”article, stated

semantic-caching (optimization)

Dropbox caches transcripts and embeddings as Riviera conversion states so summaries and Q&A can reuse them.

“If a user wants to summarize a video, then ask some follow-up questions, we only have to generate the transcript and embeddings once.”article, stated

retrieval-ranking (retrieval)

Multi-file Q&A ranks chunks by relevance scores and cuts off low-score portions of the spread.

“Our solutions takes the max and min relevance scores from the top 50 text chunks related to the user query, as calculated through the embeddings, and cuts off the bottom 20% of that spread.”article, stated

structured-output-contract (engineering-practice)

Dropbox uses function calling and structured outputs to request follow-up questions alongside summaries or answers.

“To gather these follow-up questions, we utilize function calling and structured outputs to request follow-up questions from the LLM at the same time we request the summary or an answer to the initial question.”article, stated

privacy-preserving-processing (governance)

Dropbox computes AI responses in real time so users decide which files are shared with the LLM.

“it allows the user to choose which files to share with the LLM—and only those files.”article, stated

latency-optimization (operations)

Embedding caching, context selection, and file-conversion reuse reduced p75 summary and query latency substantially.

“The p75 latency of summaries decreased from 115 seconds to 4 seconds, and the p75 latency for queries decreased from 25 seconds to 5 seconds.”article, stated

Tradeoffs

Summary context selection

Chose k-means clustering for diverse representative chunks over map-reduce summary-of-summaries.

Rationale: K-means improved topic diversity and reduced hallucination opportunities by using one final LLM call.

“We found k-means clustering was better than alternatives such as a summary-of-summaries approach in a couple of ways”article, stated

AI response timing

Chose real-time responses over precomputing responses ahead of time.

Rationale: Real-time computation lets users control file sharing and avoids precomputing unused answers.

“Privacy and security is a top priority at Dropbox, so this was an easy choice to go with. As a side benefit, computing these requests in real-time would also save us the cost of pre-computing requests that a user might never make.”article, stated

Embedding architecture

Chose embeddings as cacheable file conversions over embedding generation coupled directly to every summary or Q&A call.

Rationale: Separating embeddings from generation lets Dropbox reuse conversions and share the same cache across features.

“By separating the embedding generation from the actual summary generation we can reuse the cache features built into Riviera.”article, stated

Gotchas (what bit them)

Summary-of-summaries loses topic diversity.

Root cause: Intermediate summaries repeat similar information before the final merge.

Resolution: Dropbox uses k-means to select semantically dissimilar representative chunks.

“Combining these summaries results in a significant loss of overall file content. Using k-means clustering, we discovered that the summaries covered a broader range of topics—approximately 50% more than with map-reduce, since we search for chunks that are semantically dissimilar to one another.”article, stated
“Using k-means clustering, we discovered that the summaries covered a broader range of topics—approximately 50% more than with map-reduce, since we search for chunks that are semantically dissimilar to one another.”article, stated

Multiple LLM calls compound hallucination risk.

Root cause: Every LLM call in a map-reduce summary chain creates a new chance to hallucinate.

Resolution: K-means creates one representative context blob for a single summary-generation call.

“each call made to the LLM presents a chance for hallucination, making the problem exponentially worse when summarizing summaries.”article, stated
“Using the k-means technique, pinpointing errors in the final output—especially when comparing between LLMs or models—becomes much easier”article, stated

One-file AI understanding did not meet multi-file user needs.

Root cause: Users often need answers across selected collections rather than one document.

Resolution: Dropbox expanded Riviera and context-selection algorithms for multi-file summary and Q&A.

“The first iteration of intelligent summaries and Q&A was limited to one file at a time—but we knew we could do better for our customers.”article, stated
“Building on our existing file processing pipeline, we expanded Riviera’s capabilities to handle multiple files simultaneously inside of a single plugin. The embeddings plugin would still be separate for every file, but the final summarization or Q&A plugin call would need to take in multiple files.”article, stated

Uncached embeddings wasted repeated work.

Root cause: The initial version repeatedly called the LLM for the same document.

Resolution: Dropbox cached embeddings and reused the same chunks for summaries and Q&A.

“In the subsequent version, embeddings are cached, reducing the number of API calls and improving performance. This optimization also allows summaries and Q&A to use the same chunks and embeddings, further enhancing efficiency.”article, stated

Evaluation

Dropbox evaluates the architecture through topic diversity, hallucination risk, cost, p75 latency, context relevance, and feature availability in early access.

Metrics: About 300 file types · About 2.5 billion requests per day · Nearly an exabyte per day · Approximately 50% broader topic coverage than map-reduce · Top 50 query-related chunks · Bottom 20% score-spread cutoff · 93% cost-per-summary reduction · 64% cost-per-query reduction · Summary p75 latency 115s to 4s · Query p75 latency 25s to 5s

3 supporting quotes
“We currently support conversions between about 300 file types, and the system crunches through about 2.5 billion requests—totalling nearly an exabyte, or one billion gigabytes of data—per day.”article, stated
“Cost-per-summary dropped by 93%, and cost-per-query dropped by 64%. The p75 latency of summaries decreased from 115 seconds to 4 seconds, and the p75 latency for queries decreased from 25 seconds to 5 seconds.”article, stated
“The p75 latency of summaries decreased from 115 seconds to 4 seconds, and the p75 latency for queries decreased from 25 seconds to 5 seconds.”article, stated

Outcomes

Dropbox reports about 300 supported file types, about 2.5 billion conversion requests and nearly an exabyte per day, roughly 50% broader topic coverage with k-means than map-reduce, a top-50-chunk relevance selection, 93%/64% cost reductions, and p75 latency reductions from 115s to 4s and 25s to 5s.

3 supporting quotes
“These optimizations have not only made summarization and Q&A more affordable for Dropbox, but more responsive for our users.”article, stated
“File previews with AI-powered summaries and Q&A are available in early access on select Dropbox plans. Visit our Help Center to learn more.”article, stated
“we can use machine learning to get them the answers they need—without them having to remember exactly how a piece of information was worded”article, stated