Skip to main content
Every other cookbook runs on hundreds of rows. Does anything change at that size: the cost, the speed, the store, the time to re-run? To find out, hunch asked one yes/no question of 100,000 Amazon product reviews, sampled from the amazon_polarity dataset (Apache 2.0). Its label says whether a review gave 4–5 stars or 1–2, which makes it the answer key. The example is in prototype/examples/scale/.

The spec

reviews.yml

What the run measured

At that rate, a million rows would take about five hours and cost about $16 with Jev.

The estimate ran high

compile estimated 1.72;therunbilled1.72; the run billed 1.55. The estimate counts characters and the engine bills tokens, so it errs high, which is the safe side for a --max-cost ceiling. Answers are saved as each request returns, so a run stopped partway keeps what it got.

Speed is concurrency, not a rate limit

The first guess was that the API’s rate limit would set the pace. It did not: no request was rate-limited at any setting. Throughput is simply how many requests are in flight divided by how long each one takes. HUNCH_CONCURRENCY sets the number in flight; the default is 16. On a 2,000-row probe, 16 gave 63 requests per second and 48 gave 84. The full run used 32 and averaged 57.5. Rate limits, server errors and network failures are retried with backoff.

Re-runs are cheap enough to skip incremental mode

Every run hashes every row and looks each one up in the store. With everything cached, that took 4 seconds for 100,000 rows. So there is no incremental mode to configure: change the source, and only new or changed rows are asked. on_change: new_rows_only goes further and keeps answers for unchanged rows even after the spec changes; see Change a spec.

Cost is input tokens

Jev bills input tokens at $0.042 per million, and output is free. Three settings keep input small: send only the columns the question needs (state), cut long text with clip, and ask all of a row’s questions in one spec, since with Jev they share one request.

What did not work

test first took 156 seconds on this run. Computing AUROC compared every positive review with every negative one, 2.5 billion pairs. It now ranks the answers instead and takes 4.8 seconds, with identical results.