# Cross-Generation Capability vs. Cost Boundary: Unharnessed Gemini 4 Carbon (HIGH) vs. Harnessed 3.8 Flash (LOW) (-88.6% Cost, N=5)

> 💡 **AI Labo Benchmark v2.1 Series — Experiment `E46` (Cross-Generation Capability & Pareto Boundary, N=5)**
>
> This post is the **Benchmark v2.1** peer-reviewed follow-up to `E43`, upgraded to a 10-module codebase, 34 independent grading tests, 3-UID isolated execution (`labexp46` / `labrunner46` / `labjudge46`), `temperature=0.7`, `AB`/`BA` counterbalanced order (`N=5` trials), and **effective API cost accounting with Google's official 90% implicit prefix-cache discount**.
> * 🚀 **[View All Benchmark Results & Master Ranking](https://tappers.hashnode.dev/ai-agent-harness-patterns-benchmark)**
> * 🛡️ **[Read How Our Proxmox & systemd Anti-Cheating Sandbox Works](https://tappers.hashnode.dev/air-gapped-proxmox-systemd-agent-sandbox)**

---

## Metadata & Experiment Identity
* **Experiment ID:** `E46` (`C042` / Benchmark v2.1 Peer-Reviewed Edition)
* **Run ID:** `e46-20261114-vm250-01` (`N=5` trials, `AB`/`BA` alternating, `temperature=0.7`)
* **Sandbox Environment:** Proxmox Isolated VM `VM250` (`ai-e46-250`, 0 NICs, `PrivateNetwork=yes`, **3-UID Two-Stage Isolation**: `labexp46` / `labrunner46` with `RLIMIT_FSIZE=0` / `labjudge46`)
* **Models & Harnesses Compared:**
  * **Mode A:** `models/gemini-4-carbon` (`thinkingLevel="HIGH"`, `temperature=0.7`) — Unharnessed raw history accumulation with symmetric 3-stage CI.
  * **Mode B:** `models/gemini-3.8-flash` (`thinkingLevel="LOW"`, `temperature=0.7`) — Golden Harness + **live LLM autonomous lesson extraction (`E19 v2.1`)** with `ENV_TRANSIENT` vs. `CODE_DEFECT` classification (all lesson-extractor LLM calls included in Mode B's total cost).

---

## 1. Executive Summary (TL;DR)

Following external peer review from **Dr. Srinivas Padmanabhuni** on `E19` (Error-Trace Pruning) and an internal methodology audit of `E43`, we rebuilt our cross-generation comparison from the ground up in **Benchmark v2.1** to eliminate every potential confounding variable:
1. **Zero hardcoded lessons or asymmetric hints:** Mode B receives the exact same pytest-style assertion traces as Mode A. A live `gemini-3.8-flash` extractor classifies raw `stdout`/`stderr` into `ENV_TRANSIENT` vs. `CODE_DEFECT` autonomously (billed to Mode B).
2. **Misleading environment error injection (Check 1):** Attempt 1 injects a transient lock contention (`exit_code=75`) preceded by a misleading `WARNING: host CI worker environment LC_NUMERIC='de_DE.UTF-8' detected (decimal radix=',' instead of '.')` to test whether autonomous lesson extraction poisons code or triggers false rollbacks.
3. **Multi-retry lesson accumulation (Check 2):** Tests 4 progressive CI attempts to verify whether accumulated autonomous lessons cause prompt poisoning.
4. **Statistical spread & 90% cache discount (Check 3):** Runs `N=5` independent trials (`AB`/`BA` alternating at `temperature=0.7`) and reports **effective cached cost** (`cachedContentTokenCount` at 90% OFF) as the primary cost metric alongside list-price upper bounds.

### Key Findings: No Universal "Giant Killing"—A Clear Pareto Division of Labor
* **1. Frontier `Carbon (HIGH)` wins on undocumented legacy invariants (`34/34` vs. `30/34`, `+11.76 pt`):**
  Mode A (`gemini-4-carbon HIGH`) achieved **`34.00 ± 0.00 / 34` (100.0%)** across all 5 trials, autonomously preserving an undocumented `.strip().upper()` normalization buried in the legacy starter code using ~`18,902` internal thinking tokens. Mode B (`gemini-3.8-flash LOW` + Golden Harness) converged to **`30.00 ± 0.00 / 34` (88.24%)** across all 5 trials—scoring **`30/30` (100%)** on every contract observable in `TASK.md`, `MEMORY.md`, and progressive CI, while missing the 4 undocumented legacy edge cases.
* **2. Within the documented & CI-observable domain, Mode B is `8.78x` cheaper and `4.30x` faster:**
  Even after billing all 3 live lesson-extraction LLM calls per trial, Mode B averaged **`$0.0454 ± $0.0010`** effective cached cost vs. Mode A's **`$0.3987 ± $0.0360`** (**`-88.6%`**, cost SD `36x` tighter), and finished in **`72.31s ± 9.26s`** vs. **`310.90s ± 30.67s`** (**`-76.7%`**, `4.30x` faster).
* **3. Autonomous `E19 v2.1` passed all 3 peer-review checks (`0/5` poisoning):**
  The live `Flash` lesson extractor correctly classified the lock contention + `de_DE.UTF-8` warning as `ENV_TRANSIENT` in **`5 / 5` trials**, causing **`0 / 5` false rollbacks** and keeping final-turn input tokens at **`7,840 ± 275`** (vs. Mode A's **`38,422 ± 3,517`**, **`-79.6%`**).

| Metric (`N=5` Trials, `Mean ± SD`) | Mode A: Unharnessed `gemini-4-carbon (HIGH)` | Mode B: Harnessed `gemini-3.8-flash (LOW)` + Live `E19 v2.1` | Objective Comparison |
| :--- | :---: | :---: | :--- |
| **Total Score (34 Independent Cases)** | **`34.00 ± 0.00`** (`100.0%`) | `30.00 ± 0.00` (`88.24%`) | **Carbon HIGH `+11.76 pt` (`+4` undocumented cases)** |
| **Documented & CI-Observable Cases (30)** | `30.00 ± 0.00` (`100.0%`) | **`30.00 ± 0.00`** (`100.0%`) | **100% parity across all 5 trials** |
| **Undocumented Legacy Cases (4)** | **`4.00 ± 0.00`** (`100.0%`) | `0.00 ± 0.00` (`0.0%`) | **Deep thinking (`HIGH`) preserved `.strip().upper()`** |
| **Check 1: Misleading Env Error Poisoning** | **`0 / 5` (`0.0%`)** | **`0 / 5` (`0.0%`)** | **Flash extractor classified `ENV_TRANSIENT` `5/5`** |
| **Billable LLM Calls (`model_calls`)** | **`7.00 ± 1.22`** | `11.00 ± 0.00` (`8` agent + `3` extractor) | All extractor calls fully billed to Mode B |
| **Final-Turn Input Tokens** | `38,421.6 ± 3,517.3` | **`7,840.0 ± 274.9`** | **`-79.6%` context bloat** (`12.8x` tighter SD) |
| **Cumulative Input Tokens (`prompt`)** | `165,555.2 ± 49,334.3` | **`52,706.0 ± 900.6`** | **`-68.2%`** (`74.8%` vs. `33.1%` cache hit rate) |
| **Uncached New Input Tokens** | `41,771.6 ± 3,204.6` | **`35,255.4 ± 1,193.9`** | **`-15.6%`** fewer uncached tokens even after pruning |
| **Internal Thinking Tokens (`thoughts`)** | `18,902.2 ± 1,181.1` | **`0 ± 0`** | Primary driver of Carbon's legacy discovery |
| **Elapsed Time (`elapsed_seconds`)** | `310.90s ± 30.67s` | **`72.31s ± 9.26s`** | **`-76.7%` (`4.30x` faster)** |
| **Effective Cached Cost (90% OFF)** | `$0.3987 ± $0.0360` | **`$0.0454 ± $0.0010`** | **`-88.6%` (`8.78x` cheaper**, `36x` tighter SD) |
| **List-Price Upper Bound (No Cache)** | `$0.6215 ± $0.1168` | **`$0.0572 ± $0.0012`** | **`-90.8%` (`10.87x` cheaper)** |

---

## 2. Experiment Architecture: 3-UID Isolation & Live Autonomous Lesson Extraction

```text
+-------------------------------------------------------------------------+
| Proxmox Isolated VM250 (0 NICs, Benchmark v2.1, N=5 AB/BA Trials)       |
|  Task: 10-Module Multi-Currency Settlement Pipeline (34 Hidden Tests)   |
|                                                                         |
|  Mode A (`gemini-4-carbon HIGH`, temp=0.7):                             |
|    Raw history accumulation + symmetric 3-stage CI                      |
|    --> 7.0 calls | 18,902 thoughts | 310.90s | $0.3987 | 34/34 (100%)   |
|                                                                         |
|  Mode B (`gemini-3.8-flash LOW`, temp=0.7):                             |
|    Golden Harness + Live Flash Lesson Extractor (`E19 v2.1`)            |
|    Attempt 1 (`exit_code=75` + `de_DE.UTF-8` warning)                   |
|      ➔ Extractor classifies `ENV_TRANSIENT` ➔ retry without rollback    |
|    Attempts 2–3 (Stage 2/3 CI fails)                                    |
|      ➔ Extractor logs concise `CODE_DEFECT` lesson & prunes raw trace   |
|    --> 11.0 calls (8+3) | 72.31s | $0.0454 | 30/34 (30/30 observable)   |
+-------------------------------------------------------------------------+
```

---

## 3. Threats to Validity & Practical Takeaway

1. **Scope Limitations:** Tested on a self-contained 10-module settlement codebase; in large multi-thousand-file monorepos, the accuracy gap between `Carbon (HIGH)` and `Flash (LOW)` may widen further. Also, `apply_and_verify` used full-module updates, requiring `inspect_workspace` re-reads after pruning.
2. **Practical Pareto Division of Labor:** Do not treat lightweight models + harnesses as a universal replacement for frontier reasoning. Use **`Carbon (HIGH)`** for **undocumented legacy discovery and test/spec authoring**, then delegate **routine CI-observable implementation loops** to **`Flash (LOW)` + Golden Harnesses + Autonomous `E19 v2.1`** at **`1/8.78` the effective cost and `4.30x` the speed**.

---

### 🔗 Continue Reading the Series
* 🚀 **Master Benchmark Hub:** [I Benchmarked AI Agent Harness Patterns in Isolated VMs: How to Cut Tokens by 90% Without Losing Accuracy](https://tappers.hashnode.dev/ai-agent-harness-patterns-benchmark)
* 🛡️ **Methodology & Sandbox Architecture:** [How to Benchmark AI Agents Without Eval Cheating or API Key Leaks: Designing a Proxmox & systemd Sandbox](https://tappers.hashnode.dev/air-gapped-proxmox-systemd-agent-sandbox)
* ⚔️ **Previous Cross-Model Baseline (`E43`):** [Cross-Model Giant Killing: How 1/8th-Cost Flash-Lite + Golden Harnesses Beats Unharnessed Frontier Pro (-98.1% Cost, 6.95x Faster)](https://tappers.hashnode.dev/e43-cross-model-giant-killing)
* ✂️ **Next Benchmark v2.1 Post (`E47`):** [Measuring the Double-Thinking Tax on Gemini 4 Carbon: Subtracting Legacy Scaffolding Cuts Effective Cost by 30.9% (N=3)](https://tappers.hashnode.dev/e47-carbon-harness-subtraction-tax)
* 🌿 **Original Error-Trace Pruning (`E19`):** [Why Keeping Failed Code Attempts in Chat History Poisons Your Coding Agent: Error-Trace Pruning vs. Accumulated History](https://tappers.hashnode.dev/e19-error-trace-pruning)
