Back to Blog
AI Trend DigestEN

Kandinsky ImageSR 2.0: A Diffusion-Based Approach to Image Upscaling and Restoration

5 min read

Abstract illustration for: Kandinsky ImageSR 2.0: A Diffusion-Based Approach to Image Upscaling and Restoration

Image upscaling has long been a practical problem in production systems. Whether recovering detail from compressed photos, preparing assets for higher-resolution displays, or restoring older media, the quality of the upscaling method directly affects the output. Kandinsky ImageSR 2.0 addresses this by packaging a BF16 transformer-based diffusion model into a straightforward pipeline for both enhancement and upscaling tasks.

The model is released under the MIT License and integrates with the Hugging Face Diffusers library, making it accessible to developers building image processing features. It supports three operational modes: native-resolution enhancement (×1), 2× upscaling, and 4× upscaling, with a configurable creativity parameter that lets users tune the balance between fidelity and detail generation.

Why it matters

Image quality matters in real applications. A photo that looks acceptable on a phone may reveal artifacts or loss of detail when displayed on a larger screen or printed. Similarly, archived or compressed images often benefit from enhancement before being used in modern contexts.

Traditional upscaling methods—bicubic interpolation, basic neural networks—either preserve existing pixels without adding detail or introduce artifacts. Diffusion-based approaches work differently: they iteratively refine an image by learning to reverse a noise-addition process, which can recover or generate plausible detail consistent with the input.

For developers, having a pre-trained, production-ready model eliminates the need to train or fine-tune from scratch. The model's MIT License and integration with Diffusers means it can be embedded into applications without licensing friction. The availability of a ComfyUI node also lowers the barrier for non-Python workflows and visual node-based composition.

How it works

Architecture and design

Kandinsky ImageSR 2.0 uses a transformer-based diffusion model. The core component is a BF16 (bfloat16 precision) transformer that operates on visual features. The model includes precomputed zero-text conditioning—meaning it doesn't require text prompts—and visual modulation baked into the architecture for 26 timesteps of the diffusion process.

The transformer weights total 7.39 GiB on disk. The bundled VAE (variational autoencoder) decoder comes from the Apache-2.0-licensed FLUX.1-schnell release and handles the final conversion from latent space back to pixel space.

Processing pipeline

The pipeline accepts an input image and a target upscale factor. The image is first encoded into latent space using the VAE encoder. Noise is then added according to the selected creativity level and scale. The transformer then iteratively denoises the latents over 26 timesteps, using visual modulation to guide the process. Finally, the VAE decoder converts the refined latents back to pixel space.

Creativity and scale parameters

The creativity parameter ranges from 0 to 8 and controls how much the model is allowed to hallucinate or refine detail. The default is 4. Different scales have different recommended ranges:

  • ×1 (native-resolution enhancement): default t = 0.05, range 0.005–0.118
  • ×2 upscaling: default t = 0.15, range 0.07–0.30
  • ×4 upscaling: default t = 0.244, range 0.17–0.38

Lower creativity values preserve the input more closely; higher values introduce more generative refinement.

Performance characteristics

On an H100 80 GB GPU with a 1024 × 1024 input image and 25% tile overlap, median inference times (from three warmed runs) are:

ScaleEager ModeCompiled Mode
×10.327 s0.172 s
×22.86 s1.46 s
×47.96 s4.04 s

Compiled mode uses compiled DiT (Diffusion Transformer) blocks, a compiled VAE decoder, and FlashAttention-3. Peak VRAM for a compiled ×4 run was 9.35 GiB. For larger images (2048 × 2048 to 8192 × 8192), a single H100 took 19.56 seconds; two H100s reduced this to 11.88 seconds.

How to try it

Python installation and usage

Install PyTorch for your CUDA version first, then install the ImageSR runtime:

pip install "kandinsky-image-sr @ https://huggingface.co/kandinskylab/Kandinsky-ImageSR-2.0-GGUF/resolve/main/python/kandinsky_image_sr-1.1.1-py3-none-any.whl"

Basic usage:

import torch
from kandinsky_image_sr import KandinskyImageSRPipeline

pipe = KandinskyImageSRPipeline.from_pretrained(
    "kandinskylab/Kandinsky-ImageSR-2.0",
    dtype=torch.bfloat16,
).to("cuda")
image = pipe("input.png", upscale_factor=1, creativity=4).images[0]
image.save("output.png")

The upscale_factor parameter accepts 1, 2, or 4. Adjust creativity between 0 and 8 to control the trade-off between fidelity and detail generation.

ComfyUI integration

A ComfyUI node is available. Install it via ComfyUI Manager by searching for "Kandinsky ImageSR 2.0" or by running:

comfy node registry-install kandinsky-imagesr

After restarting ComfyUI, an example workflow is available in the ComfyUI setup guide.

Web demo

A live demo is available at huggingface.co/spaces/kandinskylab/Kandinsky-ImageSR-2.0-Demo for testing without local setup.

Quantized variant

A GGUF Q8_0 quantized version is available for reduced memory footprint; see the GGUF model card for details.

Who it's for (and limits)

Kandinsky ImageSR 2.0 is most useful for:

  • Backend developers integrating image enhancement into web or mobile applications
  • Content creators processing batches of images for archival or publication
  • Researchers exploring diffusion-based upscaling approaches
  • ComfyUI users building visual workflows that include upscaling steps

Practical considerations:

  • The model requires a CUDA-capable GPU for reasonable inference speed. CPU inference is not discussed in the material.
  • Inference time scales with image size and upscale factor. For production use, tiling (as shown in the H100 benchmarks) may be necessary for very large images.
  • The creativity parameter is a tuning knob; optimal values depend on the input image and desired output. The defaults (4 for all scales) are a reasonable starting point.
  • The model uses BF16 precision, which requires compatible hardware; check the README for details on precision options.

The day's GitHub and Hugging Face picks side by side.

ProjectSource★Language / Type
elementalsouls/Claude-BugHunterGitHub29,613Python
HKUDS/CLI-AnythingGitHub68,608Python
jingyaogong/minimindGitHub73,495Python
openvinotoolkit/openvinoGitHub13,247C++
cathrynlavery/diagram-designGitHub75,968HTML
thinkingmachines/Inkling-2-MiniHugging Face6,857image-text-to-text
prism-ml/Ternary-Bonsai-2.5-27B-GGUFHugging Face940text-generation
unsloth/Inkling-2-Mini-GGUFHugging Face1,780image-text-to-text
SulphurAI/Sulphur-3Hugging Face1,544—
kandinskylab/Kandinsky-ImageSR-2.0Hugging Face464image-to-image