Introduction
Scientific visualization is a critical yet high-barrier task in research. Creating effective 3D or 4D visualizations of complex data—such as climate models or molecular structures—requires a rare combination of domain knowledge, expertise in specialized tools like ParaView, and proficiency in Python scripting. While Large Language Models (LLMs) have demonstrated remarkable general coding capabilities, they often struggle with niche scientific APIs, frequently hallucinating function names or failing to grasp the geometric logic required for spatial data.
To address these challenges, we present ChatVis, an LLM-powered assistant designed to automate the creation of complex scientific visualizations using the ParaView Python API. ChatVis allows scientists to describe desired visualizations in natural language and receive accurate, executable scripts in return.
Methodology
ChatVis employs a multi-stage pipeline to enhance LLM performance without the need for expensive retraining or fine-tuning. The architecture integrates several key components:
- Chain-of-Thought (CoT) Simplification: Complex user prompts are decomposed into a structured sequence of discrete ParaView operations, such as loading data, applying filters, and configuring camera settings.
- Retrieval-Augmented Generation (RAG): The system consults a vector database containing the latest ParaView documentation and curated code examples. This provides the LLM with "ground truth" API context immediately prior to code generation.
- Iterative Error Correction: If a generated script fails, ChatVis captures the Python traceback and feeds it back to the LLM for correction. This loop continues until a valid visualization is produced.
Benchmarking and Datasets
To evaluate ChatVis, we introduced a new benchmark suite consisting of 20 visualization tasks across three difficulty levels:
- Canonical Visualizations: Standard operations like isosurfacing and streamline tracing.
- ParaView Regression Tests: Specific API routines adapted from ParaView’s internal testing framework.
- Scientific Use Cases: High-complexity scenarios, including ocean climate modeling and materials science reconstruction.
Performance was measured not only by code executability (pass@1) but also by visual validation using image similarity metrics such as SSIM, PSNR, and LPIPS to ensure the output matches reference "ground truth" images.
Results and Key Insights
ChatVis achieved a 95% pass@1 success rate, significantly outperforming standalone state-of-the-art models like GPT-4o (40%) and o1-pro (50%). In the most challenging scientific use cases, ChatVis was the only system capable of producing executable scripts.
Beyond success rates, ChatVis demonstrated superior visual fidelity, achieving an SSIM of 0.80 and an LPIPS score of 0.26, significantly outperforming unassisted models. These results highlight that RAG is essential for specialized APIs where models otherwise tend to hallucinate. Furthermore, the iterative correction loop effectively solves the "last mile" problem of fixing minor syntax or logic errors that would otherwise render a script useless.
Conclusion
ChatVis demonstrates that combining RAG with iterative error correction allows LLMs to overcome the barriers of niche scientific APIs. By bridging the gap between natural language descriptions and complex visualization code, ChatVis empowers researchers to focus on their science rather than the intricacies of visualization software. Future work will focus on expanding the framework to other tools like VisIt and implementing video-based metrics for time-varying data.
Summary updated