mcp-web-experiments / README.md
flekschas's picture
Cite the dataset itself, list both authors
67375b3 verified
|
Raw History Blame Contribute Delete
24.1 kB
metadata
pretty_name: 'Code vs Tools: How LLM Agents Author Large Visualization Specs'
license: cc-by-4.0
language:
  - en
size_categories:
  - 1K<n<10K
task_categories:
  - text-generation
tags:
  - agents
  - tool-use
  - model-context-protocol
  - code-generation
  - data-visualization
  - vega-lite
  - genomics
  - llm-as-a-judge
configs:
  - config_name: generations
    default: true
    data_files:
      - split: main
        path: generations/main.parquet
      - split: docs_fix
        path: generations/docs_fix.parquet
      - split: familiarity
        path: generations/familiarity.parquet
      - split: constructors
        path: generations/constructors.parquet
      - split: turns
        path: generations/turns.parquet
  - config_name: tasks
    data_files:
      - split: tasks
        path: tasks/tasks.parquet
  - config_name: judge_ratings
    data_files:
      - split: stages
        path: judging/judge-ratings.parquet
  - config_name: human_sample
    data_files:
      - split: sample
        path: judging/human/sample.parquet
  - config_name: human_ratings
    data_files:
      - split: rater_1
        path: judging/human/rater-1.parquet
      - split: rater_2
        path: judging/human/rater-2.parquet
  - config_name: pilot
    data_files:
      - split: runs
        path: pilot/runs.parquet

Code vs Tools: How LLM Agents Author Large Visualization Specs

Data behind the tool interface evaluation of MCP-Web. Authors: Fritz Lekschas and Emily Reif.

LLM agents wrote visualization specs in three grammars with large, recursive JSON Schemas: Vega-Lite (well known to models), Gosling, and GenomeSpy (much less known). Each agent got a chart request and data rows and had to produce a valid spec through one of several tool interfaces. The interfaces vary along the design choices the paper asks about:

Question Factor Levels
Q1 Format format json (tool arguments) or code (a program run in a sandbox)
Q2 Granularity granularity whole-spec (the model writes the whole spec) or constructors (many tools generated from the schema); Vega-Lite also has flint (a custom language)
Q3 Documentation docs full schema docs or a compact index (constructor groups with an index look details up on demand); none in the familiarity probe
Q4 Feedback hints error hints learned from other tasks' errors, in the docs and appended to matching validation errors
Q5 Model model five model settings plus one open-weights model

Each generation was scored automatically (scripted task checks plus an LLM judge comparing its render with a reference render), and its tokens, cost, time, and steps were recorded.

Layout

Folder Files Size
analysis/ 34 3.8 MB
configs/ 19 1.1 MB
generations/ 5 1.5 MB
interfaces/ 101 4.5 MB
judging/ 214 4.9 MB
pilot/ 8 1.2 MB
tasks/ 28 0.4 MB
transcripts/ 14 45.3 MB

Tables are Parquet, for example pd.read_parquet or load_dataset(..., "generations", split="main"). Specs, programs, and other nested values are JSON strings. The full records (transcripts/, the pilot's records.jsonl.gz, example requests) are gzipped JSON Lines.

generations/   one row per generation, one Parquet file per study
transcripts/   the harness's full record of each generation, keyed by `id`
tasks/         the 24 tasks (8 per grammar), reference renders, source licenses
interfaces/    the docs and tool descriptions each interface showed, hint tables, example request bodies
configs/       the frozen run configurations (models, limits, cells, analysis plans)
judging/       rubric and prompt, per-stage judge ratings, second judge, human ratings
pilot/         the earlier Vega-Lite pilot behind R4's claim about collecting validation errors
analysis/      the analyses' own outputs (reports and JSON), and verification.json

Studies (splits of generations)

Split Rows Grammars Models Interfaces Infrastructure failures
main 4,608 vega-lite, gosling, genomespy 6 12 2
docs_fix 864 vega-lite, gosling, genomespy 6 2 0
familiarity 432 vega-lite, gosling, genomespy 6 1 0
constructors 480 gosling, genomespy 5 2 1
turns 51 vega-lite, gosling, genomespy 3 2 0
  • main: the full grid. Vega-Lite has 12 interfaces, Gosling and GenomeSpy 10 (no Flint): every combination of json/code with complete (whole spec, full docs), complete-index (whole spec, index), complete-index-hints, functions (constructors, all tools shown), functions-index (constructors, index with lookup), and flint. 8 tasks × 3 repetitions per cell. The five-setting cohort (3,840 generations) plus DeepSeek V4.1 Flash (in_cohort false). Vega-Lite was the development grammar; Gosling and GenomeSpy are fresh replications.
  • docs_fix: json-complete and code-complete rerun with corrected full docs (docs_version fixed). The sealed docs had printer bugs that misstated or hid schema shapes (analysis/docs-fix/type-check/report.md). The paper's full-docs numbers (R1, Table 2) use these rows.
  • familiarity: json-contract-only, a whole-spec JSON tool with no grammar docs, to measure how well each model knows each grammar (R5).
  • constructors (Phase 7): within code, whole spec (variant whole-spec) vs strict constructors that collect every error and get the same hints (variant constructors), on Gosling and GenomeSpy (R3).
  • turns (Phase 8): json-batch, one build call carrying every constructor call, against one turn per constructor (Table 1); and json-functions-strict, OpenAI strict decoding for constructors (GPT-6 Sol low, Gosling, 8 runs). Three Gemini Vega-Lite runs of json-batch failed (the catalog did not fit: one returned nothing, two timed out); they are kept and score 0.

Models

model Model Effort Provider
gpt-6-sol GPT-6 Sol high OpenAI
gpt-6-sol-low GPT-6 Sol low OpenAI
claude-opus-5.5 Claude Opus 5.5 high Anthropic
claude-opus-5.5-low Claude Opus 5.5 low Anthropic
gemini-3.8-flash-medium Gemini 3.8 Flash medium Google
deepseek-v4.1-flash DeepSeek V4.1 Flash (open weights) medium Fireworks

Exact endpoints, prices, and limits are in configs/.

Where each paper result comes from

Pooled numbers are over the five cohort settings (in_cohort) unless noted. Paired comparisons pair rows on (grammar, task_id, model, repetition), drop pairs where either row has infrastructure_failure, and report candidate − reference; intervals in the analyses are task-clustered bootstraps.

Paper Rows to use Columns Computed result
Setup: 3,840 cohort generations main, in_cohort analysis/main/report.md
Judge validation: second judge, 93.7% agreement, κ 0.89 main first_/final_judge_rating, first_/final_second_judge_rating judging/second-judge/report.{md,json}
Judge validation: humans vs judge κ 0.72 / 0.70, human–human κ 0.90 judging/human/sample.parquet, rater-1.parquet, rater-2.parquet primary_judge_rating, rating judging/human/agreement.{md,json}
R1: code − JSON with full docs, −0.007 / −0.004 / −0.005 docs_fix, in_cohort interface json-complete vs code-complete, final_quality analysis/docs-fix/<grammar>/analysis.json (contrasts, plan json-vs-code:complete, scope pooled, side fixed)
R1: code first seemed to win on GenomeSpy (+0.084) main, GenomeSpy (sealed docs) same same file, side sealed; printer bugs in analysis/docs-fix/type-check/
R2: JSON constructors 1.5M tokens, $0.25, 65 s; whole spec 22–87k, $0.03–0.04, 20–33 s main + docs_fix, in_interface_map total_tokens, cost_usd, run_seconds analysis/interface-map/map.json (defaults)
R2: constructors from code cut tokens 89–94%, quality +0.03 / −0.10 / +0.01 main interface json-functions vs code-functions analysis/main/analysis.json (comparisons, plan json-vs-code:functions)
R2 / Table 1: one build call turns (json-batch) with main DeepSeek Vega-Lite json-functions and code-functions final_quality, steps, charged_usd, run_seconds analysis/turns/report.md
R3: constructors within code, Gosling −0.07, GenomeSpy +0.03, 1.6–3.6× cost constructors variant, final_quality, cost_usd analysis/constructors/report.md, analysis.json
R3: GPT on GenomeSpy best with JSON constructors (+0.12 to +0.14) main + docs_fix, in_interface_map per-cell means analysis/interface-map/report.md
R4: index cuts tokens 2.3–2.4× against full docs main (index groups) and docs_fix (full docs), in_interface_map docs, total_tokens analysis/interface-map/map.json (defaults: *-complete vs *-complete-index)
R4: on GenomeSpy the index alone loses (−0.14 JSON, −0.16 code) docs_fix (full docs) vs main (index), in_cohort final_quality analysis/docs-fix/genomespy/analysis.json (contrasts, plan documentation-2x2:literal, side fixed)
R4: hints (GenomeSpy +0.13 JSON, +0.17 code; Gosling JSON −0.05) main interface *-complete-index vs *-complete-index-hints analysis/main/analysis.json (plan error-hints:compact)
R4: collecting every validation error (+9.8 points, 2.4× fewer tokens) pilot/runs.parquet, arm code-stop-at-first-error vs code-collect-errors, measures_the_cell reproduced, total_tokens analysis/pilot-collect-errors/report.txt
R5: no-docs first-try quality 0.87 / 0.61 / 0.23 (six models) familiarity first_quality analysis/familiarity/report.md
R5: ρ −0.81 between no-docs quality and best − worst spread; |ρ| ≤ 0.27 for which interface wins familiarity and in_interface_map rows per-cell means analysis/interface-map/map.json (map, correlations)
R6 / Table 2: shortfall from each pair's best, tokens, cost, time main + docs_fix, in_interface_map (18 grammar × model pairs, 10 interfaces) per-cell final_quality, total_tokens, cost_usd, run_seconds analysis/interface-map/map.json (defaults), report.md, map.html
Figure 3: easiest and hardest task per grammar tasks mean_final_quality_main
DeepSeek code − JSON per grammar main, DeepSeek analysis/main/deepseek/report.md

Recomputed from the released tables

analyze/build-hf-release.ts recomputes these numbers from the files in this release after writing them, and stores them in analysis/verification.json. "Paper" values are rounded as printed. A cell mean is the mean of final_quality over rows without an infrastructure failure; token and cost means also leave out usage_censored rows.

Number From the released tables Paper or source analysis Match
Largest difference over all 192 cohort cells: mean final quality 0 0 yes
Largest relative difference over all cohort cells: mean total tokens 0 0 yes
Main study, vega-lite: mean final quality over groups (cohort) 0.9661 0.9661 yes
Main study, gosling: mean final quality over groups (cohort) 0.7345 0.7345 yes
Main study, genomespy: mean final quality over groups (cohort) 0.8332 0.8332 yes
Table 2, code-complete-index-hints: mean shortfall 0.0433 0.0433 yes
Table 2, code-complete-index-hints: max shortfall 0.1693 0.1693 yes
Table 2, code-complete-index-hints: mean total tokens 21748 21748 yes
Table 2, code-complete-index-hints: mean cost (USD) 0.0292 0.0292 yes
Table 2, code-complete-index-hints: mean time (s) 20.15 20.15 yes
Table 2, json-complete: mean shortfall 0.0462 0.0462 yes
Table 2, json-complete: max shortfall 0.1456 0.1456 yes
Table 2, json-complete: mean total tokens 82426 82426 yes
Table 2, json-complete: mean cost (USD) 0.0395 0.0395 yes
Table 2, json-complete: mean time (s) 32.65 32.65 yes
Table 2, code-complete: mean shortfall 0.0517 0.0517 yes
Table 2, code-complete: max shortfall 0.1597 0.1597 yes
Table 2, code-complete: mean total tokens 87495 87495 yes
Table 2, code-complete: mean cost (USD) 0.0369 0.0369 yes
Table 2, code-complete: mean time (s) 26.61 26.61 yes
Table 2, json-functions: mean shortfall 0.0737 0.0737 yes
Table 2, json-functions: max shortfall 0.2530 0.2530 yes
Table 2, json-functions: mean total tokens 1508263 1508263 yes
Table 2, json-functions: mean cost (USD) 0.2467 0.2467 yes
Table 2, json-functions: mean time (s) 65.10 65.10 yes
R5, vega-lite: no-docs first-try quality 0.8710 0.8700 yes
R5, gosling: no-docs first-try quality 0.6071 0.6100 yes
R5, genomespy: no-docs first-try quality 0.2336 0.2300 yes
R5: Spearman ρ, no-docs quality vs best − worst spread -0.8147 -0.8100 yes
R1, vega-lite: code − JSON, corrected full docs (cohort) -0.0071 -0.0070 yes
R1, gosling: code − JSON, corrected full docs (cohort) -0.0038 -0.0040 yes
R1, genomespy: code − JSON, corrected full docs (cohort) -0.0049 -0.0050 yes
R2, vega-lite: code-functions / json-functions total tokens (cohort) 0.0610 0.0600 yes
R2, gosling: code-functions / json-functions total tokens (cohort) 0.1124 0.1100 yes
R2, genomespy: code-functions / json-functions total tokens (cohort) 0.0767 0.0800 yes
R3, gosling: constructors − whole spec within code (Phase 7, pooled) -0.0699 -0.0700 yes
R3, genomespy: constructors − whole spec within code (Phase 7, pooled) 0.0275 0.0300 yes
Table 1: pairs 24 24 yes
Table 1, One build call: quality 0.9381 0.9380 yes
Table 1, One build call: steps 3.46 3.50 yes
Table 1, One build call: cost (USD) 0.0431 0.0430 yes
Table 1, One build call: time (s) 47.27 47 yes
Table 1, A turn per constructor: quality 0.7723 0.7720 yes
Table 1, A turn per constructor: steps 17.17 17.20 yes
Table 1, A turn per constructor: cost (USD) 0.0473 0.0470 yes
Table 1, A turn per constructor: time (s) 93.36 93 yes
Table 1, Code over constructors: quality 0.8971 0.8970 yes
Table 1, Code over constructors: steps 2.63 2.60 yes
Table 1, Code over constructors: cost (USD) 0.0468 0.0470 yes
Table 1, Code over constructors: time (s) 30.57 31 yes
Second judge: exact agreement on 6548 judged stages 0.9369 0.9370 yes
R4 pilot: collect every error − stop at first, reproduced (153 pairs) 0.0980 0.0980 yes
R4 pilot: token ratio, stop at first / collect every error 2.41 2.40 yes

The second judge's agreement here leaves out the 41 judged stages whose scores the analysis later corrected (substitutions), so it covers 6,548 stages; the published 93.7% counts all 6,589.

pilot/

An earlier pilot on Vega-Lite with 11 models (none of them the five cohort settings) and its own tasks and scoring. It is the source of one claim in R4: returning every validation error of a program at once, instead of stopping at the first, raised visual reproduction by 9.8 points and used 2.4× fewer tokens. The pilot asked the agent to edit a chart to match a target, on five tasks of increasing size (rung 1–5, pilot/tasks.parquet), 3 repetitions per model, task, and arm.

  • runs.parquet: one row per run (660). arm is code-stop-at-first-error, code-collect-errors (both with factory constructors), code-collect-errors-literal (literal objects), or tools-stop-at-first-error (one tool per edit). reproduced is the outcome: the judge rated the final render 3 of 3 against the reference (visual_rating; no artifact, a failed render, or no marks count as 1, an exact match as 3). measures_the_cell is false for provider failures, stalls, and output-cap truncation; the analysis drops pairs with such a run. spec_score is a secondary spec-distance score. final_state is the final spec.
  • records.jsonl.gz: the harness's full record of each run, keyed by id.
  • tasks.parquet and references/: prompts, starting and reference specs, and reference renders.

How quality is scored

Each generation has two stages: first (the first submitted spec) and final (the last submitted spec; the agent is told to stop once a spec is accepted). For each stage:

  • valid: the host accepted the spec (schema validation, data binding, and, for Gosling and GenomeSpy, a native render).
  • nonblank: the render shows data marks.
  • task_score: share of the task's scripted checks passed (tasks.scripted_checks).
  • judge_rating: 1–3 from the primary judge (Claude Opus 5), comparing the candidate render with the task's reference render; rubric and prompt in judging/rubric.md. Invalid and blank stages get 1 by rule.
  • quality = 0 if not valid or blank, else (task_score + (judge_rating − 1) / 2) / 2, in [0, 1].

Rows are scored as the analyses score them. In main, three corrections apply, recorded per row in substitutions and described in analysis/main/analysis.json (substitutions):

  • spend-cap-rerun: 20 GenomeSpy runs that hit the $15 per-run spend cap because of unbilled dropped uploads were rerun; the reruns replace them (source_dir names the rerun directory).
  • blank-supplement: GenomeSpy stages scored blank because their marks set fillOpacity, which the blank test did not hide; the same judge rated them as visible charts.
  • flipped-blank: Gosling stages whose blank recheck flipped to visible but whose rerender shows no real ink; scored blank (quality 0).

All other studies are scored as judged. A separate, unapplied sensitivity analysis of Gosling scoring bugs is in analysis/sensitivity/.

Column dictionaries

generations/*.parquet

Column Meaning
id Run id, <grammar>--<task>--<model>--<interface or variant>--r<repetition>; keys transcripts/ and judging/
study main, docs_fix, familiarity, constructors, turns
source_dir Results directory in the authors' archive the row came from
grammar vega-lite, gosling, genomespy
task_id Task, see tasks/tasks.parquet
model, provider Model setting and API provider
in_cohort One of the five cohort settings (not DeepSeek)
interface Interface (group) name as the analyses use it, e.g. code-complete-index-hints
variant The follow-up study's arm (json-complete-fixed-docs, json-contract-only, whole-spec, constructors, json-batch, json-functions-strict); null in main
format json or code
granularity whole-spec, constructors, or flint
docs full, index, none, or flint
docs_version For full docs: sealed (original) or fixed (corrected printer)
hints Error hints in the docs and appended to matching errors
repetition 1–3
in_interface_map Feeds the interface map and Table 2 (the ten shared interfaces, full-docs cells from docs_fix)
infrastructure_failure Run says nothing about the interface (provider or harness failure); analyses drop it and its pairs
failure_class Harness outcome class (none, invalid, step-cap, infrastructure, …)
first_valid, final_valid Spec accepted by the host
first_nonblank, final_nonblank Render shows data marks (null if not valid)
final_cropped Render crop check fired
first_task_score, final_task_score Share of scripted checks passed
first_judge_rating, final_judge_rating Primary judge rating 1–3
first_quality, final_quality Stage quality in [0, 1] (null when unevaluable)
first_second_judge_rating, final_second_judge_rating GPT-6.1 Sol rating of the same render, main cohort stages whose primary rating came from a judge call; null otherwise
substitutions Scoring corrections applied, see above
usage_censored A request's usage never came back; token and cost means leave the row out
input_tokens, output_tokens, total_tokens Summed over the run's model requests (input includes cache reads and writes)
reasoning_tokens, cache_read_tokens Parts of the above
cost_usd Cost from reported usage at the registered prices
charged_usd Metered spend plus reservations for requests of unknown outcome (Phase 8 tables use this)
run_seconds Wall time, without the host's native render time
run_seconds_with_render Wall time including it
model_seconds Time in model requests
steps Model turns; step_cap_reached if it hit the 30-step cap
submissions, rejected_submissions, repairs Spec submissions, those rejected, and resubmissions after a rejection
validator_messages Validation errors returned to the model
malformed_tool_calls Tool calls with unparseable arguments
constructor_calls, constructor_failures Constructor groups only
lookups Docs lookups (functions-index groups)
final_spec The final stage's spec as validated and rendered, JSON string
final_code The final program, for code interfaces

transcripts/<study>/<grammar>.jsonl.gz

One line per generation: {id, source_dir, record}, where record is the harness's own row. record.result.details.attempts lists every submission (program or spec, host response, hints, materialized spec), record.result.usage.requests and record.result.timing.requests every model request, and for Gosling and GenomeSpy record.result.details.scored each check's outcome. The harness did not store the models' free text. interfaces/<grammar>/example-requests.jsonl.gz has the complete first request body (system prompt, task message, tools) for each interface and model on the first task; interfaces/<grammar>/documents/ has each interface's docs.

tasks/tasks.parquet

grammar, task_id, position, prompt, data_json (rows the model received), field_semantics_json, requirements, visual_checks (shown to the judge), scripted_checks (what task_score checks), reference_spec_json (never shown to the model), reference_image, difficulty_tier and difficulty_rationale (as designed), coverage, source (origin and license), mean_final_quality_main (cohort, all main runs). The tasks adapt MIT-licensed examples from flint-chart, Gosling, and GenomeSpy (tasks/licenses/); Gosling and GenomeSpy data rows are CC0.

judging/

  • rubric.md: judge system prompt, response schema, user message template, and the quality formula.
  • judge-ratings.parquet: per id and stage: judge_rating, source (judge, reused for an identical render judged once, rule for invalid or blank, supplement), reused_from, differences, rationale.
  • second-judge/: GPT-6.1 Sol (medium) on every judged main cohort stage.
  • human/sample.parquet: 180 stages sampled by grammar × primary rating (stratum_weight reweights to all judged stages), with the judge's text and both images in human/images/. rater-1.parquet and rater-2.parquet: two raters' blind ratings (item_id, rating, notes). Raters are anonymous. Human–judge and human–human agreement are in agreement.{md,json}.

License

CC BY 4.0. The tasks adapt MIT-licensed examples; their licenses are in tasks/licenses/. Model outputs are included for research use under each provider's terms.