cad-bench / docs /architecture.md
windows2t2's picture ShadowPenguin's picture
Duplicate from markov-ai/autocad-bench
1866d85
|
Raw History Blame Contribute Delete
5.66 kB

Architecture

AutoCAD Bench is a filesystem-first benchmark with a trusted Windows execution boundary. Task definitions and configurations are versioned inputs; every rollout writes an immutable trace directory that the evaluator and dashboard consume.

Execution phases

  1. Discover β€” load and validate the task corpus and a model/run configuration.
  2. Preflight β€” verify credentials, model availability, backend capacity and worker identity, and every required gold-cache entry.
  3. Run β€” launch or attach to one isolated AutoCAD sandbox, hand off the exact task, and execute the model's computer actions.
  4. Finalize β€” retrieve the final DWG and complete trace evidence.
  5. Evaluate β€” inspect the DWG inside trusted AutoCAD, compute deterministic diagnostics, and run the vision judge.
  6. Report β€” expose normalized benchmark, task, scoring, usage, and trace data through the local dashboard.
tasks/                  configs/
   β”‚                        β”‚
   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
              β–Ό
   orchestration/batch.py
              β”‚
        bounded workers
              β”‚
              β–Ό
 infrastructure plugin ─────── selected worker backend
              β”‚                         β”‚
              β–Ό                         β–Ό
       harness/run.py  ◄────── Windows broker + AutoCAD
              β”‚                         β”‚
              └──── final DWG β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                          β”‚
                          β–Ό
                 evaluation/run.py
                          β”‚
                          β–Ό
                    runs/<run-id>/
                          β”‚
                          β–Ό
                    apps/dashboard/

Task model

tasks/manifest.jsonl is the canonical catalog. Each row identifies one reference PNG, one private gold DWG, drawing type, difficulty, split, and execution budgets. The loader verifies:

  • exactly 50 entries with contiguous IDs from task-001 to task-050;
  • 21 2D and 29 3D tasks;
  • valid PNGs and AutoCAD AC1032 DWGs;
  • paths that remain inside the repository;
  • a fixed seven-task development split; and
  • no reused reference or gold artifact.

tasks/gold-audit.jsonl records byte sizes, image dimensions, DWG signatures, and manual-review state. Public task models omit the gold path before any data reaches the model harness.

Package boundaries

Package Responsibility
autocad_bench.tasks Corpus validation, public task data, and prompts
autocad_bench.harness Provider interaction, agent loop, and trace writing
autocad_bench.infrastructure Worker backend registration, launch, cleanup, and optional recovery
autocad_bench.sandbox Broker protocol, AWS lifecycle, handoff, and evidence retrieval
autocad_bench.orchestration Model catalog checks, batch planning, concurrency, resume, and recovery
autocad_bench.evaluation Trusted inspection, gold cache, deterministic scoring, and vision judgment
autocad_bench.common Atomic filesystem utilities shared across boundaries

The Python code uses a src/ layout so imports always resolve through the installed package rather than the working directory. Commands normally discover the checkout from tasks/manifest.jsonl; an installed wheel can use AUTOCAD_BENCH_ROOT to point at a benchmark checkout.

Sandbox boundary

The model has no shell, filesystem, AutoLISP, API, MCP, or network tools. It can send only validated mouse and keyboard actions to the loopback broker. The broker captures every post-action frame for audit while the model sees only the observation returned at the end of its action batch.

The Windows source under sandbox/windows/ builds three runtime layers:

  • the authenticated loopback broker;
  • the PyAutoGUI interactive input worker; and
  • the trusted AutoCAD evaluator plug-in and runner.

The built-in AWS backend uses SSM and an inbound-free security group. Other backends must enforce an equivalent isolation and admission contract. Runtime admission verifies the current boot, deployment manifest, broker identity, display, input driver, and exact-task reset before the model receives control.

Evaluation boundary

The final DWG is scored only after model execution. For 2D tasks, evaluator v4 renders Model Space. For 3D tasks, it inspects true geometry and all paper layouts but renders the required Layout1 presentation. Gold-cache entries fail closed if their source checksum, evaluator version, render configuration, drawing type, or required 3D layout contract differs.

The dashboard-preferred score is the structured vision judgment. Deterministic geometry and rendering comparisons remain audit evidence and regression signals.

Results layout

runs/benchmarks/<benchmark-id>/
β”œβ”€β”€ batch-state.json
└── rollouts/<task-id>/
    β”œβ”€β”€ run-state.json
    β”œβ”€β”€ reference.png
    β”œβ”€β”€ attempt.dwg
    β”œβ”€β”€ frames/
    β”œβ”€β”€ model_turns.jsonl
    β”œβ”€β”€ model_turn_summaries.jsonl
    β”œβ”€β”€ input_receipts.jsonl
    β”œβ”€β”€ events.json
    β”œβ”€β”€ frame_events.json
    └── evaluation/
        β”œβ”€β”€ status.json
        β”œβ”€β”€ metadata.json
        β”œβ”€β”€ candidate-render.png
        β”œβ”€β”€ score.json
        └── vision-judge.json

Writes that drive live status are atomic. Completed traces are immutable; recovery creates explicit evidence and promotion records rather than silently rewriting outcome history.