> ## Documentation Index
> Fetch the complete documentation index at: https://docs.comfy.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Mage-Flow: ComfyUI Workflow Example

> Mage-Flow is Microsoft's compact 4B model for text-to-image generation and instruction-based image editing in ComfyUI, with native resolutions up to 2K.

**Mage-Flow** is a compact 4B-scale generative stack from Microsoft Research for efficient text-to-image generation and instruction-based image editing. The stack is built from two co-designed components: [Mage-VAE](https://huggingface.co/microsoft/Mage-VAE), a lightweight high-fidelity latent tokenizer, and a Native-Resolution Multimodal Diffusion Transformer (NR-MMDiT) trained with rectified flow matching. Together with native-resolution packing, this shared stack powers two model instantiations: Mage-Flow for text-to-image generation and Mage-Flow-Edit for instruction-based image editing. Each ships in Base, RL-aligned, and 4-step Turbo variants.

Mage-Flow supports native resolutions from 512 to 2048 pixels per side at any aspect ratio, including extreme dimensions like 4:1.

**License**: [MIT](https://github.com/microsoft/Mage/blob/main/LICENSE)

**Related Links**:

* [Hugging Face: microsoft/Mage-Flow](https://huggingface.co/microsoft/Mage-Flow)
* [Hugging Face: Comfy-Org/Mage-Flow (ComfyUI models)](https://huggingface.co/Comfy-Org/Mage-Flow)
* [Official GitHub repository](https://github.com/microsoft/Mage)
* [Technical report (arXiv)](https://arxiv.org/abs/2607.19064)

## Mage-Flow text-to-image workflow

<img src="https://raw.githubusercontent.com/Comfy-Org/workflow_templates/main/output/Mage_flow.png" alt="Mage-Flow text-to-image workflow output" />

<CardGroup cols={2}>
  <Card title="Run on Comfy Cloud" icon="cloud" href="https://cloud.comfy.org/?template=image_mage_flow_t2i_int8&utm_source=docs&utm_medium=referral&utm_campaign=mage-flow">
    Open in Comfy Cloud
  </Card>

  <Card title="Download Workflow" icon="download" href="https://github.com/Comfy-Org/workflow_templates/blob/main/templates/image_mage_flow_t2i_int8.json">
    Download JSON or search "Mage-Flow" in Template Library
  </Card>
</CardGroup>

<Tip>
  <Tabs>
    <Tab title="Local users">
      Make sure your ComfyUI is updated.

      * [Download ComfyUI](https://www.comfy.org/download)
      * [Update Guide](/installation/update_comfyui)

      Workflows in this guide can be found in the [Workflow Templates](/interface/features/template).
      If you can't find them in the template, your ComfyUI may be outdated.

      If nodes are missing when loading a workflow, possible reasons:

      1. You are not using the latest ComfyUI version (Nightly version)
      2. Some nodes failed to import at startup
    </Tab>

    <Tab title="Cloud users">
      * [Cloud](https://cloud.comfy.org) will update after ComfyUI stable release.

      So, if you find any core node missing in this document, it might be because the new core nodes have not yet been released in the latest stable version. Please wait for the next stable release.
    </Tab>
  </Tabs>
</Tip>

The workflow is organized into a few parts:

1. **Text to Image (Mage-Flow) subgraph**: the core generation pipeline, containing model loading, prompt handling, native-resolution latent generation, sampling, and VAE decode
2. **SaveImageAdvanced**: saves the generated image

<Card title="Learn about Subgraph" icon="book-open" href="/interface/features/subgraph">
  This workflow uses Subgraph nodes for modular processing. Check out the Subgraph documentation to learn how to customize and extend the workflow.
</Card>

### Single-click generation

At its simplest, just enter a text prompt in the subgraph, set your desired resolution, and click **Queue Prompt**. The defaults produce a high-quality image with minimal configuration.

### Using the workflow

1. **Enter a prompt** — type a text description in the subgraph's prompt input
2. **Set resolution** — adjust width and height for your desired output size. Mage-Flow supports native resolutions from 512 to 2048 pixels per side.
3. **Adjust settings** — configure the seed and negative prompt as needed
4. **Click Queue** — press `Ctrl+Enter` to generate

## Mage-Flow Turbo text-to-image workflow

<img src="https://raw.githubusercontent.com/Comfy-Org/workflow_templates/main/output/Mage_flow_turbo.png" alt="Mage-Flow Turbo text-to-image workflow output" />

<CardGroup cols={2}>
  <Card title="Run on Comfy Cloud" icon="cloud" href="https://cloud.comfy.org/?template=image_mage_flow_turbo_t2i_int8&utm_source=docs&utm_medium=referral&utm_campaign=mage-flow">
    Open in Comfy Cloud
  </Card>

  <Card title="Download Workflow" icon="download" href="https://github.com/Comfy-Org/workflow_templates/blob/main/templates/image_mage_flow_turbo_t2i_int8.json">
    Download JSON or search "Mage-Flow Turbo" in Template Library
  </Card>
</CardGroup>

The Turbo variant uses a distilled 4-step checkpoint for faster generation while maintaining high quality. The workflow structure and controls are identical to the base text-to-image workflow, but uses the Turbo diffusion model for lower-latency inference.

## Mage-Flow-Edit image edit workflow

<img src="https://raw.githubusercontent.com/Comfy-Org/workflow_templates/main/output/Mage_flow_edit.png" alt="Mage-Flow-Edit image edit workflow output" />

<CardGroup cols={2}>
  <Card title="Run on Comfy Cloud" icon="cloud" href="https://cloud.comfy.org/?template=image_mage_flow_edit_int8&utm_source=docs&utm_medium=referral&utm_campaign=mage-flow">
    Open in Comfy Cloud
  </Card>

  <Card title="Download Workflow" icon="download" href="https://github.com/Comfy-Org/workflow_templates/blob/main/templates/image_mage_flow_edit_int8.json">
    Download JSON or search "Mage-Flow-Edit" in Template Library
  </Card>

  <Card title="Download Sample Image" icon="image" href="https://raw.githubusercontent.com/Comfy-Org/workflow_templates/main/input/calm_amid_ruin.png">
    Get the example input image for this workflow
  </Card>
</CardGroup>

The image edit workflow uses Mage-Flow-Edit, an instruction-based model that edits images using natural language descriptions. Upload one or more reference images and describe the desired edit.

The workflow is organized into a few parts:

1. **LoadImage**: upload your reference images (up to 3)
2. **Image Edit (Mage-Flow-Edit) subgraph**: the core editing pipeline containing model loading, reference image conditioning, prompt handling, and sampling
3. **ImageCompare**: a side-by-side comparison of the original and edited image
4. **SaveImage**: saves the edited output

### Using image edit

1. **Upload reference images** — use the **LoadImage** node to load the image you want to edit (up to 3 images)
2. **Enter your edit instruction** — type a text description of the edit you want to apply (e.g., "replace the background with a beach scene" or "turn this into a watercolor painting")
3. **Adjust settings** — configure resolution, seed, and other parameters
4. **Click Queue** — press `Ctrl+Enter` to generate

## Mage-Flow-Edit Turbo image edit workflow

<img src="https://raw.githubusercontent.com/Comfy-Org/workflow_templates/main/output/Mage_flow_edit_turbo.png" alt="Mage-Flow-Edit Turbo image edit workflow output" />

<CardGroup cols={2}>
  <Card title="Run on Comfy Cloud" icon="cloud" href="https://cloud.comfy.org/?template=image_mage_flow_edit_turbo_int8&utm_source=docs&utm_medium=referral&utm_campaign=mage-flow">
    Open in Comfy Cloud
  </Card>

  <Card title="Download Workflow" icon="download" href="https://github.com/Comfy-Org/workflow_templates/blob/main/templates/image_mage_flow_edit_turbo_int8.json">
    Download JSON or search "Mage-Flow-Edit Turbo" in Template Library
  </Card>

  <Card title="Download Sample Image" icon="image" href="https://raw.githubusercontent.com/Comfy-Org/workflow_templates/main/input/hot_air_balloons_rising.png">
    Get the example input image for this workflow
  </Card>
</CardGroup>

The Turbo variant of the edit workflow uses a distilled 4-step checkpoint for faster editing. The structure and controls match the base edit workflow but with reduced sampling steps.

### Model downloads

For local use, download the ComfyUI-optimized model files from [Comfy-Org/Mage-Flow](https://huggingface.co/Comfy-Org/Mage-Flow).

<CardGroup cols={3}>
  <Card title="Text Encoder" icon="download" href="https://huggingface.co/Comfy-Org/Mage-Flow/resolve/main/text_encoders/qwen3vl_4b_bf16.safetensors">
    qwen3vl\_4b\_bf16.safetensors: Qwen3VL-4B text encoder
  </Card>

  <Card title="VAE" icon="download" href="https://huggingface.co/Comfy-Org/Mage-Flow/resolve/main/vae/mage_flow_vae_bf16.safetensors">
    mage\_flow\_vae\_bf16.safetensors
  </Card>

  <Card title="Diffusion Model (Base Int8)" icon="download" href="https://huggingface.co/Comfy-Org/Mage-Flow/resolve/main/diffusion_models/mage_flow_int8_convrot.safetensors">
    mage\_flow\_int8\_convrot.safetensors: Base model used in the T2I workflow
  </Card>

  <Card title="Diffusion Model (Turbo Int8)" icon="download" href="https://huggingface.co/Comfy-Org/Mage-Flow/resolve/main/diffusion_models/mage_flow_turbo_int8_convrot.safetensors">
    mage\_flow\_turbo\_int8\_convrot.safetensors: Turbo model used in the Turbo T2I workflow
  </Card>

  <Card title="Diffusion Model (Edit Int8)" icon="download" href="https://huggingface.co/Comfy-Org/Mage-Flow/resolve/main/diffusion_models/mage_flow_edit_int8_convrot.safetensors">
    mage\_flow\_edit\_int8\_convrot.safetensors: Edit model used in the Edit workflow
  </Card>

  <Card title="Diffusion Model (Edit Turbo Int8)" icon="download" href="https://huggingface.co/Comfy-Org/Mage-Flow/resolve/main/diffusion_models/mage_flow_edit_turbo_int8_convrot.safetensors">
    mage\_flow\_edit\_turbo\_int8\_convrot.safetensors: Edit Turbo model used in the Edit Turbo workflow
  </Card>
</CardGroup>

Other model variants (BF16, FP8) are also available for users with different hardware configurations.

Place the files in the following directories:

```
📂 ComfyUI/
├── 📂 models/
│   ├── 📂 diffusion_models/
│   │   ├── mage_flow_int8_convrot.safetensors
│   │   ├── mage_flow_turbo_int8_convrot.safetensors
│   │   ├── mage_flow_edit_int8_convrot.safetensors
│   │   └── mage_flow_edit_turbo_int8_convrot.safetensors
│   ├── 📂 text_encoders/
│   │   └── qwen3vl_4b_bf16.safetensors
│   └── 📂 vae/
│       └── mage_flow_vae_bf16.safetensors
```
