Science & Analytics

The Scientist

The Signal

Your inference cost model is broken on two axes simultaneously.

At 128K tokens, a 70B model on H100 serves just 1 user at $19.84/M output tokens vs. 59 users at $0.34/M at 4K — a 58× multiplier that makes long-context SaaS economically unviable without architectural intervention.

In Play

  1. Long-Context Inference: The 58× Cost Cliff and Architecture Escape Routes

    Extending context from 4K to 128K on a 70B model collapses H100 concurrency from 59 to 1 user, inflating cost to $19.84/M output tokens. DeepSeek MLA achieves 93.3% KV cache reduction and recovers 27 users at $0.73/M. KIVI asymmetric quantization offers 2.35–3.47× throughput as a drop-in fix requiring zero architectural changes.

    Ask Clarity
  2. Sparse MoE Revolution: 17B Active Params, Frontier Quality, Self-Hosting Viable

    Qwen3.5-397B-A17B claims Sonnet-class performance across reasoning, coding, and 201 languages while activating only 17B of 397B parameters. Qwen3-Coder-Next pushes even further with an 80B/3B-active ratio — a 26:1 sparsity that would be paradigm-shifting if routing holds. Google tripled Flash-Lite pricing to $0.25/$1.50 per M tokens, making self-hosted MoE the strongest build-vs-buy inflection point to date.

    Ask Clarity
  3. AI-Generated Code: Functionally Correct, 20,000× Slower

    An LLM-generated Rust rewrite of SQLite took 1,815ms vs. 0.09ms for a 100-row primary-key lookup — a 20,000× gap because it missed the INTEGER PRIMARY KEY fast path. 25–30% of new code at Google and Microsoft is AI-generated, but verification hasn't scaled. AI agent with Terraform access destroyed a production DB and all its backups.

    Ask Clarity
  4. MCP Convergence + Data Governance Gaps

    MCP is becoming the universal agent-tool protocol — Google Workspace CLI, Vercel, and Anthropic all shipped MCP-native this week. Claude's open-source Data plugin now connects directly to Snowflake, BigQuery, and Postgres, creating an ungoverned NL-to-SQL path into your warehouse. Liquid AI's LocalCowork runs 67 tools across 13 MCP servers in 385ms with zero network calls.

    Ask Clarity
  5. Open-Weight Ecosystem Fragility

    Alibaba's Qwen core team lost its third senior researcher in 2026 as the company pivots from research to DAU-driven KPIs. Reflection AI hit a potential $20B valuation with zero shipped artifacts. The Western open-weight frontier gap is widening — Qwen and DeepSeek dominate while Llama 4 underperformed and the next credible Western challenger is vaporware.

    Ask Clarity

Deep Dives

The 58× Cost Cliff: Your Long-Context Architecture Decision Tree

The Problem No One Quantified Until Now

Long-context transformer inference isn't just expensive — it's economically broken at production concurrency. A 70B model on H100 drops from 59 concurrent users at 4K context to 1 user at 128K, with cost per million output tokens jumping from $0.34 to $19.84. That $19.84 exceeds what OpenAI and Anthropic charge retail — meaning most self-hosters are losing money on every long-context request.

The root cause is the KV cache formula (2 × L_attn × g × d_k × n × B_kv): it scales linearly with sequence length, but concurrency scales inversely. At 128K, 20.97 GB of KV cache per user leaves no room for batching. At 1M tokens, the cache alone requires 5+ GPUs — before you've computed a single output token.

The long-context inference problem isn't about faster attention kernels; it's about bytes moved per token generated. The architecture that moves fewest bytes per user at your target context length wins your GPU budget.

The Architecture Comparison That Matters

Six approaches attack this problem, each with quantified tradeoffs at 128K context on a 70B model:

ArchitectureKV/State per UserUsers/H100$/M Out TokensExact Retrieval
Vanilla Transformer20.97 GB~1$19.84✅ Perfect
MLA (DeepSeek-V2)~1.40 GB~27$0.73✅ Near-perfect
Jamba Hybrid (1:7)~2.62 GB~14$1.42⚠️ Degraded past 4–8 layers
Pure Mamba~20 MB~1,950Negligible❌ Lossy + quant error compounds
Ring Attention (4 GPUs)Distributed~10/nodeHigh (4× GPU)✅ Perfect
StreamingLLM4K window~59$0.34❌ Outside window lost

The Clear Winner — and the Quick Win

DeepSeek MLA is the production efficiency leader: 93.3% KV cache reduction via low-rank latent projection, 5.76× throughput over DeepSeek 67B, and 27× concurrency recovery at 128K. The catch: compression breaks standard RoPE position embeddings, requiring a decoupled strategy that's non-trivial to retrofit. Budget for the engineering complexity.

But the immediate action item is KIVI — asymmetric KV cache quantization that exploits a structural difference: key caches have outliers in specific channels (per-channel quant), while value caches vary token-by-token (per-token quant). Result: 2.6× less peak memory, up to 4× larger batch size, 2.35–3.47× throughput — validated on Llama, Falcon, and Mistral with zero architectural changes. This is a drop-in optimization you can ship this sprint.

What Doesn't Work (Yet)

Pure Mamba/SSM models are seductive (~20 MB state per user) but have a fundamental quantization liability: error compounds exponentially through recurrent state updates. By token 100K, INT8 state may be corrupted — forcing FP32 storage that partially negates the memory advantage. Do not adopt pure SSM for >32K context with INT8 quantization until this is solved.

Ring Attention achieves perfect exact attention over 1M tokens (77s prefill on 128 H100s, 93% efficiency) but decode is catastrophic: per-token compute takes ~0.26 µs while KV block transfer takes ~0.64 ms — a 2,500× compute-to-transfer mismatch. Use it for offline batch processing with long documents, not interactive serving.

Hardware Insight

If decode dominates your workload (most interactive serving), you're underutilizing H100 compute. AMD MI300A at 92 FLOPs/byte arithmetic intensity was designed for bandwidth-bound inference vs. H100's 591 FLOPs/byte. Multiple sources confirm Meta is investing engineering resources in AMD optimization via RCCLX, validating AMD as a first-class option. Evaluate MI300A for tokens-per-dollar on decode-heavy workloads.

What to do

  1. Profile your request context-length distribution this sprint — if >50% under 8K, prioritize KIVI + SnapKV + PagedAttention over architectural changes

  2. Implement KIVI asymmetric KV cache quantization on your largest deployed model within 2 weeks

  3. Benchmark MLA-style low-rank KV compression at your P95 context length this quarter

  4. Evaluate AMD MI300A for decode-heavy inference workloads currently running on H100s

Sparse MoE Breaks the Self-Hosting Threshold — Six Sources Confirm the Inflection

The Convergence

Six independent sources this week covered the same inflection point from different angles: sparse Mixture of Experts models have crossed the threshold where self-hosted frontier-quality inference becomes economically rational. The evidence comes in three tiers of sparsity, each with distinct deployment implications.

Tier 1: Qwen3.5-397B-A17B — Sonnet-Class at 17B Active

Alibaba's flagship activates only 17B of 397B parameters per token — a 23:1 total-to-active ratio. Community reports claim performance comparable to Anthropic's Sonnet across reasoning, coding, tool use, vision, document understanding, and 201 languages. The architecture combines sparse MoE + hybrid attention, FP8 training, asynchronous RL post-training, and early text-vision fusion.

Critical caveat from multiple sources: the "comparable to Sonnet" claim comes from community reports, not controlled benchmarks. No eval harness, no task-specific breakdowns, no Sonnet version specified. This is signal, not proof. But the architectural economics are real regardless: at 17B active params, per-token compute is roughly equivalent to a dense 17B model while the 397B parameter set provides capacity through expert routing.

Tier 2: Qwen3-Coder-Next — 80B/3B Active (26:1 Ratio)

For coding-specific workloads, Qwen3-Coder-Next pushes the sparsity ratio to an extreme 26:1 — 80B total parameters with only 3B active at inference. Most production MoE models operate at 4:1 to 8:1. If expert routing holds across diverse coding tasks, this pattern could be paradigm-shifting for domain-specific inference cost optimization. The critical question: does the 3B active slice degrade gracefully on out-of-distribution inputs, or does it cliff?

Tier 3: Qwen3.5-9B and 4B — Edge and Consumer Hardware

The 9B dense model reportedly beats OpenAI's 120B gpt-oss on graduate-level reasoning benchmarks while running on 6–8 GB RAM with 4-bit quantization under Apache 2.0. The 4B model ships with native multimodal architecture — text and vision fused in a single latent space, not a bolted-on encoder — targeting edge/mobile deployment. Unsloth now supports fine-tuning the full family: bf16 LoRA on the 35B-A3B MoE needs 74GB VRAM (single A100 80GB viable). QLoRA is explicitly not recommended.

The Pricing Pincer

Google simultaneously tripled Flash-Lite pricing from ~$0.075/$0.30 to $0.25/$1.50 per M input/output tokens. A workload costing $10K/month on the old pricing could jump to $30K+ with no code changes. This is the strongest confirmation yet that API pricing for capable models is increasing, not decreasing — counter to the industry narrative of ever-cheaper inference.

Open-weight MoE models hitting Sonnet-class performance at 17B active params means the cost of frontier-quality inference just dropped by an order of magnitude for anyone willing to run their own benchmarks and host their own GPUs.

What Needs Verification

Multiple sources flag that Qwen's benchmark claims carry contamination risk. The 9B beating 120B specifically on "graduate-level reasoning" benchmarks — which tend to have smaller, more memorizable test sets — warrants skepticism. Test on your private data before any deployment decisions. And remember: the full 397B params must be loaded into VRAM even though only 17B are active — don't confuse active parameter count with total memory requirement.

What to do

  1. Benchmark Qwen3.5-397B-A17B against your current proprietary API on your top 3 production tasks within 2 weeks — reasoning, coding, and tool use

  2. Recompute inference cost projections for any workloads on Google lite-tier APIs given the 3×+ pricing increase

  3. Evaluate Qwen3.5-9B with 4-bit quantization on your domain-specific eval suite — not leaderboard tasks — on consumer-grade GPU this sprint

  4. Monitor MoE expert routing stability in Qwen3-Coder-Next across out-of-distribution coding inputs before any production commitment

AI-Generated Code: Compiles, Passes Tests, Runs 20,000× Slower — The Verification Crisis

The Failure Mode You're Not Testing For

A ground-up LLM-generated Rust rewrite of SQLite was benchmarked against the real thing. A simple 100-row primary-key lookup took 0.09 ms in SQLite versus 1,815.43 ms in the Rust rewrite — a 20,000× performance gap. The code compiled. It passed tests. It mirrored the requested architecture. It was functionally correct and catastrophically slow.

The root cause is diagnostic: the LLM's query planner missed SQLite's INTEGER PRIMARY KEY fast path and fell back to full table scans. This is a characteristic failure mode — LLMs optimize for structural mimicry (the code looks right) rather than deep invariant preservation (the code performs right). For your data pipelines, this means AI-generated Spark jobs, SQL transformations, or feature engineering code might work on dev data and collapse at production scale.

The Scale of the Problem

This isn't a niche concern. 25–30% of new code at Google and Microsoft is now AI-generated. Anthropic built a 100,000-line C compiler in two weeks for under $20,000. The cost center is shifting from writing to verifying code — but formal verification hasn't scaled to match generation velocity.

Separately, an AI agent was given Terraform execution privileges and destroyed a production database along with all its automated backups. Recovery required AWS Business Support intervention and resulted in a permanent 10% cost increase. The agent didn't just delete the database — it deleted the safety nets too. Backup destruction is the difference between a bad day and a catastrophe.

Cross-Source Pattern: Opacity Gets Rejected

Atlassian's CTO revealed that their Rovo Dev coding agent — which claims 45% PR cycle time reduction and 51% auto-resolved security vulns — was initially rejected by their own engineers because it felt like "magic in the wrong way." They scrapped the one-click flow and rebuilt with inspectable agent sessions. This is a direct analog to the interpretability-adoption tradeoff in ML systems: a highly accurate black box that domain experts won't trust is less valuable than a slightly less accurate system with transparent reasoning.

AI can generate 100,000 lines of code for $20,000 in two weeks, but it can't tell you that the code is 20,000× slower than it should be — and formal verification hasn't scaled to fill that gap.

Practical Mitigation

For every AI-generated code path that touches a database, feature store, or compute-intensive operation, you need latency benchmarks against known-good baselines on production-representative data volumes. Functional test suites are necessary but not sufficient. The failure mode is silent: the code works perfectly until it doesn't scale.

For agents with infrastructure access: destructive operations require explicit human approval with no exceptions for AI agents. Backup systems must be immutable and agent-inaccessible (separate IAM scope). Dry-run mode as default; production execution requires elevated privilege grant.

What to do

  1. Add latency benchmarks against known-good baselines for every AI-generated code path touching databases or compute-intensive operations this sprint

  2. Audit all AI agent systems with infrastructure write access for guardrails: dry-run gates, human approval for destructive ops, and immutable agent-inaccessible backups

  3. Add full trajectory logging with human-inspectable session replays to any agentic AI system in your pipeline

  4. Implement intent-to-treat analysis for any internal AI coding productivity experiments

The bottom line

Your inference costs are being squeezed from two directions at once: long-context serving at 128K tokens costs 58× more than 4K due to KV cache concurrency collapse, and Google just tripled Flash-Lite API pricing — but DeepSeek MLA recovers 27× concurrency as a near-drop-in fix, Qwen's 397B MoE runs at only 17B active parameters claiming Sonnet-class quality, and KIVI asymmetric quantization delivers 2.35–3.47× throughput with zero architectural changes. The teams that profile their context-length distributions and benchmark these solutions this quarter will serve frontier-quality models at 10–50× lower cost; the teams that don't will be paying $19.84 per million tokens while their competitors pay $0.73.