ComfyUI > Nodes > ComfyUI-NAG

ComfyUI Extension: ComfyUI-NAG

Repo Name

ComfyUI-NAG

Author
ChenDarYen (Account age: 2440 days)
Nodes
View all nodes(5)
Latest Updated
2025-11-03
Github Stars
0.3K

How to Install ComfyUI-NAG

Install this extension via the ComfyUI Manager by searching for ComfyUI-NAG
  • 1. Click the Manager button in the main menu
  • 2. Select Custom Nodes Manager button
  • 3. Enter ComfyUI-NAG in the search bar
After installation, click the Restart button to restart ComfyUI. Then, manually refresh your browser to clear the cache and access the updated list of nodes.

Visit ComfyUI Online for ready-to-use ComfyUI environment

  • Free trial available
  • 16GB VRAM to 80GB VRAM GPU machines
  • 400+ preloaded models/nodes
  • Freedom to upload custom models/nodes
  • 200+ ready-to-run workflows
  • 100% private workspace with up to 200GB storage
  • Dedicated Support

Run ComfyUI Online

ComfyUI-NAG Description

ComfyUI-NAG integrates NAG into ComfyUI, enhancing its functionality by implementing NAG's features. This extension streamlines processes within ComfyUI, offering improved performance and capabilities.

ComfyUI-NAG Introduction

ComfyUI-NAG is an extension designed to enhance the capabilities of diffusion models by implementing Normalized Attention Guidance (NAG). This extension is particularly useful for AI artists who want to improve the quality and control of their generated images or videos. NAG addresses the limitations of traditional Classifier-Free Guidance (CFG) by restoring effective negative prompting, especially in few-step diffusion models. This means you can suppress unwanted visual, semantic, and stylistic attributes, such as "glasses" or "blurry," to achieve more precise and creative outputs. By integrating with ComfyUI, a powerful and modular visual AI engine, ComfyUI-NAG offers a user-friendly interface for artists to experiment with and refine their AI-generated content.

How ComfyUI-NAG Works

At its core, ComfyUI-NAG operates by manipulating the attention mechanisms within diffusion models. Traditional CFG methods often struggle with few-step models because they assume a consistent structure between positive and negative outputs, which can lead to artifacts. NAG, on the other hand, works in the attention space by extrapolating positive and negative features, normalizing them, and blending them to maintain stability and control. This process allows for more effective negative guidance, enabling you to suppress specific attributes in your outputs without introducing unwanted artifacts. Think of it as fine-tuning the focus of your AI model to avoid certain elements while enhancing others, much like adjusting the contrast and brightness in a photo to highlight specific details.

ComfyUI-NAG Features

ComfyUI-NAG comes with several features that enhance your creative process:

  • KSamplerWithNAG: A replacement for the standard KSampler, offering improved negative guidance.
  • SamplerCustomWithNAG: Customizable sampling with NAG for tailored outputs.
  • NAGGuider: Provides basic guidance with NAG, allowing for more controlled outputs.
  • NAGCFGGuider: Combines CFG with NAG for enhanced control over the diffusion process. These features can be customized using parameters like nag_scale, nag_tau, nag_alpha, and nag_sigma_end, which control the strength and duration of the negative guidance. For example, increasing nag_scale will result in stronger suppression of unwanted attributes, while adjusting nag_tau and nag_alpha can help balance the original and extrapolated attention features.

ComfyUI-NAG Models

ComfyUI-NAG supports a variety of models, each suited for different tasks:

  • Flux and Flux Kontext: Ideal for image editing and transformation tasks.
  • Wan and Wan2.1: Suitable for video generation, offering compatibility with GGUF.
  • SD3.5 and SDXL: Designed for high-quality image generation with stable diffusion.
  • Hunyuan Video: Supports video generation with advanced features. Each model can be used to achieve different artistic effects, from creating realistic images to generating stylized videos. By selecting the appropriate model, you can tailor your workflow to match your creative vision.

What's New with ComfyUI-NAG

Recent updates to ComfyUI-NAG have introduced several new features and improvements:

  • New Nodes: Added KSamplerWithNAG (Advanced), SamplerCustomWithNAG, and NAGGuider for more flexible workflows.
  • HiDream Support: Expanded compatibility with the HiDream model for enhanced creativity.
  • Performance Enhancements: Support for TeaCache and WaveSpeed to accelerate NAG sampling, and compile model support for faster processing.
  • Bug Fixes: Resolved issues affecting guidance quality in models like Flux and Chroma. These updates ensure that ComfyUI-NAG remains a cutting-edge tool for AI artists, providing improved performance and new creative possibilities.

Troubleshooting ComfyUI-NAG

If you encounter issues while using ComfyUI-NAG, here are some common solutions:

  • Artifacts in Output: Adjust nag_tau and nag_alpha to find a balance that minimizes artifacts while maintaining effective guidance.
  • Slow Performance: Ensure that your model nodes are updated and consider using compile model nodes like TorchCompileModel for faster sampling.
  • Unexpected Results: Double-check your parameter settings, especially nag_scale, to ensure they align with your desired output. For more detailed troubleshooting, refer to the example workflows provided in the ./workflows directory, which can guide you through setting up and optimizing your projects.

Learn More about ComfyUI-NAG

To further explore the capabilities of ComfyUI-NAG, consider the following resources:

  • ComfyUI Documentation: A comprehensive guide to using ComfyUI and its extensions.
  • NAG Project Page: Detailed information about the NAG methodology and its applications.
  • Community Forums: Join discussions with other AI artists and developers to share tips and get support. These resources provide valuable insights and support to help you make the most of ComfyUI-NAG in your creative projects.

ComfyUI-NAG Related Nodes

RunComfy
Copyright 2025 RunComfy. All Rights Reserved.

RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Models, enabling artists to harness the latest AI tools to create incredible art.