GEMINI LABJP
API — The Interactions API reaches general availability as the primary API for Gemini models and agents, with a stable schemaAGENTS — With GA, the Interactions API formally supports Managed Agents and background execution, with Gemini Omni coming soonLIVE — The Live API and AI Studio add real-time speech-to-speech translation, auto-detecting 70+ languages while preserving intonationOMNI — Gemini Omni Flash, a natively multimodal model, enters API public preview for building custom video workflowsSPARK — Gemini Spark, Google's personal agent, arrives on macOS to work across local files and Google Workspace on your behalfPRO — Gemini 3.5 Pro is reported to be delayed to July 17, centered on a 2M-token context and a Deep Think Reasoning LayerAPI — The Interactions API reaches general availability as the primary API for Gemini models and agents, with a stable schemaAGENTS — With GA, the Interactions API formally supports Managed Agents and background execution, with Gemini Omni coming soonLIVE — The Live API and AI Studio add real-time speech-to-speech translation, auto-detecting 70+ languages while preserving intonationOMNI — Gemini Omni Flash, a natively multimodal model, enters API public preview for building custom video workflowsSPARK — Gemini Spark, Google's personal agent, arrives on macOS to work across local files and Google Workspace on your behalfPRO — Gemini 3.5 Pro is reported to be delayed to July 17, centered on a 2M-token context and a Deep Think Reasoning Layer
Articles/Advanced
Advanced/2026-07-10Advanced

The Day We Went From 30 Categories to 34 — Reclassifying 1,180 Assets Instead of 8,142

Adding categories to a taxonomy does not require reclassifying everything. Here is how embeddings and confidence margins narrowed a backfill from 8,142 assets to 1,180, with the numbers.

Gemini API178Image Classification2gemini-embedding-25TaxonomyCost Optimization11Indie Development9

Premium Article

When I expanded my wallpaper app's taxonomy from 30 categories to 34, the first thought was not about naming or UI. It was: what happens to the 8,142 images that are already classified?

A new category always steals from existing ones. Add "Night Cityscape" and some images currently filed under "Landscape" or "Urban" genuinely belong somewhere else now. But sending all 8,142 images back through Gemini felt wasteful in both money and wall-clock time.

Every time I face this trade-off as an indie developer, I am reminded that the design work is deciding where correctness and cost meet. Here is where I drew that line, using two signals: embeddings and confidence margins.

First, Put a Number on the Full Rerun

Before deciding anything, I priced out the naive approach. Each image goes to a Flash-tier model at roughly 768px along with the label definitions, and the model returns its top two labels as structured output.

MetricFull reclassification
Assets8,142
Input tokens per image (image + prompt)~1,120
Output tokens per image~45
Estimated cost~¥3,900
Wall-clock time (concurrency 8)4h 12m
Assets whose label actually changed1,046 (12.8%)

That last row is the whole story. We sent 8,142 images and 1,046 of them changed. Which means 87% of the calls confirmed an answer we already had. Skip those 87% and the cost and the waiting shrink with them.

To be clear about provenance: I did run the full pass once, purely to have ground truth for evaluating the selective method. In day-to-day operation, that full pass is exactly what we are trying to avoid.

Only Two Kinds of Assets Need a Second Look

A new "Night Cityscape" category can only steal from labels that are semantically adjacent to it. Images filed under "Cats" or "Geometric" are not going to migrate there.

So I defined the reclassification set as the union of two groups:

  1. Impacted-label assets — those carrying an existing label that sits close to a new category in embedding space.
  2. Boundary assets — those whose original classification had a small confidence margin, meaning the model was already torn.

The first group covers "the answer may change because of the new category." The second covers "the answer was shaky regardless." Without the second group, an ambiguous frame that could read as either landscape or night cityscape slips through the impacted-label net entirely.

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
The selection rule that shrank a full backfill (8,142 assets, ~¥3,900, 4h12m) to 1,180 assets (~¥570, 38m), with measured results
Using gemini-embedding-2 to find which existing labels a new category will steal from, before sending a single image
A classification ledger with taxonomy_version and confidence margin — plus an analysis of the one boundary asset the method missed
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

Advanced2026-07-10
Images Made With a Retiring Model Can Never Be Made Again — Tracking Regenerability in a Ledger
When Gemini's image generation models shut down on August 17, the assets you made with them can no longer be reproduced the same way. Here is the ledger design and code I use to decide, before the deadline, which assets are regenerable and which must be frozen.
Advanced2026-07-01
Getting Artifacts Out of a Managed Agents Sandbox Safely — Scoped Credentials and Egress Design
Gemini API Managed Agents run in a Google-hosted isolated sandbox. Here is the short-lived, least-privilege credential and egress-boundary design I use to return generated artifacts to my own repository safely.
Advanced2026-06-01
Trimming Gemini Embeddings from 3072 to 768 Dimensions: A Matryoshka Approach to Cutting Vector DB Cost and Latency
gemini-embedding-001 returns 3072-dimensional vectors, but thanks to Matryoshka representation you can keep only the leading dimensions with almost no quality loss. This is a design for trimming to 768 to cut vector DB storage and latency, including the re-normalization pitfall and coarse-to-fine search code.
📚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 →