Product Launch · XiaoHu Explains

Google Cloud Fits AlloyDB with Proxy Models: On-Database AI Judgment, Up to 23,000x Faster

Local small models replace cloud AI calls — data from Google's internal testing; proxy models are currently available only for the ai.if function and are in preview.
60-Second Summary
  • Google Cloud adds three new AI functions to AlloyDB (its PostgreSQL-compatible database) — ai.analyze_sentiment, ai.summarize, ai.agg_summarize — while ai.generate, ai.rank, ai.if, and ai.forecast are now generally available (GA).
  • Smart Batching merges multiple rows into a single call, sharing the prompt overhead — internally tested up to 2,400x faster than calling a large model row-by-row, reaching 10,000 rows per second; currently available for ai.if and ai.rank.
  • Proxy models (optimized mode) train a lightweight local model based on data vector embeddings for ai.if, making judgments directly inside the database — internally tested at 100,000 rows per second (23,000x faster), with cost dropping below a tenth of a cent (6,000x cheaper).
  • The idea traces back to Google DeepMind's 2024 NeurIPS paper UQE, paired with this year's SIGMOD 2026 paper: across 10 benchmarks, F1 reaches 90% to 102% of calling the large model directly — and on the Amazon reviews benchmark it even beats it, at 116%.
  • Proxy models currently support only ai.if and are in preview; scenarios requiring multi-step reasoning, or with extremely imbalanced positive/negative samples, automatically fall back to calling the cloud-based large model.
This article is compiled from Google Cloud's official launch blog, two companion technical blog posts, and InfoQ's analysis. The 2,400x, 23,000x, and 6,000x speedup/cost figures cited come from Google's internal testing, not independent third-party reproduction; proxy models (optimized mode) are currently available only for ai.if and remain in preview.
1 This Update

Google Just Put AI Judgment Straight Inside the Database

On July 2, 2026, Google Cloud announced a full rollout of "AI functions" for its AI-native database AlloyDB, paired with two acceleration features: Smart Batching and proxy models.

The core change: you can now write a single line of SQL that has Gemini judge the "meaning" of your data directly — and that judgment can run locally inside the database at high speed, without calling out to a cloud-based large model for every single row.
In internal tests, judgments made with a trained local proxy model reached 100,000 rows per second23,000x faster than calling an external large model row-by-row, with the cost per judgment dropping to under a tenth of a cent.
2 Some Groundwork

What AlloyDB Is, and What It Means to Put AI Inside a Database

To grasp the weight of this update, you first need two things straight: what AlloyDB actually is, and what "putting Gemini inside it" really changes.

AlloyDB is a relational database on Google Cloud, compatible with PostgreSQL (one of the world's most popular open-source databases — think of it as Google Cloud's enhanced version of PostgreSQL). Businesses use it to store orders, users, product reviews, and system logs, querying it with SQL.

Traditional databases have an inherent limitation: they only do exact literal matching. You can easily query "products priced under 100" or "orders with status completed," but you can't directly query "negative reviews complaining about battery life" or "angry-toned support tickets" — that requires understanding the meaning of text, and a database doesn't understand meaning. Previously, this kind of "meaning-based" analysis meant exporting the data, running it through a separate AI pipeline, and importing the results back — slow, and you had to maintain that whole pipeline yourself.

What AlloyDB has now done is turn Gemini's comprehension ability into a set of SQL functions (called AI functions) and embed them directly into the database itself. So now you can write a judgment about "meaning" in a plain SQL statement, and the database just understands it — picking out the matching rows without moving the data anywhere.

Before · Literal Matching Only

Could only query explicit fields and values:
WHERE price < 100

For "meaning-based" analysis: export data → external AI pipeline → import back. Slow, hard to maintain.

Now · Meaning-Based Queries

Have AI judge meaning right in the SQL:
WHERE ai.if(review, 'complains about battery')

The database itself understands "complains about battery" — the judgment happens right in this query, and the data never leaves the database.

That's the significance here: the database is upgraded from "exact literal matching only" to "meaning-based querying," with semantic search, structured queries, and AI judgment all happening within the same SQL layer. That's a powerful capability, but it brings a new headache: calling a large model for every single row gets slow and expensive fast once row counts climb. So the real centerpiece of this release isn't the functions themselves — it's how to make them powerful, fast, and cheap all at once.

3 New Functions

What's Actually New in This Set of AI Functions

First, let's look at what this set of AI functions can do. The most intuitive use case: turning messy, hard-to-parse raw text directly into structured, searchable content — right in SQL.

For example, using ai.generate to automatically break an error log into structured fields:

Raw Error Log (a Headache to Read)
[ERROR] Service: OrderSvc | DbConnectionTimeout: Failed to acquire connection from pool "primary-shard-04" after 5000ms.
Structured JSON from ai.generate
{
  "errorCode": "DbConnectionTimeout",
  "serviceName": "OrderSvc",
  "rootCause": "Failed to acquire a connection from the primary shard pool within the 5000ms timeout"
}

A messy log line gets automatically split into three queryable, filterable fields: error code, service name, and root cause. Three new functions have been added:

  • ai.analyze_sentiment: judges whether a piece of text is positive, negative, or neutral in tone.
  • ai.summarize: compresses long text into a summary while preserving the original tone and nuance.
  • ai.agg_summarize: an aggregate function that combines a group of rows (paired with GROUP BY) into one unified summary.

Add in ai.generate, ai.rank, ai.if, and ai.forecast — already GA — and that's the full lineup of AI functions. For instance, ai.agg_summarize can roll up a pile of reviews for a product into one overall verdict: "Multiple users praise the 4K resolution, 120Hz frame rate, and ergonomic controller; some complain the fan gets loud during long play sessions. Overall a top-tier console, with heat and noise as minor flaws."

4 The Pain Point

Why It Used to Be Slow and Expensive

The most direct way to apply a large model's judgment across a whole table is to call it once per row. Once row counts climb, that approach falls apart.

InfoQ lays out the problem concretely: for a table of 100,000 products, running a full-table judgment means 100,000 network round trips to Vertex AI. Every single one carries the same system prompt, every one waits on model inference, and every one is billed by token.

100,000 rows Cloud LLM Vertex AI × 100,000 round trips
100,000 rows means 100,000 network round trips to the cloud: every one resends the same system prompt, every one waits on inference, every one is billed by token. This repeated overhead is exactly what the next two moves are built to cut.
100,000
Round trips to the cloud for one full-table judgment on 100,000 products
10–100x
Roughly how much overall query latency grows with each added large-model call
~1000x
The corresponding increase in query cost
10M rows
A mid-sized analytics query — row-by-row calling burns through a prohibitively expensive amount of tokens

These figures come from Google's technical blog post this past May. The conclusion is blunt: for operational databases, this is too slow; for analytics use cases, the cost is high enough that many full-table semantic analyses simply aren't affordable.

Google uses two moves to break through this wall. Here's the overview first, showing how they relate to row-by-row calling — the further right, the less you touch the cloud large model, and the faster and cheaper it gets:

① Row-by-Row CallsBaseline 1x · Slow and Expensive
② Smart Batching2,400x · Prompt Sent Once
③ Proxy Models23,000x · Local Model Takes Over

Let's break down each of these two moves.

5 Smart Batching

Move One: Bundling Many Rows into a Single Call

The idea behind Smart Batching is simple: since every call carries the same system prompt, merge many rows into one request so that prompt only gets sent once.

Old Way · Row-by-Row Calls

100,000 rows = 100,000 requests, the same system prompt resent 100,000 times.

New Way · Smart Batching

Many rows bundled into one request, the system prompt sent once, repeated overhead amortized away.

Why not batch at the application layer yourself? Because getting the batch size right is tricky: too small and you barely save on cost or latency; too large and the bloated prompt can trigger hallucinations, or blow past the model's token limit. AlloyDB automatically calculates the optimal batch size for each request, and handles retries automatically too.

Multiple Rows
AlloyDBAuto-Computes Batch Size
Merged into One CallWith Shared Prompt
Sent to LLM
Results SplitBack to Each Row
2,400x
Internal testing: Smart Batching's throughput gain over row-by-row calls
10K rows/sec
Corresponding processing speed; currently supports ai.if and ai.rank

It also understands numeric constraints, not just semantic similarity. Take an example: a user on a digital goods marketplace is looking for a camera "rated to dive 60 meters or deeper." A regular hybrid search would just match on semantics and keywords to find the closest fit — it can't grasp a hard numeric constraint, and might recommend a camera only rated to 20 meters. Using ai.if for smart filtering, the database actually understands the "depth" constraint and only returns products that meet or exceed 60 meters. And with ai.if you don't need to specify a batch size yourself — AlloyDB handles that optimization under the hood.

6 Proxy Models

Move Two: The Database Trains Its Own Stand-In Model to Make Judgments

Batching saves on repeated overhead; proxy models go further — letting the database train its own small model that can run locally, taking over most judgments so it doesn't even need to ask the large model anymore.

Core Innovation

A large model labels a small batch of data "yes / no" as a teacher, and that trains a tiny classifier that consumes vector embeddings. From then on, queries use this local model directly to judge — getting millisecond results on the database's ordinary CPU, no external large model involved. Internal tests show a 23,000x speedup and a 6,000x cost reduction.

A proxy model is a tiny model trained specifically for a given problem and a given dataset, used only to quickly answer "yes / no" style judgment questions. When it hits something it can't judge, it automatically hands off to the large model.

An Analogy

Like assigning a teaching assistant who's only studied one specific type of problem: fast and accurate on that type; switch to a different type of problem, and you need to call in the real teacher (the large model).

The Whole Process Has Two Phases: Train, Then Execute

It splits the work across two SQL statements: PREPARE trains the model in the background, and EXECUTE uses the trained model to run live queries.

Prep Phase · PREPARE (Background, One-Time)
Sample ~1,000 Rows
LLM Labels DataTRUE / FALSE, as Teacher
Train Small Logistic Regression Model
Evaluate on Test Samples
Execute Phase · EXECUTE (Live, Per Query)
New Query Comes In
Local Model JudgesMilliseconds on CPU
Low Confidence / No Model Found?
Auto-Fallback to LLM

Training happens in the background PREPARE phase, and the large-model cost of this step is a one-time expense; the live EXECUTE phase then uses the trained local model directly for judgment. Only when the model's confidence is low, or no matching model can be found, does it automatically fall back to calling the large model as a backstop. Here's an official two-phase SQL example:

Two-Phase SQL Example (via InfoQ)
-- Phase 1: Train a local proxy model using a data sample + cloud LLM
PREPARE underwater_suitability_proxy FROM
SELECT description FROM products;

-- Phase 2: Execute the query at database speed using the local proxy model
SELECT * FROM products
WHERE ai.if(description, 'suitable for underwater use deeper than 60 meters')
USING proxy(underwater_suitability_proxy);

The condition in that second statement, suitable for underwater use deeper than 60 meters, is the exact judgment the diving camera from earlier needs to pass.

InfoQ frames this pattern as a reversal of the usual database-to-LLM relationship: previously the database was the client, calling out to an external model for every single judgment; now the database acts more like a student, first learning how the model judges on a batch of samples, then applying that at database speed locally. The large model's role shifts from a runtime dependency needed on every query, to a teacher that only shows up during training.

7 Why It Works

How Can This Stand-In Model Actually Understand Meaning

How can something as simple as logistic regression understand semantics like "interesting plot"? The key is that it isn't fed raw text — it's fed vector embeddings that already carry semantic information.

Two Terms First · Vector Embeddings

Converting the meaning of a piece of text into a string of numbers (a vector): text with similar meaning gets similar numbers; unrelated text gets numbers that are far apart. It's like plotting the meaning of every piece of text as a coordinate point on a map — the more similar the meaning, the closer the points sit.

One More Term · Logistic Regression

A very old, computationally cheap statistical judgment method that only does binary "yes / no" decisions — it doesn't need to understand language itself, only the patterns in the numbers. It's like drawing a dividing line on that coordinate map: one side counts as "yes," the other as "no," and training is just figuring out where to draw that line.

Put the two together: embedding models like Gemini or Gecko encode semantic concepts — "interesting plot," "great cinematography," "dull," "boring" — into different combinations of dimensions within the vector as they generate it (don't expect a single dimension to just mean "cinematography"). Training a logistic regression is essentially slicing a plane through this (hyper)sphere of embeddings, splitting the semantics into two halves: one side judged TRUE, the other FALSE. Which direction that plane cuts depends on the labels the large model assigned the training samples.

interesting plot great cinematography dull plot boring film TRUE side FALSE side Logistic regression: one cut
The semantic sphere is sliced by a plane into two halves: one side clusters positive semantics like "interesting plot / great cinematography," the other clusters negative semantics like "dull plot / boring film." That plane is the trained logistic regression classifier — it decides which side each row falls on.

This is also Google's signature diagram from their blog — a green plane slicing through the blue embedding sphere:

A green plane slices through a blue embedding sphere, showing the proxy model carving out relevant semantics within the embedding space
The proxy model (green plane) carves out task-relevant semantics by slicing through the embedding space (blue sphere). Image: Google Cloud

This makes the ultra-low latency and cost easy to understand: embeddings only need to be generated once, and every subsequent query reuses them — so the cost of encoding semantics into the data is amortized into a one-time expense; and logistic regression itself runs on an ordinary CPU, no specialized hardware required.

8 Accuracy and Limits

How Accurate Is It? When Does It Fail?

A proxy model is an approximation method, more limited than the large model. It performs well on problems that can be judged through embedding-based semantic patterns, but it's not suitable for complex reasoning or extremely imbalanced samples.

First, accuracy: the SIGMOD 2026 paper compares results across 10 benchmarks, and the proxy model's F1 lands at 90% to 102% of the large model's F1; on the Amazon reviews sentiment classification benchmark, the proxy model hits an F1 of 0.860, beating the large model's 0.739 — that's 116%. The paper's explanation: the proxy model is trained on a batch of samples and has seen the whole picture, while the large model treats every row as a brand-new question judged from scratch.

F1 score ranges from 0 to 1, measuring both "how accurate the judgment is" and "how completely it catches everything it should" — closer to 1 is better. Below are a few specific tests published in the paper:

BenchmarkProxy Model F1LLM F1Ratio
Amazon Reviews (Sentiment)0.8600.7391.16
California Real Estate (Region Judgment)0.9530.9531.00
Banking77 (Intent, Requires Step-by-Step Reasoning)0.7000.7070.99
FEVER (Whether a Claim Is Supported by Text)0.7820.8530.92

Now, when it fails — mainly two scenarios:

Failure Scenario 1 · Complex Reasoning

Judgments that require linking multiple semantic concepts together and multi-step reasoning go beyond pattern detection in embedding space — the proxy model will fail here.

Failure Scenario 2 · Extremely Imbalanced Samples

When TRUE or FALSE cases are so rare they're nearly absent, sampling can't gather enough of both classes to train a usable model — in this extreme case, the proxy model isn't enabled.

One more thing that's easy to conflate: a proxy model isn't the same as vector search. It's a classifier that judges each row TRUE / FALSE (or assigns it to a category); vector search does something different — it ranks results by a generic distance function (like cosine distance). And a proxy model is trained specifically for your data and your specific problem — even trying to simulate ai.if with vector search alone would be hard to set up well and would underperform. They're not the same thing.

9 Scale Effects

The Bigger the Data, the Bigger the Advantage

The proxy model's cost and time savings aren't fixed — they grow with data volume. Because training is a one-time cost, that expense gets amortized across every subsequent query, so the more you query, the better the payoff.

The paper's data for an online-training scenario (BigQuery) looks like this:

Data ScaleToken / Cost ReductionQuery Latency Speedup
1 Million Rows~400x30 to 100x
10 Million Rows~600x~300x

As the scale grows from a million to ten million rows, both the cost reduction and the latency speedup scale up with it. Applied to AlloyDB, the logic is even more favorable: the large-model cost of the PREPARE phase can be amortized across any number of subsequent query executions — the more the pre-trained model gets used, the lower the per-query cost. The chart below, from the SIGMOD 2026 paper, has table scale on the x-axis: cost reduction and latency speedup both climb with scale, approaching roughly 600x cost and 300x latency at ten million rows:

Cost reduction and latency speedup increase as table scale grows, reaching roughly 600x cost and 300x latency at ten million rows
Cost reduction (token consumption) and latency speedup (query acceleration) both increase as table scale grows, reaching roughly 600x cost / 300x latency at 10 million rows. Image: Google Cloud / SIGMOD 2026 paper
10 Maturity and Impact

How Usable Is This Right Now, and What Does It Mean for Other Databases

To know how ready this is for real use, you need to separate what's already GA from what's still in preview.

CapabilityCurrent Status
AI Functions (ai.generate / ai.rank / ai.if / ai.forecast, etc.)Generally available (GA), running on PostgreSQL 17
Smart BatchingGA for ai.if and ai.rank
Proxy Models (Optimized Mode)ai.if only, in preview, requires manually enabling a flag, off by default

To use proxy models, you have to manually flip a database flag (google_ml_integration.enable_ai_function_acceleration) — it's off by default. InfoQ also cautions: figures like 23,000x and 6,000x are internal test numbers that only hold for ai.if in preview, and don't represent typical performance across all AI functions — they should be tested against your own data distribution and query patterns before going to production.

How Practitioners Are Using It

Starburst architect Raimundas Juodvalkis offered a framing on LinkedIn: treat these as "governed database extensions," not a "magic WHERE clause." His three pieces of advice:

  • Start with read-heavy scenarios like review analysis — don't jump straight into heavy-duty workloads with it.
  • Be cautious before writing model-derived fields back into core systems.
  • Track model costs separately from query costs.

What This Means for Other Databases

InfoQ points out that any database that calls an external model for every row-level judgment hits the same cost and latency wall. Whether competitors like Aurora, Azure SQL, CockroachDB, and PlanetScale will follow with similar "query-time distillation" schemes, or leave users to build this optimization themselves at the application layer, remains to be seen.

This release also comes with a managed MCP server for AlloyDB, letting AI agents query the database via Model Context Protocol (an open protocol that lets AI directly call external tools and data) without having to build their own MCP infrastructure — on top of the existing ScaNN vector index (supporting up to 10 billion vectors). InfoQ sees AlloyDB positioning itself as a PostgreSQL-compatible database where structured queries, semantic search, and AI judgment all coexist within the same SQL layer.

This pattern flips the usual relationship between database and large model. Previously the database was the client, calling out to an external model for every single judgment; now the database acts more like a student, first learning how the model judges on a batch of samples, then applying that at database speed locally. The large model's role shifts from a runtime dependency needed on every query, to a teacher that only shows up during training.InfoQ|Steef-Jan Wiggers, 2026-07-09
Sources: Google Cloud's official launch blog "Boost Performance and Lower Costs with AlloyDB AI Functions" (2026-07-02); companion technical blog "More than 100x Faster & Cheaper LLM-Powered SQL Queries with Proxy Models" (2026-05-13); InfoQ analysis article (2026-07-09). The 2,400x, 23,000x, and 6,000x speedup/cost figures cited come from Google's internal testing; F1 and scale-effect data come from the SIGMOD 2026 paper (arXiv 2603.15970); the proxy model concept traces back to the NeurIPS 2024 UQE paper (arXiv 2407.09522). Proxy models (optimized mode) are currently available only for ai.if and remain in preview.