Overview
ComfyUI supports various model types for image generation, each serving a specific purpose in the pipeline. The model system handles loading, caching, memory management, and multi-model workflows.Model Types
Diffusion Models
The core model for denoising latents:Auto-detection:
load_checkpoint_guess_config automatically detects the model architecture (SD 1.5, SDXL, SD3, Flux, etc.) from the checkpoint file.VAE (Variational Autoencoder)
Encodes images to latent space and decodes latents back to images:TAESD (Tiny AutoEncoder)
Lightweight VAE alternatives for fast preview:CLIP (Text Encoder)
Encodes text prompts into conditioning:Dual CLIP Models
Some models require two CLIP encoders:SDXL: Requires CLIP-L and CLIP-G
SD3: Supports CLIP-L + CLIP-G or CLIP-L + T5 or CLIP-G + T5
Flux: Requires CLIP-L and T5
SD3: Supports CLIP-L + CLIP-G or CLIP-L + T5 or CLIP-G + T5
Flux: Requires CLIP-L and T5
Model Paths
Fromfolder_paths.py:22-53, ComfyUI organizes models in standard directories:
Supported File Extensions
LoRA Models
Low-Rank Adaptation models modify base models:Model File Discovery
Fromfolder_paths.py:303-343, ComfyUI recursively scans model directories:
Model Caching
ControlNet Models
Guidance models for spatial control:Applying ControlNet
Model Configuration
Model Paths
Configure custom model directories in
extra_model_paths.yaml:Memory Management
Models are automatically loaded/unloaded based on VRAM:
--lowvram: Aggressive offloading--normalvram: Moderate offloading--highvram: Keep models in VRAM
Model Precision
Control memory usage with precision:
fp32: Full precisionfp16: Half precisionfp8_e4m3fn: 8-bit float
Safe Loading
Use
safe_load=True to prevent code execution in pickle filesAdvanced Model Loading
UNET-Only Loading
For separate component loading:Model Validation
Best Practices
Model Organization
Model Organization
- Use subdirectories within model folders
- Name models descriptively
- Keep model versions separate
- Document custom model paths
Performance
Performance
- Use fp16 or fp8 for large models
- Enable LoRA caching for repeated use
- Consider TAESD for preview workflows
- Batch similar operations together
Compatibility
Compatibility
- Check model architecture compatibility
- Match VAE to checkpoint type
- Verify CLIP encoder requirements
- Test LoRA with base model
Security
Security
- Prefer SafeTensors format
- Use safe_load for pickle files
- Verify model sources
- Scan for malicious code
See Also
Nodes
Using models in node workflows
Execution
Model loading during execution
Workflows
Building workflows with models