LLM-Based Academic Figure Generation: A Practical Guide

    This guide explains how to combine reasoning-capable large language models with diffusion-based image models to produce accurate, reproducible academic figures. It covers a three-layer architecture—semantic parsing, orchestration, and quality review—along with prompt design, hybrid rendering strategies, automated validation, common pitfalls, and deployment using general-purpose cloud services. Readers will learn how to treat the LLM as a specification compiler and reviewer rather than a painter.

    1. Background and Problem Definition

    Reasoning capabilities in coding assistants and general-purpose LLMs have improved rapidly. Both closed-source and open-source models continue to advance in code understanding, long-context reasoning, and structured output, while domestic models are competitive in Chinese semantic understanding and engineering usability. At the same time, diffusion-based image models excel at pixel-level generation but lack a deep understanding of scientific semantics: they do not know that axes should be monotonic, that error bars may represent standard deviation or standard error, or that a paper figure must follow conventions for font size, line width, color palette, and whitespace.

    This creates a typical engineering problem: how to use a model that can reason to constrain a model that can draw. This article frames the problem as a general technical pipeline—a semantic parsing layer converts research intent into a structured figure description, an orchestration layer schedules rendering and validation, and a quality layer performs automated review and iteration. This approach aligns with common industry solutions and does not depend on any vendor-specific proprietary interface.

    2. Why Image Models Alone Are Not Enough

    First, there is a semantic gap. The conditioning input of an image model is text or a low-dimensional vector, and it has no verifiable internal representation for concepts such as “statistical significance,” “confidence interval,” or “ablation study.” This often produces figures that look polished but convey the wrong meaning.

    Second, constraint enforcement is missing. Academic figures have hard readability requirements: minimum font size, line contrast, colorblind-friendly palettes, and vector scalability. These are deterministic rules, and expressing them with rules and code is far more reliable than expressing them through sampling probabilities.

    Third, reproducibility is required. A paper may need to regenerate the same figure months or even years later, which requires inputs, random seeds, and dependency versions to be fully traceable. Interactive, “reroll”-style generation does not naturally satisfy this requirement.

    3. Overall Architecture: Three Decoupled Layers

    A three-layer decoupled architecture is recommended, with layers communicating through structured data contracts.

    1. {
    2. "figure_spec": {
    3. "type": "line+scatter_combo",
    4. "axes": {"x": "epoch", "y": "accuracy", "y_scale": "linear"},
    5. "series": [{"name": "baseline", "uncertainty": "std"}],
    6. "annotations": [{"text": "p < 0.05", "anchor": [120, 0.91]}],
    7. "style": {"palette": "colorblind_safe", "min_font_pt": 8}
    8. },
    9. "constraints": ["vector_output", "no_chartjunk"]
    10. }

    The semantic parsing layer outputs the specification above. The orchestration layer uses it to choose programmatic rendering, generative rendering, or a hybrid of both. The quality layer scores the result and writes back revision feedback, forming a closed loop.

    4. Semantic Parsing Layer: Turning Research Intent into an Executable Specification

    The key practice is to have the LLM act as a “structured translator” rather than a “painter.” The prompt should contain four parts: a role definition, a summary of the input data, output mode constraints, and prohibited items.

    1. You are a scientific figure specification compiler. Output JSON only, with no explanation.
    2. Inputs: a table of experiment metrics, a list of comparison methods, and the target journal column width (single-column/double-column).
    3. Rules:
    4. 1) The uncertainty type must be declared explicitly;
    5. 2) When there are more than 6 series, use faceting instead of overlaying;
    6. 3) All axes must include units;
    7. 4) Do not generate values that do not appear in the data.

    In engineering practice, enable structured output or function calling, and use schema validation to reject invalid fields. The temperature parameter should be set low to improve consistency across runs.

    5. Orchestration Layer: A Hybrid Generation Strategy

    For the vast majority of paper figures, prefer programmatic rendering (bar charts, line charts, heatmaps, flowcharts), because coordinates and values are precisely controllable. Use generative rendering only for parts without precise numerical values, such as conceptual diagrams and mechanism illustrations, and use sketches or depth maps as conditioning inputs to reduce structural drift.

    1. def render(spec, data, seed=0):
    2. if spec["type"] in {"bar", "line", "heatmap", "box"}:
    3. return plot_from_spec(spec, data) # precise, reproducible
    4. draft = sketch_from_spec(spec) # generate a compositional sketch
    5. return image_model(draft, seed=seed) # pixel-level refinement

    The value of the hybrid strategy is to keep uncertainty contained: numerical regions are handled by deterministic code, and artistic regions are handled by the generative model.

    6. Quality Layer: An Automated Review Loop

    Review should include four types of checks: numerical consistency (comparing values in the figure against the source data), convention compliance (font size, line width, contrast thresholds), semantic correctness (one-to-one correspondence between legends and series), and visual redundancy detection. Checks can be written as executable test cases. If any check fails, regeneration is triggered with revision feedback, and a maximum iteration count is set to control cost.

    7. Engineering Deployment with General-Purpose Baidu AI Cloud Capabilities

    To productize the workflow, general-purpose cloud product categories from Baidu AI Cloud can support each stage: object storage holds specification files and versioned image artifacts; a container platform runs rendering and validation tasks; a message queue decouples batch rendering requests; logging and monitoring/alerting services track failure rates and latency; and data management services maintain experiment metric versions. Model inference can be integrated through a unified model service interface to avoid binding to a single vendor.

    8. Common Pitfalls and How to Avoid Them

    First, prevent the model from “filling in” missing data; this must be prohibited in both the prompt and validation. Second, avoid pursuing aesthetics to the point of information distortion; follow the data-ink ratio and the principle of removing decoration. Third, do not ignore readers with color vision deficiencies; use colorblind-friendly palettes supplemented by shape distinctions. Fourth, do not treat bitmaps as the final deliverable; retain vector output and the source specification so the figure can be redrawn.

    9. Conclusion

    The correct role for an LLM is a “specification compiler and reviewer,” while the image model is the “executor.” Only by decomposing semantics, conventions, and reproducibility into verifiable engineering steps can high-quality figures be produced reliably under the strict standards of top academic venues.