Skip to content

feat(eval): add agent-based iterative format optimization framework and history - #2092

Open
gspencergoog wants to merge 22 commits into
a2ui-project:mainfrom
gspencergoog:iterative_optimization
Open

feat(eval): add agent-based iterative format optimization framework and history#2092
gspencergoog wants to merge 22 commits into
a2ui-project:mainfrom
gspencergoog:iterative_optimization

Conversation

@gspencergoog

@gspencergoog gspencergoog commented Jul 24, 2026

Copy link
Copy Markdown
Collaborator

Summary

Introduces the inference-format-optimizer agent skill and evaluation suite under eval/skills/inference-format-optimizer/. This skill provides a modular, reproducible framework for autonomous subagents and human contributors to benchmark, optimize, and iterate on A2UI LLM inference formats (such as Atom, Express, and Elemental).

Changes

  • Skill & CLI Orchestration (eval/skills/inference-format-optimizer/):
    • SKILL.md: Main entrypoint cheat-sheet and workflow instructions.
    • scripts/optimize_format.py: CLI orchestrator for running validation subsets or full evaluation suites across formats.
    • scripts/compare_results.py: Computes 1:1 metric deltas, accuracy, latency, token efficiency, and composite $S_{\text{opt}}$ optimization scores.
    • scripts/sync_history.py: Merges iteration run archives across parallel Git worktrees into a unified history with collision-free run ID re-indexing.
    • scripts/utils/: Modularized helper utilities (archiver.py, format_tools.py, reporter.py, runner.py).
  • Parameterized History Metadata (run_meta.json):
    • Expanded iteration run metadata to explicitly capture model (e.g. google/gemini-3.5-flash) and thinking_budget attributes.
    • Rendered Model and Budget columns across master and format-specific history_summary.md indexes.
  • Documentation & Protocol References (references/):
    • Documents scoring models ($S_{\text{opt}}$ formula, correctness guardrails, efficiency caps), multi-worktree execution protocols, and subagent prompt templates.
  • Unit Testing (tests/):
    • Unit tests covering compare_results.py, optimize_format.py, sync_history.py, and utils helper modules (59 tests passed).
  • Iteration Archives & History (eval/history/):
    • Enriched 53 historical iteration runs (patch.diff, report.md, run_meta.json) and master index (history_summary.md) detailing past optimization experiments for the Atom format.
  • Baseline Benchmark Datasets:
    • Standardized 5-epoch baseline evaluation results across thinking budgets for transport, express, elemental, and atom formats.

Impact & Risks

  • Impact: Enables automated, reproducible prompt and compiler optimizations for A2UI LLM inference formats across multi-worktree subagent loops with explicit model/budget parameterization.
  • Risks: Low. All logic and scripts are scoped to eval/ and developer tooling without changing core runtime packages.

Testing

  1. Unit Tests:
    • uv run --all-packages pytest eval/skills/inference-format-optimizer/tests/ (59 passed).
  2. Formatting & Linting:
    • ./scripts/fix_format.sh --check (passed).

gemini-code-assist[bot]

This comment was marked as resolved.

@gspencergoog
gspencergoog force-pushed the iterative_optimization branch from 3ef9c90 to d949c9a Compare July 24, 2026 18:01
Comment thread eval/iterative_format_optimizer/history/atom/history_summary.md Outdated
gspencergoog and others added 10 commits July 28, 2026 16:28
- Added 37 new unit test cases across test_compare_results.py, test_optimize_format.py, test_sync_history.py, and test_utils.py.
- Total test count expanded to 93 tests (100% passing).
- Increased statement line coverage across all 7 optimizer script modules from 69.7% to 90.2%.
- Apply Prettier formatting across JSON and Markdown files under eval/iterative_format_optimizer to pass enforce-formatting check.
- Fix relative markdown links to history and history_summary.md in inference_format_iteration.md to resolve lychee link-check failures.
- Update path references and fix duplicate text in agent_instructions.md.
@gspencergoog
gspencergoog enabled auto-merge (squash) July 30, 2026 02:49
…roject.toml

- Add missing type annotations and fix duplicate method names in optimizer tests
- Add optimizer tests to mypy exclude list in pyproject.toml
gemini-code-assist[bot]

This comment was marked as resolved.

…use Manager context manager

- Use asyncio.to_thread for parse_with_hard_kill_timeout to prevent blocking the asyncio event loop during evaluations
- Use multiprocessing.Manager as a context manager to avoid leaking manager processes and IPC file descriptors
@gspencergoog
gspencergoog force-pushed the iterative_optimization branch from d887888 to 1d409a4 Compare July 30, 2026 03:21
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.

2 participants