Document Q&A estimate: chunks, storage and cost
Example sizes and prices. The index overhead of 1.5 is a rule of thumb, so measure it for the store you choose.
Design a service that answers questions from millions of private documents for many companies, with ingestion, hybrid retrieval, citations, freshness, deletes and strict separation between tenants. The estimator gives storage, ingestion cost and question cost.
Change the code and press Run (Ctrl+Enter). Predict what will happen first, then break it on purpose and read what changes. Your edits are saved and match the lesson page.
Ready for more? This phase has 5 hands-on exercises with automatic checks.
Practice questions
Write the code in the editor, run it, then open the model answer to compare.
Write chunks_for(doc_tokens, chunk, overlap) that returns how many chunks a document makes (1 if it fits in one chunk). Print the result for documents of 300, 400, 401, 1,000 and 3,000 tokens with chunk 400 and overlap 50.
Write vector_gb(chunks, dimensions, bytes_per_number=4) and print the storage of 18 million chunks with 1,024 dimensions in float32 and in float16, and with 384 dimensions in float32.
Explain it without notes
Why do you keep ingestion and the query path separate?
Why must the permission filter be applied inside the search, not after it?
How do you handle a document update and a delete?
How would you evaluate retrieval separately from the final answer?
Expected output
chunks per document: 9, chunks in total: 18000000
vectors: 73.7 GB raw, 110.6 GB with index; chunk text: 28.8 GB
embedding cost: first load 720 dollars, then 14 dollars per day for changed documents
one question: 2520 tokens in, 250 out, 1.635 dollars per 1000 questions
questions cost per month: 4905 dollars
peak questions per second: 6.94, vector lookups at peak: 34.7 chunks per second