# AI-Powered Diagram Generation Guide Complete prompt engineering reference for generating distinctive, publication-quality diagrams. ## Why Prompts Matter More Than Anything The same Gemini model produces wildly different results depending on prompt quality: - **Generic prompt** → boring corporate flowchart with random colors - **Style-specific prompt** → distinctive, memorable figure with consistent visual identity The style block at the top of your prompt is the single most important factor. ## Model Selection | Model | Best For | Notes | |-------|----------|-------| | `gemini-3-pro-image-preview` | All technical diagrams | Best text rendering, highest structural fidelity | | DALL-E 3 | Conceptual illustrations | Better aesthetics, worse at precise text placement | ## Prompt Architecture (6 Sections) ### Section 1: Framing (5-10 lines) Set the tone and context. This shapes the model's entire approach. **For Sketch/简笔画 style**: ``` Create a warm, hand-drawn-style technical diagram for a NeurIPS machine learning paper. The diagram should feel like a carefully drawn whiteboard sketch — approachable and clear, with personality in the line work, but still precise enough for a top venue. Think: the kind of diagram a brilliant researcher would draw during a coffee chat to explain their system. ``` **For Modern Minimal style**: ``` Create an ultra-clean, modern technical architecture diagram for an ICML paper. The diagram should feel like a premium design system — confident, spacious, and authoritative. Think: Apple's developer documentation meets a Nature paper. Every element earns its space. No visual noise. ``` **For Illustrated Technical style**: ``` Create a richly illustrated technical diagram for an ICLR paper. Each component should have a small, meaningful line-art icon that helps the reader instantly understand its purpose. The diagram should be self-explanatory — a reader should grasp the system architecture just by looking at the figure, before reading the caption. Think: the best technical documentation you've ever seen. ``` ### Section 2: Visual Style (20-40 lines) This is the MOST important section. Copy the full style block from SKILL.md and expand with more detail. Be extremely specific about visual characteristics. **Key principle**: Describe the *feeling* and *materiality*, not just the geometry. Good: "Lines should wobble gently like drawn with a thick felt-tip marker on smooth paper" Bad: "Lines should be slightly irregular" Good: "Fill colors are soft watercolor-like washes — imagine diluted ink bleeding into damp paper" Bad: "Use light colors" Good: "Components float on the background with barely-there shadows (1px offset, 6px blur, 3% opacity)" Bad: "Add subtle shadows" ### Section 3: Color Palette (10-15 lines) Always specify exact hex codes. Never leave color to the model's discretion. **"Ocean Dusk" palette** (professional, calming): ``` COLOR PALETTE (use EXACTLY these colors, no substitutions): - Primary components: Deep Teal #264653 - Secondary components: Teal #2A9D8F - Accent / highlights: Gold #E9C46A - Warm connections: Sandy Orange #F4A261 - Alert / error paths: Burnt Coral #E76F51 - Backgrounds: Warm off-white #FAFAF7 - Text primary: Nearly black #1A1A2E - Text secondary: Warm gray #6B7280 - Borders (if any): Soft gray #E5E7EB ``` **"Ink & Wash" palette** (for 简笔画): ``` COLOR PALETTE — INK AND WASH: - All outlines and text: Charcoal ink #2C2C2C - Wash fill 1: Diluted blue #D6E4F0 (like watercolor blue, very soft) - Wash fill 2: Warm wheat #F5DEB3 (like tea-stained paper) - Wash fill 3: Soft sage #D4E6D4 (like pale green ink wash) - Wash fill 4: Faint lavender #E6DFF0 (like diluted purple ink) - Background: Warm paper #FAFAF7 (NOT pure white — should feel like quality drawing paper) - Accent marks: Terracotta #C0725E (used sparingly for emphasis) ``` **"Nord" palette** (for modern minimal): ``` COLOR PALETTE — NORD: - Primary: Polar Night #2E3440 - Section fills: Snow Storm #ECEFF4, #E5E9F0, #D8DEE9 - Accent Blue: Frost #5E81AC - Accent Green: Aurora #A3BE8C - Accent Yellow: Aurora #EBCB8B - Accent Red: Aurora #BF616A - Text: Polar Night #2E3440 - Subtle text: #4C566A ``` ### Section 4: Layout Description (50-150 lines) **Be exhaustively specific.** This is where most prompts fail — they're too vague. Rules for writing layout descriptions: 1. **Name every box** with exact text content 2. **Specify spatial relationships** explicitly ("Box A is to the LEFT of Box B") 3. **Include subtitles/descriptions** for each component 4. **Describe grouping** ("These 3 boxes are inside a section labeled X") 5. **Specify dimensions** relatively ("roughly 2:1 width-to-height ratio") **Example (Sketch/简笔画 style)**: ``` LAYOUT — THREE-STAGE PIPELINE (left to right): The diagram flows LEFT to RIGHT across three main stages, with a feedback loop curving back from right to left at the bottom. STAGE 1 — "Observe" (left third of diagram): - Draw a rounded blob (not a rectangle!) with soft blue wash fill (#D6E4F0) - Inside the blob: hand-drawn icon of an EYE (simple line drawing, 3 curved lines) - Below the icon: "Observe" in bold charcoal - Below that: "Gather signals from environment" in smaller text - A small stack of paper sheets icon to the lower-right of the blob, labeled "Raw Data" with a tiny arrow pointing into the blob STAGE 2 — "Hypothesize" (middle third): - Draw a rounded blob with warm wheat wash fill (#F5DEB3) - Inside: hand-drawn LIGHTBULB icon (simple: circle + filament lines + base) - Below: "Hypothesize" in bold - Below: "Form testable predictions" in smaller text - Two small thought-bubble circles trailing from the blob upward, suggesting the thinking process STAGE 3 — "Verify" (right third): - Draw a rounded blob with sage wash fill (#D4E6D4) - Inside: hand-drawn CHECKMARK icon (a satisfying thick check) - Below: "Verify" in bold - Below: "Test against evidence" in smaller text FEEDBACK LOOP: - A long curved dashed arrow from "Verify" back to "Observe", curving BELOW the three stages - Label on the arrow: "refine & iterate" in italic - The arrow should feel like a casual hand-drawn curve, not a geometric arc ``` ### Section 5: Connections (30-80 lines) Describe every arrow individually. Arrows carry the semantic meaning of diagrams. **Per-arrow specification template**: ``` ARROW [N]: [Source] → [Target] - Style: [solid / dashed / dotted] - Color: [hex code] - Weight: [thin 1px / medium 2px / thick 3px] - Routing: [straight / curves UP / curves DOWN / bezier around X] - Label: "[text]" in [italic / bold], positioned [above / below / alongside] - Arrowhead: [filled triangle / open chevron / circle dot] ``` **Style-specific arrow conventions**: | Style | Arrow Character | |-------|----------------| | Sketch/简笔画 | Hand-drawn curves, open arrowheads, labels in casual handwriting | | Modern Minimal | Thin gray (#6B7280) straight lines, small filled dot at source, clean chevron at target | | Illustrated | Colored bezier curves matching source, medium weight, label badges | | Classic Academic | Solid colored lines matching source section, filled triangle heads | ### Section 6: Constraints (10-15 lines) Adapt constraints to the chosen style: **For Sketch/简笔画**: ``` CONSTRAINTS: - Lines should look HAND-DRAWN but still legible — wobbly, not chaotic - NO clip art, NO stock icons, NO photorealistic elements - NO emoji — icons must be simple LINE DRAWINGS in charcoal - NO figure numbers, NO captions, NO watermarks - Background is warm off-white #FAFAF7, NOT pure white - Overall composition should feel warm and inviting, like a sketchbook page - Every text label spelled EXACTLY as specified - Publication quality — this is for NeurIPS, not a napkin sketch ``` **For Modern Minimal**: ``` CONSTRAINTS: - ZERO decoration — no icons, no illustrations, no ornaments - NO visible borders on component boxes — they float using subtle shadow only - NO thick colored lines — all connections are thin gray - NO gradients, NO patterns, NO textures - Whitespace is a design element — at least 24px between all elements - NO figure numbers, NO captions, NO watermarks - Background pure white #FFFFFF - Every text label spelled EXACTLY as specified ``` ## Complete Prompt Examples ### Example 1: Agent System (Sketch/简笔画 Style) ``` Create a warm, hand-drawn-style technical diagram for a NeurIPS paper showing an autonomous research agent system. The diagram should feel like a carefully drawn whiteboard sketch — approachable yet precise. VISUAL STYLE — HAND-DRAWN SKETCH: - Slightly irregular, hand-drawn line quality — lines wobble gently, not perfectly straight - Rounded, soft shapes with visible pen strokes (like drawn with a thick felt-tip marker) - Warm off-white background (#FAFAF7) - Fill colors are soft watercolor washes: blue #D6E4F0, wheat #F5DEB3, sage #D4E6D4 - Borders are charcoal #2C2C2C, 2-3px, slightly uneven - Arrows hand-drawn with natural curves, open arrowheads - Small doodle-style line-art icons inside each component (NOT emoji, NOT clip art) - Text in rounded sans-serif, warm and readable COLOR PALETTE — INK AND WASH: - Outlines/text: Charcoal #2C2C2C - Planner fill: Blue wash #D6E4F0 - Executor fill: Wheat wash #F5DEB3 - Verifier fill: Sage wash #D4E6D4 - Background: Warm paper #FAFAF7 - Failure/retry: Terracotta #C0725E LAYOUT — TRIANGULAR ARRANGEMENT: Three rounded blob shapes arranged in a triangle: TOP CENTER — "Planner" blob: - Blue wash fill (#D6E4F0) - Line-art icon: a small COMPASS or MAP (simple 2D line drawing) - Bold label: "Planner" - Subtitle: "Decomposes research questions" BOTTOM LEFT — "Executor" blob: - Wheat wash fill (#F5DEB3) - Line-art icon: a small GEAR or WRENCH - Bold label: "Executor" - Subtitle: "Runs experiments & tools" BOTTOM RIGHT — "Verifier" blob: - Sage wash fill (#D4E6D4) - Line-art icon: a small MAGNIFYING GLASS - Bold label: "Verifier" - Subtitle: "Checks results & evidence" ARROWS: 1. Planner → Executor: curved arrow going DOWN-LEFT, charcoal, solid Label: "task plan" (italic, small) 2. Executor → Verifier: curved arrow going RIGHT, charcoal, solid Label: "raw results" (italic, small) 3. Verifier → Planner: curved arrow going UP-LEFT, terracotta #C0725E, DASHED Label: "needs revision" (italic, small) This is the feedback/retry path — dashed to show it's conditional CENTER of triangle: small text "Shared Memory" with a tiny notebook icon CONSTRAINTS: - Hand-drawn feel but still publication quality for NeurIPS - NO clip art, NO stock icons — only simple line drawings - NO figure numbers, NO captions - Warm off-white background, NOT pure white - Every label spelled EXACTLY as written ``` ### Example 2: Training Pipeline (Modern Minimal Style) ``` Create an ultra-clean, modern technical architecture diagram for an ICML paper. Confident, spacious, authoritative. Think: Apple developer docs meets Nature paper. VISUAL STYLE — MODERN MINIMAL: - Ultra-clean geometric shapes with crisp edges - Bold color blocks as section fills using desaturated tones - Component boxes: 12px rounded corners, NO visible border, float on section background with subtle shadow (1px, 4px blur, rgba(0,0,0,0.06)) - ONE accent color per section, used on section header only - Arrows: thin 1.5px, dark gray #6B7280, small filled circle at source, clean open chevron at target - Typography: system sans-serif, titles 600 weight, body 400 weight - Labels INSIDE boxes, generous whitespace (24px+ between elements) COLOR PALETTE — NORD: - Deep text: #2E3440 - Section 1 fill: #EEF1F6 (blue tint), accent: #5E81AC - Section 2 fill: #EDF3ED (green tint), accent: #A3BE8C - Section 3 fill: #F5F2EA (yellow tint), accent: #EBCB8B - Box fill: White #FFFFFF - Arrows: #6B7280 LAYOUT — THREE HORIZONTAL SECTIONS: Three wide horizontal bands, stacked vertically with 16px gaps. Each section is a full-width rounded rectangle (8px corners). [SECTION 1 — "Data" — blue tint background #EEF1F6] - Small section header top-left: "DATA" in #5E81AC, small caps, letter-spaced - Three white floating boxes in a row: Box: "Corpus" / "1.2T tokens" Box: "Filter" / "Quality + dedup" Box: "Tokenize" / "BPE 32K" [SECTION 2 — "Train" — green tint background #EDF3ED] - Header: "TRAIN" in #A3BE8C - Three white floating boxes: Box: "Model" / "7B · 32 layers" Box: "Optimize" / "AdamW · cosine" Box: "Checkpoint" / "Every 1K steps" [SECTION 3 — "Evaluate" — yellow tint background #F5F2EA] - Header: "EVALUATE" in #EBCB8B - Three white floating boxes: Box: "Benchmark" / "MMLU · HumanEval" Box: "Analyze" / "Scaling curves" Box: "Report" / "Camera-ready" ARROWS: 1. "Tokenize" → "Model": thin gray #6B7280, vertical, label "feeds" 2. "Checkpoint" → "Benchmark": thin gray, vertical, label "evaluate" 3. "Analyze" → "Report": thin gray, horizontal, label "publish" CONSTRAINTS: - ZERO decoration — no icons, no illustrations - NO visible box borders — shadow only - Generous whitespace between all elements - NO figure numbers, NO captions, NO watermarks - Background: pure white #FFFFFF - All labels EXACTLY as written - Publication quality for ICML 2026 ``` ## Multi-Attempt Evaluation Rubric Rate each attempt on these 5 dimensions (1-5 scale): | Dimension | What to Check | Weight | |-----------|---------------|--------| | **Style fidelity** | Does it match the requested visual style? (e.g., hand-drawn feel, clean minimal) | 30% | | **Text accuracy** | All labels spelled correctly, no phantom text? | 25% | | **Layout fidelity** | Spatial arrangement matches prompt? | 20% | | **Color accuracy** | Colors match hex codes? Consistent? | 15% | | **Connection accuracy** | All arrows present, correct routing and labels? | 10% | **If style fidelity fails**: Strengthen the style block with more sensory descriptions. Add "The overall aesthetic should resemble [specific reference]." **If text fails**: Add `CRITICAL: The word "[exact word]" must appear EXACTLY. Do not abbreviate, do not change capitalization.` **If layout fails**: Add explicit coordinates or grid references. "Box A is at position (left: 10%, top: 20%)." ## TikZ Alternative (for LaTeX-native diagrams) Use when the diagram is simple enough for deterministic output: ```latex \begin{tikzpicture}[ box/.style={draw=#1, fill=#1!8, rounded corners=6pt, minimum width=2.8cm, minimum height=1cm, font=\small\sffamily, line width=0.8pt}, lbl/.style={font=\scriptsize\sffamily\itshape, text=#1}, arr/.style={-{Stealth[length=5pt]}, line width=0.8pt, color=#1}, ] \node[box=teal] (plan) at (0,0) {Planner}; \node[box=orange] (exec) at (4,0) {Executor}; \node[box=olive] (veri) at (8,0) {Verifier}; \draw[arr=gray] (plan) -- (exec) node[midway, above, lbl=gray] {task plan}; \draw[arr=gray] (exec) -- (veri) node[midway, above, lbl=gray] {results}; \draw[arr=red!60, dashed] (veri) to[bend right=30] node[midway, below, lbl=red!60] {revise} (plan); \end{tikzpicture} ``` ## Mermaid for Quick Prototyping Sketch the logical flow before investing in Gemini generation: ```mermaid graph LR A[Observe] --> B[Hypothesize] B --> C[Verify] C -.->|refine| A ``` Validate the structure is correct, then write the full Gemini prompt.