GEMINI LABJP
FLASH35 — Gemini 3.5 Flash is now GA and powers gemini-flash-latest, making everyday generation faster and more affordableAGENTS — Managed Agents launch in public preview in the Gemini API, running in secure, isolated Google-hosted Linux sandboxesMEDIA — Nano Banana 2 Lite and Gemini Omni Flash bring faster image and high-quality video generation across AI Studio and the APITTS — Streaming speech generation is now supported for gemini-3.1-flash-tts-preview via streamGenerateContentTRANSLATE — A new audio model detects 70+ languages for live speech-to-speech translation while preserving natural intonationSPENDCAP — Project-level spend caps for billing have been added in Google AI Studio to keep costs under controlFLASH35 — Gemini 3.5 Flash is now GA and powers gemini-flash-latest, making everyday generation faster and more affordableAGENTS — Managed Agents launch in public preview in the Gemini API, running in secure, isolated Google-hosted Linux sandboxesMEDIA — Nano Banana 2 Lite and Gemini Omni Flash bring faster image and high-quality video generation across AI Studio and the APITTS — Streaming speech generation is now supported for gemini-3.1-flash-tts-preview via streamGenerateContentTRANSLATE — A new audio model detects 70+ languages for live speech-to-speech translation while preserving natural intonationSPENDCAP — Project-level spend caps for billing have been added in Google AI Studio to keep costs under control
Articles/API / SDK
API / SDK/2026-07-06Advanced

Ingested but Never Cited: Pruning a File Search Store with Citation Logs and a Quarantine Window

Most documents in a File Search store are never cited, quietly draining both cost and retrieval quality. Learn to log grounding metadata, surface never-cited documents from real usage data, and prune them safely with a quarantine window — with working code.

gemini102file-search4grounding8rag22cost-optimization30

Premium Article

I had been running an indie FAQ assistant on File Search for about six months when a store billing detail stopped me cold. Of the 320 documents I had ingested, only around 70 had actually been cited as the basis for an answer in the last 90 days. Nearly 80% of the rest had been sitting there — silently paying embedding and storage costs — without ever being pulled once.

The awkward part was that this was not purely a cost problem. As unused documents accumulate, they inflate the pool of candidate chunks that retrieval considers, which makes the genuinely useful documents less likely to surface near the top. A bloated store was slowly eroding both my wallet and my answer quality.

Here I want to build the operational loop I actually use for the assistant I run at Dolice: record the real citation data — the grounding metadata — on every call, and use it to prune "ingested but never cited" documents safely, behind a quarantine window. It is written so you can lift the design straight into your own setup.

Why "never-cited" documents hurt you twice

File Search store cost comes in two layers: a one-time charge when embeddings are generated, and an ongoing storage charge for keeping the document around. From the moment of ingestion, a document accrues storage cost whether or not it is ever cited.

The effect that is easy to miss is on retrieval accuracy. Vector search returns the top-k results, but when semantically-near-yet-stale, duplicated, or off-target documents are mixed into the store, they occupy those top slots and push the real answer out. In my own environment, three leftover duplicate copies of an old manual version knocked the latest version out of the top-k, so the assistant quietly answered with outdated steps — a subtle but real failure.

In other words, unused documents make you pay storage while simultaneously diluting answer quality. It is more accurate to treat pruning not as belt-tightening but as raising the signal-to-noise ratio of retrieval.

The shape of the design — measure, quarantine, and verify before deleting

Safe pruning breaks into three stages. The crucial rule is: never delete outright.

StageWhat it doesWhat it protects
MeasureAppend the cited file_id of every query to a ledgerGrounds the decision in real data
SurfaceCompare the store listing against the ledger; flag documents that are uncited and older than a thresholdAvoids misfiring on freshly ingested documents
Quarantine & verifyInstead of deleting candidates, pull them from the store for a set period, then delete only if nothing breaksPrevents losing rarely-used documents

The reason this design is necessary at all is the existence of documents that are cited rarely but are decisive when they are. A pricing-change notice referenced once a quarter, or a fix note for an error that only appears on one device model, may look uncited within a 90-day observation window — but must not be deleted. The quarantine window is the grace period that lets you catch those misses.

Thank you for reading this far.

Continue Reading

What follows includes implementation code, benchmarks, and practical content we hope you'll find useful. This site runs without ads — server and development costs are supported entirely by members like you. If it's been helpful, we'd be truly grateful for your support.

WHAT YOU'LL LEARN
Identify the never-cited documents piling up in your File Search store from real citation logs instead of guesswork
Get copy-paste code to record and aggregate citation telemetry, ready to drop into a weekly cleanup job
Avoid the classic mistake of deleting rarely-but-critically used documents, using a quarantine window and an allowlist guard
Secure payment via Stripe · Cancel anytime

Unlock This Article

Get full access to the rest of this article. Buy once, read anytime. This site is ad-free — your support goes directly toward keeping it running.

or
Unlock all articles with Membership →
Share

Thank You for Reading

Gemini Lab is ad-free, supported entirely by members like you. We publish practical guides daily with implementation code, benchmarks, and production-ready patterns. If you've found it useful, we'd love to have you on board.

  • Copy-paste ready implementation code
  • New advanced guides published daily
  • $5/mo or $10 for lifetime access
View Membership →

Related Articles

API / SDK2026-06-24
Citing the exact page and figure in File Search answers with visual-citation metadata
File Search grounding metadata now carries media_id and page_numbers, so you can trace each sentence of an answer back to a specific page and figure. Here's how I built a sentence-level, verifiable citation layer over a mix of PDFs and images.
API / SDK2026-06-23
Your File Search Store Goes Stale in Production — Catalog Sync and Drift Detection That Actually Hold
Load a catalog into File Search once and forget it, and within weeks it starts confidently pointing users at assets you already pulled. Here is the sync pipeline I run: hash-based incremental import, a blue/green rebuild that swallows deletions, and a nightly drift audit.
API / SDK2026-03-27
Gemini File Search API — Build AI Responses Grounded in Your Own Data Without RAG
Learn how to use Gemini File Search API to build AI responses grounded in your own documents without vector databases or RAG pipelines, with production-ready implementation patterns.
📚RECOMMENDED BOOKS
Build a Large Language Model (From Scratch)
Sebastian Raschka
LLM Dev
Prompt Engineering for LLMs
Berryman & Ziegler
Prompting
AI Engineering
Chip Huyen
AI Eng
* Contains affiliate links
See all →