LLM Inference Cost Benchmarking and Tiered Scheduling in Practice

    This article breaks down how to measure real LLM inference costs and control them through tiered model scheduling. Instead of comparing headline output prices, it shows how to reverse-engineer per-token consumption rates from actual billing records using a linear regression model, then compares consumption rates across four model tiers under a unified input/output assumption. It also presents a minimal routing skeleton that assigns high-cost models to planning and review while pushing deterministic work to cheaper tiers, along with engineering practices such as stable prefixes, context trimming, and fallback downgrades. Readers will learn a repeatable approach to capacity planning and cost optimization under a fixed quota.

    1. Background: Why a Low Unit Price Does Not Mean Controllable Total Cost

    Once a large language model is wired into real business workflows, the first pressure a team feels is usually not quality but how fast the quota is consumed. A seemingly simple conversational coding assistant can vary by an order of magnitude in daily consumption across scenarios like long context, multi-turn tool calls, and batch refactoring. The reason is not mysterious: in real workloads, input tokens typically make up a much larger share than output tokens, context accumulates as the conversation goes on, and cache hit rates depend heavily on the calling pattern.

    So evaluating inference cost requires three perspectives to hold at the same time:

    • Unit perspective: input, output, and cache-hit tokens are priced separately per million tokens;
    • Workload perspective: the input-to-output ratio, average context length, and cache reuse rate;
    • Scheduling perspective: whether tasks of different difficulty are routed to a model tier whose cost matches.

    Comparing only the “output unit price” is the most common misjudgment. If input accounts for eighty percent of the volume, differences in the input unit price get amplified; and the cache-hit price is often only a very small fraction of the normal input price, so whether a request hits the cache can directly change the economics of the entire chain.

    2. Method: Reverse-Engineering Unit Consumption Rates from Real Bills

    Rather than relying on marketing figures, a more reliable approach is to treat existing usage records as samples and build a linear model to solve for the coefficients. Suppose that within a given time window the consumed points are C, input tokens are In, output tokens are Out, and cache-hit tokens are Hit, then:

    1. C ≈ a * In + b * Out + c * Hit + d
    2. # a: input consumption rate b: output consumption rate c: cache-hit consumption rate d: fixed overhead

    Collection recommendations:

    1. Fix the statistical window (for example, one set every 5 hours and one set per week) to avoid mixing across windows;
    2. Record the three counts—input, output, and cache hits—for each session, instead of only the total tokens;
    3. Keep at least 5–8 samples with clearly different workloads so the regression has enough contrast;
    4. Use the coefficient of determination and residual checks to assess fit quality; residuals close to zero indicate the model form matches the real billing.

    Sample implementation (pseudocode):

    1. import numpy as np
    2. # each row: [input, output, cache hit, 1]
    3. X = np.array(records_matrix)
    4. y = np.array(points_consumed)
    5. coef, *_ = np.linalg.lstsq(X, y, rcond=None)
    6. pred = X @ coef
    7. r2 = 1 - ((y - pred) ** 2).sum() / ((y - y.mean()) ** 2).sum()
    8. print(coef, r2, np.abs(y - pred).max())

    When the fit reaches near-perfect correlation and the residuals approach zero, it means these coefficients can be used directly for capacity planning without repeated trial and error.

    3. Benchmark Results: Consumption Rate Differences Across Model Tiers

    Under a unified measure (assuming 80% input + 20% output, ignoring cache for now), converting the points quota into a usable token scale makes the gap between tiers very intuitive:

    • Flagship reasoning tier: about 80,000 input / million tokens, about 400,000 output / million tokens;
    • Balanced reasoning tier: about 32,000 input / million tokens, about 112,000 output / million tokens;
    • Fast execution tier: about 4,000 input / million tokens, about 8,000 output / million tokens, with cache hits as low as about 80 / million tokens;
    • Lightweight batch tier: about 2,000 for both input and output / million tokens.

    This yields two key conclusions. First, the output cost of the flagship tier can be about two hundred times that of the lightweight tier, so using it for batch rewriting is equivalent to burning the budget geometrically. Second, after a cache hit the fast execution tier retains only about two percent of the normal input cost, which means a calling pattern of “stable prefix + high reuse” is itself a cost-reduction measure.

    Converting to a quota of 60,000 points / 5 hours and 600,000 points / week, the usable scale is roughly: flagship tier about 417,000 tokens / 5 hours, balanced tier about 1.25 million, fast execution tier about 12.5 million, lightweight tier about 30 million. The gap is close to two orders of magnitude, so the value of a scheduling strategy far outweighs negotiating a lower price.

    Note: the above is a personal benchmark reverse-engineered from real usage, not an official price list, and the rules may change with version updates. Before putting it into practice, re-fit against the actual bill for the current period.

    4. Tiered Scheduling: Let Expensive Models “Think” and Cheap Models “Do”

    The core principle is capability–cost matching: reserve scarce high-tier compute for planning, review, and difficult reasoning, and push parallelizable, deterministic work down to lower tiers.

    • Flagship tier: requirement breakdown, solution design, final code review;
    • Balanced tier: complex reasoning, cross-file refactoring, tricky defect localization;
    • Fast execution tier: main coding work, unit test completion, formatting and migration;
    • Lightweight tier: batch simple tasks such as comment generation, log categorization, and field extraction.

    A minimal, deployable routing skeleton:

    1. def route(task):
    2. if task.needs_architectural_judgment:
    3. return "flagship" # planning and final review
    4. if task.cross_file_reasoning:
    5. return "balanced" # complex reasoning
    6. if task.deterministic and task.context_stable:
    7. return "fast" # main execution, good for cache hits
    8. return "lite" # batch simple tasks

    Combined with three engineering constraints, the gains become more obvious:

    1. Stable prefix: put the system prompt, tool descriptions, and coding conventions at the very front and avoid frequent changes, to improve cache reuse;
    2. Context trimming: retrieve relevant snippets by relevance instead of pouring in the whole repository, to control the input share;
    3. Failure fallback: automatically drop to the next tier when a higher tier times out or the quota runs low, keeping the chain available.

    5. Making Cost Observability a Standing Capability

    It is recommended to wire token counts, point consumption, and cache hit rate into logging services and monitoring alerts, tag them by model tier, business line, and session type, and produce daily and weekly reports to re-check the fitted coefficients. When actual consumption keeps diverging from the prediction, it usually means the workload structure has changed (for example, a higher input share or cache invalidation), and at that point you should re-fit rather than keep using the old coefficients.

    6. Conclusion

    The essence of the cost difference is tier mismatch. First fit trustworthy consumption rates from real records, then apply tiered scheduling on the principle of “expensive models think, cheap models execute,” combined with engineering practices that are cache-friendly and trim context, so that effective output can be amplified by an order of magnitude under a fixed quota. The method described here is general and can be transferred to model services and general capabilities such as monitoring and logging on platforms like Baidu AI Cloud; for specific billing and quotas, refer to the actual bill.