From Floating-Point Numbers to Quota Reverse Engineering: How to Choose the Most Cost-Effective LLM Subscription Plan
This article explores how a seemingly innocuous 17-digit floating-point number in an LLM service's usage response can reveal the underlying quota calculation logic. Using mathematical techniques such as continued fractions and Stern-Brocot tree approximations, developers can reverse-engineer the exact subscription tiers, actual usage multipliers, and per-unit costs. The article also provides practical guidance on evaluating personal usage patterns, comparing tier value, and designing cost-efficient architectures for enterprise LLM adoption. Key takeaways include the importance of precision as a data leak, and the value of data-driven subscription decisions over blind low-tier selection.
From Floating-Point Numbers to Quota Reverse Engineering: How to Choose the Most Cost-Effective LLM Subscription Plan
1. The Problem: A Suspicious String of Decimals
Many developers face a common dilemma when selecting a subscription tier for large language model (LLM) services: how much difference is there between the various plans? Official marketing pages typically only state vague descriptions like “one tier offers X times the usage of another,” while the actual quota details are buried inside usage-tracking APIs, making external verification difficult.
Interestingly, an engineer using a popular LLM web interface noticed a 17-digit floating-point number in the returned usage data. Such numbers are classic in the computer world: when an integer is divided by another integer and yields a repeating decimal, a double-precision float faithfully preserves a long tail of digits. In other words, the server had omitted rounding on its output, leaking the raw calculation process.
The key takeaway: any system’s internal metering logic can potentially be inferred from the precision characteristics of its outputs. Below, we examine the methods behind this insight.
2. Recovering the Original Fraction from a Float
A typical 17-digit floating-point decimal, such as 0.16327272727272726, clearly shows a repeating “27” pattern, suggesting it originates from a fraction division. Two common methods can convert such a float back to a simplified fraction:
2.1 Continued Fraction Expansion
A continued fraction represents a real number as a sequence of integers. By repeatedly taking the reciprocal and integer part of a float, you can progressively approximate the fraction until the remainder becomes negligible. When a “large integer” appears in the expansion, it usually signals that further approximation exceeds the float’s precision limits – truncating at that point yields the original fraction.
2.2 Stern-Brocot Tree Method
The Stern-Brocot tree is a binary search tree containing every simplified positive fraction. Starting from the endpoints 0/1 and 1/0, you repeatedly take the “mediant” (sum of numerators and denominators) and narrow the interval containing the target float until the float’s precision limit is reached. Compared to continued fractions, this method is more intuitive when a known error bound is available.
Below is a pseudocode snippet illustrating the basic idea:
def float_to_fraction(x, max_den=1_000_000):lo, hi = (0, 1), (1, 0) # Stern-Brocot intervalwhile True:m_num, m_den = lo[0] + hi[0], lo[1] + hi[1]if m_den > max_den:return Noneval = m_num / m_denif abs(val - x) < 1e-15:return (m_num, m_den)if x < val:hi = (m_num, m_den)else:lo = (m_num, m_den)
Once the fractions are obtained, combining multiple data points from different times and usage levels can reveal the true underlying quota model: the unit of measurement, the consumption rate per hour, and the periodic cap.
3. Real Quota Structures of Subscription Tiers
By applying the above methods to multiple sampled data sets, a typical tiered quota model emerges. Consider a hypothetical but industry-typical pricing scheme:
- Internally, the service uses a unified “compute credit” unit, with different models consuming credits at different rates. A large model consumes about 1.67× the standard rate, while a lightweight model consumes about 1/5 the standard rate.
- Output tokens cost roughly 5× the price of input tokens, consistent with public API pricing.
- Entry tier (~$20/month): approximately 550,000 credits per 5-hour rolling window, with a weekly cap of about 5 million credits.
- Mid tier (~$100/month, marketed as “5× usage”): measured 5-hour window is about 3.3 million credits, i.e., 6× the entry tier; weekly cap is about 41.67 million credits, i.e., 8.33× the entry tier – actually more generous than the advertised 5×.
- High tier (~$200/month, marketed as “20× usage”): both the 5-hour window and weekly quota scale proportionally. Whether it offers “extra value” depends on the user’s sustained usage rate.
This case reveals a general pattern: the real multiplier between subscription tiers often differs from the advertised multiplier. The variance may come from hidden concessions for high-value users, or from rounding in the quota formula. For a consumer, the key to finding the “cheapest” subscription is not to blindly pick the lowest tier, but to answer three questions:
- What is your own consumption rate? Track token usage over a typical work week, distinguishing between input and output tokens.
- Does the quota window match your usage rhythm? A 5-hour rolling window means short bursts can hit throttling limits. If your workflow involves two intense hours daily, a lower tier might frequently hit caps.
- Is there a price inversion per credit? Compute the unit cost by dividing the monthly total credits by the monthly fee for each tier. The optimal choice is usually the tier with the lowest unit cost and a modest amount of headroom.
4. Engineering Perspective: Why Floating-Point Numbers Leak Information
From a system design standpoint, the root cause of this “leak” serves as a cautionary tale for every backend developer. Quota systems internally use integers for accounting (to avoid precision errors), but when outputting values, directly performing division and serializing the result to JSON exposes precise intermediate values. Proper practices include:
- Rounding or limiting decimal places on all externally exposed numeric outputs;
- Exposing only percentages or levels in the presentation layer, rather than raw counts;
- Never returning sensitive ratios (cost structures, discount factors) with high precision in any client-accessible response.
This is a classic counterexample for data masking: precision itself is information. A 17-digit decimal reveals not just a number, but the denominator structure of the internal billing formula.
5. Extended Considerations for Enterprise Users
For teams that need to procure LLM capabilities at scale, focusing solely on an individual subscription price is insufficient. A more holistic cost-control approach includes:
- Tiered routing: Route simple tasks to lightweight models and complex tasks to flagship models, dynamically adjusting based on task difficulty. This can significantly reduce per-credit consumption.
- Caching and deduplication: Cache results for repetitive queries to reduce unnecessary calls.
- Usage observability: Use logging services and monitoring alerts to track token consumption by business unit, providing data-driven decisions for subscription tier selection and renewals.
- Complementary self-hosted inference: For stable, predictable workloads, consider deploying open-source models on cloud container services to handle baseline traffic, reserving subscription quotas for high-value scenarios.
For example, using elastic compute and log monitoring capabilities from cloud platforms like Baidu AI Cloud, teams can build a unified LLM gateway that meters and routes traffic between self-hosted models and external APIs, ensuring every compute budget is spent effectively.
6. Conclusion
The answer to “what is the cheapest subscription” is never “buy the lowest tier.” Instead, it involves: using data to understand true quotas, quantifying your own consumption, and employing architectural measures to reduce per-unit costs. A 17-digit floating-point number reminds us that every layer of a billing system may contain valuable information worth uncovering. For developers, learning to use mathematical tools like continued fractions to observe systems is itself an interesting engineering skill. Rational evaluation and dynamic adjustment are the long-term keys to subscription cost optimization.
