# Which AI Model Performs Best for SVG Layout Generation in PPT Master: Claude 3.5 Sonnet vs GPT-4

> Discover which AI model excels at SVG layout generation in PPT Master. See Claude 3.5 Sonnet outperform GPT-4 with superior XML formatting and adherence to PPT constraints.

- Repository: [HugoHe/ppt-master](https://github.com/hugohe3/ppt-master)
- Tags: comparison
- Published: 2026-04-24

---

**Claude 3.5 Sonnet is the best AI model for SVG layout generation in PPT Master because it generates well-formed XML, follows layout specifications precisely, and respects PPT-compatible SVG constraints.**

The `hugohe3/ppt-master` repository relies on an **Executor** role to convert content into presentation-ready SVG documents. While the system supports multiple backends, the quality of your slide layouts depends heavily on selecting a model capable of producing syntactically correct markup that adheres to the strict rules defined in [`spec_lock.md`](https://github.com/hugohe3/ppt-master/blob/main/spec_lock.md) and [`shared-standards.md`](https://github.com/hugohe3/ppt-master/blob/main/shared-standards.md).

## Why Claude 3.5 Sonnet Excels at SVG Layout Generation

### Superior Code Generation for XML Structures

Claude 3.5 Sonnet demonstrates exceptional capability in generating well-formed XML/SVG snippets from natural language prompts. The Executor must emit a complete `<svg …>` document for every slide, requiring precise handling of nested tags, groups, and coordinate calculations. Errors in opening or closing tags break the subsequent validation step in [`skills/ppt-master/scripts/svg_quality_checker.py`](https://github.com/hugohe3/ppt-master/blob/main/skills/ppt-master/scripts/svg_quality_checker.py). According to the source code analysis, Claude 3.5 Sonnet maintains balanced XML trees consistently, preventing syntax errors that plague smaller models.

### Precision in Layout Specification Compliance

The model reliably follows the detailed layout rules documented in [`skills/ppt-master/references/image-layout-spec.md`](https://github.com/hugohe3/ppt-master/blob/main/skills/ppt-master/references/image-layout-spec.md), including grid systems, left-right and top-bottom rhythms, and density parameters (dense vs. breathing). The Executor reads [`spec_lock.md`](https://github.com/hugohe3/ppt-master/blob/main/spec_lock.md) and must honor exact dimensions and margins. Claude 3.5 Sonnet's instruction-following capabilities outperform other LLMs, reducing "layout drift" where generated slides deviate from the specified design language.

### Built-in Knowledge of PPT SVG Constraints

Effective SVG generation requires understanding which features are prohibited in PowerPoint-compatible files. [`skills/ppt-master/references/shared-standards.md`](https://github.com/hugohe3/ppt-master/blob/main/skills/ppt-master/references/shared-standards.md) lists banned elements including `<animate>` tags, external CSS references, and limited mask usage. Claude 3.5 Sonnet inherently avoids these restricted features, preventing the "banned-feature" errors that [`svg_quality_checker.py`](https://github.com/hugohe3/ppt-master/blob/main/svg_quality_checker.py) would otherwise flag during post-processing.

### Token Efficiency and Cost-Effectiveness

Claude 3.5 Sonnet offers an optimal balance between model capability and operational cost. The Executor processes slides sequentially while maintaining context of the global design language. This model generates complex SVGs for entire decks without hitting token limits, making it suitable for production pipelines where `IMAGE_BACKEND=anthropic` is configured.

## Configuring Claude 3.5 Sonnet via OpenRouter

The repository uses OpenRouter as its generic LLM interface. To override the default agent model, configure your environment variables before running the pipeline.

Set the backend and model in your `.env` file:

```bash

# .env (project root) – overrides the default LLM for the Executor

IMAGE_BACKEND=openrouter
OPENROUTER_MODEL=anthropic/claude-3-5-sonnet

```

Execute the pipeline to generate SVG layouts:

```bash

# Initialize project

python3 skills/ppt-master/scripts/project_manager.py init my_deck --format ppt169

# Import source content

python3 skills/ppt-master/scripts/project_manager.py import-sources my_deck source.docx --move

# The Executor automatically uses Claude 3.5 Sonnet via OpenRouter

# Output appears in <project>/svg_output/

```

## Using GPT-4 Turbo as a Fallback Alternative

If Anthropic is unavailable, **OpenAI GPT-4 Turbo** serves as the recommended secondary option. It matches Claude's capabilities in structured code generation and specification compliance.

Configure the OpenAI backend:

```ini

# .env

IMAGE_BACKEND=openai
OPENAI_MODEL=gpt-4-turbo

```

Run the identical pipeline commands. The Executor in [`skills/ppt-master/scripts/image_gen.py`](https://github.com/hugohe3/ppt-master/blob/main/skills/ppt-master/scripts/image_gen.py) will route requests to OpenAI's endpoint instead of OpenRouter.

## Validating SVG Output Quality

After generation, always verify compliance using the quality checker to catch any model-specific violations:

```bash

# Validate generated SVGs against PPT constraints

python3 skills/ppt-master/scripts/svg_quality_checker.py my_deck

```

Expect "0 errors" when using Claude 3.5 Sonnet or GPT-4 Turbo. If violations appear (such as banned animation tags or invalid CSS), the model configuration requires adjustment back to the recommended settings.

## Understanding the Executor Architecture

Several key files govern how the AI generates SVG layouts:

- **[`skills/ppt-master/scripts/image_gen.py`](https://github.com/hugohe3/ppt-master/blob/main/skills/ppt-master/scripts/image_gen.py)**: Central dispatcher for AI image backends that implements model override logic based on environment variables.
- **[`skills/ppt-master/references/executor-base.md`](https://github.com/hugohe3/ppt-master/blob/main/skills/ppt-master/references/executor-base.md)**: Defines the Executor's responsibilities including reading [`spec_lock.md`](https://github.com/hugohe3/ppt-master/blob/main/spec_lock.md) and applying layout rhythms.
- **[`skills/ppt-master/references/shared-standards.md`](https://github.com/hugohe3/ppt-master/blob/main/skills/ppt-master/references/shared-standards.md)**: Lists prohibited SVG features that high-quality models must avoid.
- **[`skills/ppt-master/references/image-layout-spec.md`](https://github.com/hugohe3/ppt-master/blob/main/skills/ppt-master/references/image-layout-spec.md)**: Contains exact layout formulas for grid calculations and margin specifications.
- **[`opencode.json`](https://github.com/hugohe3/ppt-master/blob/main/opencode.json)**: Reveals the default agent model (`openrouter/openai/gpt-oss-120b`) used for general tasks, explaining why explicit overrides are necessary for production SVG generation.

## Summary

- **Claude 3.5 Sonnet** generates the most reliable SVG layouts in PPT Master due to superior XML structure handling and specification compliance.
- **GPT-4 Turbo** provides equivalent functionality when Anthropic is unavailable.
- Configuration occurs via `.env` files setting `IMAGE_BACKEND` and model-specific variables.
- Always run [`svg_quality_checker.py`](https://github.com/hugohe3/ppt-master/blob/main/svg_quality_checker.py) to validate that generated SVGs contain no banned features.
- The Executor role relies on [`image_gen.py`](https://github.com/hugohe3/ppt-master/blob/main/image_gen.py) to route requests, while reference documents in `skills/ppt-master/references/` define the strict constraints models must follow.

## Frequently Asked Questions

### Can I use the default GPT-OSS model for SVG generation?

While [`opencode.json`](https://github.com/hugohe3/ppt-master/blob/main/opencode.json) lists `openrouter/openai/gpt-oss-120b` as the default agent model, it is slower and less precise for SVG code generation. This model works for general tasks but frequently produces syntactical errors or violates the banned-feature list in [`shared-standards.md`](https://github.com/hugohe3/ppt-master/blob/main/shared-standards.md), causing failures in the quality checking phase.

### How do I switch from OpenRouter to direct Anthropic API?

The repository architecture routes requests through [`image_gen.py`](https://github.com/hugohe3/ppt-master/blob/main/image_gen.py). To use direct Anthropic API access instead of OpenRouter, modify the `IMAGE_BACKEND` environment variable to `anthropic` and provide your `ANTHROPIC_API_KEY`. The system will bypass OpenRouter and connect directly to Anthropic's endpoints using Claude 3.5 Sonnet.

### Why does SVG layout generation fail with some models?

Generation fails when models cannot maintain the strict XML hierarchy required by PowerPoint or when they include prohibited elements like `<animate>` tags, external CSS, or complex masks. Models with weaker instruction-following capabilities also deviate from the layout specifications in [`image-layout-spec.md`](https://github.com/hugohe3/ppt-master/blob/main/image-layout-spec.md), producing slides with incorrect grid alignments or margin violations that [`svg_quality_checker.py`](https://github.com/hugohe3/ppt-master/blob/main/svg_quality_checker.py) rejects.

### Is GPT-4 Turbo as reliable as Claude 3.5 Sonnet for PPT layouts?

Yes, GPT-4 Turbo matches Claude 3.5 Sonnet in reliability for SVG layout generation. Both models demonstrate strong capabilities in generating valid XML, following complex layout rules, and respecting PPT-compatible constraints. The choice between them typically depends on API availability, pricing preferences, and existing infrastructure rather than quality differences.