Two AI models, one price
from Priced
01Why two models
Priced gives one price for a product, and two AI models make it. Each one sees something the other doesn't.
The first is a small model fine-tuned for one job: read a product description and say its price. It is Qwen3-4B, trained on 20,000 products, and it runs on a GPU at Modal. It is fast and cheap, but it knows only the prices it was trained on. It came from an earlier Python project; Priced calls it over HTTP.
The second is a general model from OpenAI, GPT-6 Luna, through OpenRouter. Priced calls it the frontier model. Before it answers, Priced finds the 5 most similar products in its index and shows them to it. It reasons about them and explains its price.
02The blend is one line
From ensemble.ts:
const FRONTIER_WEIGHT = 0.7;
const SPECIALIST_WEIGHT = 0.3;
export function blendPrices(frontier: number, specialist: number): number {
return FRONTIER_WEIGHT * frontier + SPECIALIST_WEIGHT * specialist;
}
The frontier model gets 70%, because it sees the similar products and can explain its number. The fine-tuned model gets 30%, so the price stays anchored when the frontier model drifts.
The split came with the earlier Python project, as a starting point. It has not changed since. The last part shows what the numbers say about it.
03How sure it is
A price with no sense of how sure it is misleads. Priced does not ask the models how sure they are, because a model's own confidence is not reliable. It measures two things instead:
- how close the two prices are (agreement)
- how close together the prices of the 5 similar products are (tightness)
From ensemble.ts:
const hi = Math.max(frontier, specialist);
const agreement = hi > 0 ? clamp01(1 - Math.abs(frontier - specialist) / hi) : 0;
const tightness = comparableTightness(comparablePrices);
const score = clamp01(0.6 * agreement + 0.4 * tightness);
return { score, label: labelFor(score) };
Below 0.4 the label is low, below 0.7 medium, and from 0.7 up high. When one model is missing, there is nothing to agree with. The score then rests on tightness alone and stops at 0.69, so a price from one model is never shown as high.
04When the fine-tuned model is asleep
The GPU at Modal shuts down when nobody uses it. That keeps it cheap, but waking it takes 30 seconds or more. Once it took 159 seconds.
At first, the price waited for it. In one week on the live site, 23 of the 33 estimates that used both models waited 32 to 87 seconds.
So Priced now waits at most 10 seconds. Awake, the model answers in 1 to 3 seconds, and the fastest wake-up seen was 30 seconds, so a wait between 10 and 30 seconds buys nothing. After 10 seconds, the frontier model prices alone.
A test against the real service then showed a catch: when Priced gave up on the request, Modal stopped waking the model.
With few visitors, it would almost never be awake.
So the estimate stops waiting, but the request keeps running in the background, and an estimate that comes soon after finds the model awake.
From specialist.ts:
const call = callSpecialist(description, cfg, SPECIALIST_COLD_START_MS);
let timer: ReturnType<typeof setTimeout> | undefined;
const limit = new Promise<never>((_resolve, reject) => {
timer = setTimeout(() => {
// Fall back first: nothing in keepAlive may hold up the estimate.
reject(new SpecialistError(`specialist gave no answer within ${timeoutMs} ms`, "timeout"));
keepAlive(call);
}, timeoutMs);
});
try {
return await Promise.race([call, limit]);
} finally {
clearTimeout(timer);
}
On Cloudflare, keepAlive hands the request to the Worker's waitUntil.
That keeps it alive for about 30 seconds after Priced's response ends, so a very slow wake-up is still cut short.
One case works the other way round. When the month's AI budget is spent, the frontier model is off, and the fine-tuned model is the only price. Then Priced waits for it up to 5 minutes, because a slow price is better than no price. The code review of this change found that case.
After the change, the median estimate on the live site took 13.6 seconds, from Estimate to a price.
05Does the blend earn its place
Priced has an eval: the whole estimate, run on 100 products that are not in its index. A hit is a price within $40 or 20% of the real one. The run of 28 September 2026, before the prompt fix below:
$59.79average error, the fine-tuned model alone, with 59% hits
Source Priced's eval on 100 products, 28 September 2026
$53.44average error, the frontier model alone, with 63% hits
Source Priced's eval on 100 products, 28 September 2026
$50.23average error, the blend, with 66% hits
Source Priced's eval on 100 products, 28 September 2026
From one run to the next, the average error moves by about $3. So the blend clearly beats the fine-tuned model, but its lead over the frontier model alone, about $3, is the size of the noise.
The eval also found a real problem. The catalog is mostly products under $100, so the similar products pulled prices down. The frontier model's prompt now says so, and tells it to price from its own knowledge when no similar product is the same kind. For products between $150 and $400, the frontier model's prices went from $52 too low, on average, to $7 too low. The blend's average error went to $49.09, with 67% hits. That is within the noise too: the real change is in the $150 to $400 range.
The test products come from the same catalog, with none over $1,000. The eval says nothing about products outside it.
These numbers are what the 70/30 split can be revisited from. One idea is to give the fine-tuned model less weight on products unlike the ones it was trained on, which this eval can't measure yet. Expensive products show the blend's limit: on the 4 test products over $400, the fine-tuned model was $293 too low on average, and the frontier model about $400 too low, before the prompt fix and after it. No split fixes that.