InteractScience: Programmatic and Visually-Grounded Evaluation of Interactive Scientific Demonstration Code Generation

Qiaosheng Chen, Yang Liu, Lei Li, Kai Chen, Qipeng Guo, Gong Cheng, Fei Yuan

As Large Language Models (LLMs) evolve from generating simple code snippets to building full-fledged applications, a major new frontier has emerged: generating interactive scientific demonstrations. These tools—ranging from simulations of planetary orbits to interactive protein folding visualizers—are essential for educators and researchers to bring abstract concepts to life.

However, creating these demonstrations requires a complex synthesis of two distinct skills: deep domain knowledge (e.g., physics equations or chemical properties) and precise reactive coding (e.g., JavaScript event listeners and DOM manipulation). Existing benchmarks fail to capture this synergy, typically testing either static code logic or text-based reasoning in isolation.

To address this gap, researchers have introduced InteractScience, the first benchmark dedicated to evaluating how well LLMs can generate holistic, interactive scientific applications.

The Evaluation Challenge

Evaluating interactive code is traditionally slow and subjective. It often relies on manual human review or simple static screenshots that miss "event-driven" bugs—for instance, a slider that moves visually but fails to update the underlying mathematical graph.

To overcome this, the authors of InteractScience designed a novel hybrid evaluation framework that moves beyond static analysis:

  1. Programmatic Functional Testing (PFT): Utilizing the Playwright automation framework, this method simulates real user interactions such as clicks, drags, and inputs. It programmatically verifies the Document Object Model (DOM) state to ensure that UI components are fully functional and reactive.
  2. Visually-Grounded Qualitative Testing (VQT): Because code can be functionally bug-free but "scientifically wrong" (e.g., a projectile following a straight line instead of a parabola), VQT employs a Vision-Language Model (VLM) as a judge—specifically Gemini-1.5-Pro. The judge is provided with a reference snapshot, the generated output, and a checklist of scientific criteria to ensure the visualization is physically and mathematically accurate.

The InteractScience Benchmark

To build the benchmark, the researchers curated data from the Wolfram Demonstrations Project, providing a diverse set of "seed" data with reliable visual ground truths. They used metadata from these high-quality demos to prompt an LLM to generate detailed "Implementation Plans," which serve as the ground-truth instructions for the models being tested.

The resulting dataset consists of:

  • 150 problems spanning five disciplines: Mathematics, Physics, Chemistry, Earth Science, and Computer Science.
  • Difficulty Stratification: Problems are categorized (Easy, Medium, Hard) based on the number of interactive components.
  • Evaluation Suite: A robust testing pipeline comprising 779 PFT unit tests and 590 VQT unit tests.

Key Insights: The "Superficial Competence" Gap

The evaluation of 30 leading models—including GPT-4o, Claude 3.5 Sonnet, and DeepSeek-V3—revealed several fascinating insights into the current state of AI code generation.

The most striking finding is the "Superficial Competence" gap. Models frequently achieve high Action Success Rates (over 85%) in functional testing, meaning the buttons and sliders "work" without crashing the application. However, their VLM-Judge scores are significantly lower (often below 60). This reveals that while AI can easily build an aesthetically pleasing and functional user interface, it frequently fails to connect that interface to accurate underlying scientific logic.

Other notable findings include:

  • The Difficulty Paradox: Counter-intuitively, models performed better on "Hard" problems during functional testing. The researchers discovered that "Hard" tasks often utilized many simple binary controls (like checkboxes), which are syntactically easier to code than the complex parameterized sliders (requiring specific min, max, and step attributes) found in "Easy" tasks.
  • Discipline-Specific Bottlenecks: Models excelled at Computer Science and Chemistry tasks, which often rely on discrete, standard UI logic. Conversely, they struggled significantly with Physics and Earth Science, which require continuous dynamic simulations and complex frame-by-frame visual updates.

Model Performance and Future Directions

Overall, closed-source frontier models led the pack in functional correctness. However, generating a flawless scientific demonstration remains an incredibly difficult task for any AI. The Perfect Pass Rate (PPR)—where a model passes every single unit test for a given problem—rarely exceeded 16% across the board.

Importantly, the VLM-as-judge approach proved highly effective, showing a strong Spearman correlation (0.88) with human expert judgments. This establishes it as a viable, automated alternative to expensive manual review.

While InteractScience represents a massive leap forward, the authors note a few limitations. The current VQT framework evaluates static screenshots taken after interactions, meaning it cannot yet judge the "smoothness" of an animation or temporal consistency (e.g., if a simulated object flickers while moving). Furthermore, the reliance on Wolfram data may introduce a specific visual style bias.

Future iterations of the benchmark will likely explore video-based judging and agent-driven testing, where an AI agent autonomously "plays" with the generated demo to uncover edge-case bugs. For now, InteractScience establishes a crucial foundation for building reliable, AI-driven educational and scientific tools.

Summary updated

BibTeX
@inproceedings{chen2026interactscience,
  author = {Qiaosheng Chen and Yang Liu and Lei Li and Kai Chen and Qipeng Guo and Gong Cheng and Fei Yuan},
  title = {{InteractScience: Programmatic and Visually-Grounded Evaluation of Interactive Scientific Demonstration Code Generation}},
  booktitle = {International Conference on Machine Learning},
  year = {2026},
  url = {https://openreview.net/forum?id=QooehkRtN5},
}
Figure