LLM Inference Cost Benchmarking and Tiered Scheduling in Practice

    This article breaks down why a low per-token price does not guarantee a low bill, and shows how to measure real LLM inference consumption by fitting a linear model to actual usage records. It covers the resulting cost gaps across model tiers, how to convert a credit quota into completable workloads, and a four-tier routing strategy that assigns expensive models to planning and cheap models to execution, along with caching, monitoring, and compliance considerations.

    1. Background: Why a Cheap Unit Price Does Not Mean a Cheap Bill

    After integrating LLM capabilities into real business workflows, teams most often run into the same puzzle: with the same quota, one person burns through it in a day while another makes it last a week. The reason is not complicated. Under token-based billing, actual cost is determined by four variables working together: input length, output length, cache hit ratio, and call frequency. Any judgment that compares only the “price per million tokens” is likely to be badly distorted in three common scenarios: long context, multi-round rework, and batch summarization.

    The problem gets worse because many platforms display only the total credits deducted after the fact, without per-call breakdowns. Cost becomes a black box: at the end of the month you see the quota running low, but you cannot tell which category of task consumed the budget. Breaking that black box requires only one approach: collect data through controlled experiments, then use mathematical methods to solve for the hidden variables.

    2. Method: Linear Fitting on Real Usage Records to Back Out Consumption Rates

    The core assumption is straightforward: the credits deducted by a single call are a linear combination of input tokens, output tokens (and cache-hit tokens). This can be written as:

    1. cost = a * input_tokens + b * output_tokens + c * cache_hit_tokens

    Here a, b, and c are the “credit consumption rates” to be determined. As long as you design several calls with clearly different input-to-output ratios, record the token counts and credit changes for each one, you can solve for them with least squares. In practice, the fit can reach R² = 1.0 with residuals approaching zero, which indicates the model really does bill on a linear rule and the back-calculated results are trustworthy.

    Three points are worth noting during data collection. First, change only one variable per experiment group to avoid multicollinearity. Second, make sure the samples cover both extremes: “very short input with very long output” and “very long input with very short output.” Third, record timestamps so the data can be aligned with the platform’s quota refresh cycle.

    The following is sample code for collection and solving:

    1. import numpy as np
    2. # Each row: [input tokens, output tokens, cache-hit tokens, credits actually deducted]
    3. samples = np.array([
    4. [800, 200, 0, 12],
    5. [8000, 400, 0, 41],
    6. [40000, 1000, 0, 150],
    7. [40000, 1000, 30000, 132],
    8. ])
    9. X, y = samples[:, :3], samples[:, 3]
    10. rates, residual, rank, _ = np.linalg.lstsq(X, y, rcond=None)
    11. a, b, c = rates
    12. print(f"input {a:.6f} / output {b:.66f} / cache {c:.6f} / token")

    3. Benchmark Results: Costs Across Model Tiers Can Differ by Two Orders of Magnitude

    Fitting the four typical model tiers with the method above yields a relative consumption gradient roughly like this (expressed as credits per million tokens; these are only relative magnitudes from personal benchmarking, not official pricing):

    Model tier Input Output Cache hit
    Flagship reasoning ~80,000 ~400,000 —
    Balanced reasoning ~32,000 ~112,000 —
    High-speed execution ~4,000 ~8,000 ~80
    Lightweight processing ~2,000 ~2,000 —

    Two key conclusions are worth remembering:

    • The spread can reach about 200x. Output cost on the flagship tier is roughly 200 times that of the lightweight tier, which means handing batch summarization or format conversion to a flagship model is the same as spending two orders of magnitude more budget on the same work.
    • Caching is the highest-leverage optimization. After a cache hit, input cost on the high-speed execution tier drops to only about 2% of normal input cost. Long system prompts, fixed knowledge prefixes, and repeated code context can all take advantage of this discount.

    4. Quota Conversion: Translating “Credits” into “Tasks You Can Complete”

    Assume the quota rule is 60,000 credits per 5 hours and 600,000 credits per week, and assume input accounts for 80%, output for 20%, with caching ignored for now. The total tokens a 5-hour window can support is approximately:

    • Flagship reasoning: ~417,000 tokens
    • Balanced reasoning: ~1.25 million tokens
    • High-speed execution: ~12.5 million tokens
    • Lightweight processing: ~30 million tokens

    The conversion formula can be reused directly:

    1. supported_tokens = window_credits / (0.8 * a + 0.2 * b)

    The point of this step is to turn the vague question of “is the quota enough” into a schedulable engineering metric. If a batch job needs 3 million tokens, it can finish within one window on the high-speed execution tier, but on the flagship tier it would span multiple windows, so queueing and checkpoint-resume design become mandatory.

    5. Tiered Scheduling: Expensive Models Think, Cheap Models Do

    Based on the cost gradient, a four-tier division of labor is recommended:

    1. Flagship reasoning: task decomposition, solution planning, final code review and risk gatekeeping. Short single calls with high value density.
    2. Balanced reasoning: complex logical reasoning, tricky defect localization, cross-module refactoring suggestions.
    3. High-speed execution: the main workhorse for coding and routine Q&A, paired with prefix caching to carry long context.
    4. Lightweight processing: batch classification, field extraction, log summarization, bulk test case generation.

    A simple routing abstraction is enough to get started:

    1. def route(task):
    2. if task.kind in ("plan", "review"):
    3. return "flagship"
    4. if task.kind == "reason":
    5. return "balanced"
    6. if task.tokens_in > 20000 and task.cacheable:
    7. return "fast" # input cost drops to ~2% after a cache hit
    8. return "lite"

    Supporting engineering practices include: placing stable prefixes first to maximize cache hits; deduplicating and templating batch tasks to compress input length; setting a separate quota dashboard and alert threshold for each tier; and fixing the review step as “cheap execution plus expensive spot checks” rather than full re-review.

    6. Boundaries and Caveats

    All consumption rates above are personal benchmarking results back-calculated from real usage, not an official price list. Billing rules, caching strategies, and quota cycles can all change, so it is worth adding the fitting script to routine checks and recomputing the coefficients once a week. Tiered scheduling also introduces quality variance, so human confirmation should be kept on critical paths. When sensitive data is involved, prefer a compliant deployment form, and continuously observe call volume, failure rate, and cache hit rate through logging services and monitoring alerts. If you use Baidu AI Cloud capabilities, you can build the loop described above on top of its general model services, object storage, and monitoring and alerting offerings, while specific parameters and billing remain subject to the official documentation.