Inference cost: count successful logical tasks
Define a cohort and acceptance oracle before comparing costs across retries, output quality, and latency.
On this page
The question for today
What you’ll understand
- Define unique logical tasks and a quality-and-deadline success rule.
- Include unsuccessful attempts and shared overhead in the chosen numerator.
- Distinguish observed cohort ratios from expectations of random ratios.
A cheap request is not necessarily a cheap successful task. A system can reduce average attempt cost by producing shorter invalid answers, dropping difficult inputs, or retrying until an accounting window closes. Define the useful result first, then count all resources used to obtain it. All prices in this lesson are explicitly fictional stable teaching inputs in fictional credits, FC. We compute descriptive cohort metrics under an explicit quality and deadline rule. They are not vendor prices, guarantees of success, or a substitute for evaluating whether the system solves the intended task.
Give the logical task a stable identity
A logical task is the user-level unit whose outcome matters. It can generate several model attempts, tool calls, fallback requests, and human reviews. Propagate a stable identity through that work and choose how delayed attempts are charged to a cohort. Otherwise the cost of an initial failed response can land in one window while its successful retry lands in another, making both ratios misleading. Count one final qualified success per eligible task unless the application explicitly defines another useful unit.
The acceptance oracle combines the required content quality with the relevant deadline and other constraints. A completed transport request is not automatically a useful result. Keep offered, admitted, attempted, completed, and accepted task counts separately, and report rejected or unresolvable cases. Fix the workload mix before comparing configurations; selectively serving easy tasks can reduce a ratio while abandoning the original service. When the oracle is estimated or involves human judgment, preserve its version, uncertainty, and evaluation procedure alongside the cost results.
Include the full stated effort in the numerator
Include failed generations, speculative branches not accepted, retried tool calls, evaluation, and relevant shared overhead under a documented boundary. If a human review step is included, use an explicit fictional allocation rule rather than imply that model tokens describe its entire cost. Cache hits, input processing, output generation, and external operations can carry different quantities and rate rules. Do not add an already totalled cost field to the line items that produced it, and do not count a retry twice merely because it appears in two telemetry systems.
An observed cohort can be summarized through its measured success fraction, but an expectation over future random cohorts is another calculation. Dividing an expected numerator by an expected success count does not generally equal the expectation of their ratio. Small cohorts can have zero successes, making an unconditional ratio undefined, and costs can correlate with difficult failures. Publish raw totals, workload classes, and uncertainty. A simulation or analytic model of future outcomes needs its own assumptions about those dependencies rather than inherit certainty from a clean-looking aggregate.
Compare costs only after checking useful output
Replay or randomize a controlled workload with fixed task identity, oracle, deadline, and accounting horizon. Report the distribution across task classes rather than hide a poor difficult-task result inside an easy majority. A lower success cost can coexist with lower overall availability or much worse tail latency. State the required success rate and offered demand as constraints, and include all attempts caused by the policy. Compare complete service outcomes before using the ratio to decide which implementation should receive more traffic.
The probability lab illustrates a deliberately simple known-probability denominator. Reset, explicitly set p=0.8 and n=20, predict, then Play or Step. Compare a fresh Reset with p=0.9 and n=20 explicitly set; exact binomial mean successes are sixteen and eighteen under independent identical trials. Playback highlights that fixed distribution rather than drawing real outcomes. The lab has no retries, correlated tasks, cost numerator, quality oracle, or expected inverse-success calculation. It cannot promise that either real cohort achieves its mean or that a mean-ratio estimate is unbiased.
Work it through
Retries belong to the successful-task numerator
A fictional cohort offers 1,000 unique tasks and uses 1,200 attempts at 0.04 FC each. Include twelve FC of assigned shared overhead. Eight hundred tasks pass the fixed quality-and-deadline oracle.
Attempt cost is 1200×0.04=48 FC; including shared overhead gives cohort cost sixty FC. The extra attempts remain in the numerator whether or not their tasks ultimately succeed.
The cohort success fraction is 800/1000=0.8 and successful-task cost is 60/800=0.075 FC. Cost per offered task is 0.06 FC, and dividing that by 0.8 gives the same observed ratio.
Cost per attempt including overhead is 60/1200=0.05 FC. That different denominator does not establish a cheaper successful service: it spreads the same total over retry work and omits the acceptance requirement.
The observed successful-task cost is 0.075 FC under this complete cohort boundary and fixed oracle.
The living notebook
Explore the model
Interactive lab · probability
A known success probability is a simplifying assumption
Use independent Reset → explicitly set BOTH p and n → predict → Play/Step runs for (0.8,20) and (0.9,20). Exact binomial means are sixteen and eighteen, not guaranteed realized counts. No cost, retry, or task-quality model is present.
- Mean · np
- 5
- Variance · np(1−p)
- 2.5
- Total probability
- 1
These are exact binomial probabilities for independent trials with one fixed success probability. Playback tours the distribution; it does not resample outcomes. Parameter changes pause playback and recompute the model at the current elapsed time. Reset restores both parameters and returns time to zero. Playback starts paused. Adjust either parameter, then choose Play or Step.
Look forDefine accepted logical work and measure its full effort before comparing unit cost.
Pause & reason
Check your understanding
Your turn
Try it yourself
A fictional cohort of 600 tasks uses 900 attempts at 0.02 FC each and six FC of assigned overhead. Four hundred tasks pass the fixed oracle. Compute cohort cost, success fraction, and cost per success.
Take a moment to make a prediction or work it out on paper. Open a hint when you need one.
Give me a hint
Price all attempts, add the included overhead, and divide by accepted logical tasks.
Compare with the solution
Attempt cost is eighteen FC and total cohort cost twenty-four FC. The success fraction is 400/600=2/3, and cost per successful task is 24/400=0.06 FC. The per-offered-task cost is 0.04 FC, yielding the same ratio when divided by two thirds. Report these counts with the workload and oracle; another configuration that serves fewer difficult tasks is not automatically an equivalent cheaper service. A zero-success cohort would have no finite ratio under this definition.
Keep the idea
Take it with you
- Give retries a stable logical-task identity.
- Include failed effort and state the quality-and-deadline oracle.
- Keep observed ratios separate from random-ratio expectations.
Read further
Original sources and deeper explanations to follow at your own pace.
Optional progress, saved in this browser when available. Revisit any lesson at any time.
Lesson not marked complete.