Skip to content

feat(compression): runnable A/B benchmark CLI (F2.4) - #4220

Merged
diegosouzapw merged 1 commit into
release/v3.8.29from
feat/compression-benchmark-cli
Jun 19, 2026
Merged

diegosouzapw merged 1 commit into
release/v3.8.29from
feat/compression-benchmark-cli

Conversation

@diegosouzapw

Copy link
Copy Markdown
Collaborator

Contexto

Programa compressão 100% funcional — item F2.4. O harness de benchmark (benchmarkEngines/compareReports/BENCHMARK_CORPUS) existia e era testado, mas nada o invocava, não era re-exportado do barrel, e não havia saída de relatório → F2.4 era scaffold test-only.

O que muda

  • Formatter markdown formatBenchmarkTable (best-first, melhor engine em negrito) + set default DEFAULT_BENCHMARK_ENGINES (8 engines determinísticos; llmlingua excluído — precisa do modelo ONNX em runtime).
  • Re-export da API do benchmark em harness/index.ts.
  • CLI scripts/compression/benchmark.ts + script npm run bench:compression [engineId ...] que roda o corpus e imprime a tabela A/B.

Saída real (validação real-environment)

| Engine | Mean Savings % | Mean Retention | Total Compressed Tokens |
| --- | ---: | ---: | ---: |
| **ccr** | 36.5 | 0.600 | 383 |
| ultra | 19.7 | 0.900 | 532 |
| lite | 0.0 | 1.000 | 670 |
| ... (rtk/caveman/aggressive/session-dedup/headroom) | 0.0 | 1.000 | 670 |

Números honestos: o adapter envolve uma string única como 1 mensagem user, então rtk/caveman (que comprimem tool-results/multi-msg) marcam ~0% nesse corpus — o benchmark surfacing isso é o ponto.

Follow-ups rastreados

  • N4 budget-gate ratchet (budgetGate.ts com baseline commitado + CI) — runBenchmarkGate já existe.
  • A/B real do llmlingua (precisa do modelo ONNX) — framework é engine-agnostic, basta passar o id.

Validação

  • TDD: 2 testes RED→GREEN — formatBenchmarkTable (markdown, best bolded) + DEFAULT_BENCHMARK_ENGINES resolvem e rodam o corpus end-to-end.
  • CLI rodado de verdade (npm run bench:compression) → tabela acima, exit 0.
  • Suíte de compressão verde (incl. benchmark.test.ts "reproducibility") · typecheck:core ✅ · eslint ✅.

🤖 Generated with Claude Code

The compression benchmark harness (benchmarkEngines / compareReports / BENCHMARK_CORPUS)
existed and was unit-tested, but nothing invoked it, it wasn't re-exported from the harness
barrel, and there was no report output — so F2.4 "benchmark L2" was test-only scaffold.

- Add a markdown report formatter (formatBenchmarkTable) + a default deterministic engine set
  (DEFAULT_BENCHMARK_ENGINES, llmlingua excluded — needs the ONNX model at runtime).
- Re-export the benchmark API from harness/index.ts.
- Add a CLI (scripts/compression/benchmark.ts) + `npm run bench:compression [engineId ...]` that
  runs the corpus and prints a best-first A/B table.

Deterministic and API-free (the harness already guarantees reproducibility). Real run:
ccr 36.5% savings, ultra 19.7%, others ~0% on this single-string corpus — honest numbers.

The N4 budget-gate ratchet (budgetGate.ts wired to CI with a committed baseline) and the real
llmlingua A/B (needs the ONNX model) are tracked follow-ups.

Part of the compression "100% functional" program (audit follow-up).
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@diegosouzapw
diegosouzapw merged commit 2089e5c into release/v3.8.29 Jun 19, 2026
3 checks passed
@diegosouzapw diegosouzapw mentioned this pull request Jun 19, 2026
@diegosouzapw
diegosouzapw deleted the feat/compression-benchmark-cli branch June 19, 2026 12:06
tkgo11 pushed a commit to tkgo11/OmniRoute that referenced this pull request Sep 23, 2026
…ce#4220)

Integrated into release/v3.8.29 (F2.4 runnable compression A/B benchmark CLI).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant