Kandinsky ImageSR 2.0 Gets Pruned to 2.7B, Cutting VRAM Use by 44%
A community pruned and distilled version of Kandinsky ImageSR 2.0 cuts transformer memory by 44% while preserving detail at every upscale factor.
Takeaways
- Community release: Kandinsky-ImageSR-2.0-Prune-2.7B, a pruned and distilled one-step diffusion upscaler, MIT licensed.
- Transformer weights drop from 8.01 GB to 4.45 GB (0.56x), and run 32% faster per tile.
- Within 0.3 dB PSNR of the 4.5B original; draws equal or more fine detail at x1, x2, x4.
- Pruned by cutting 8 of 20 attention heads and half the FFN per block across all 50 blocks.
- Healed via distillation on 11,498 tiles in about five hours on a single H200.
- Ships with ComfyUI nodes for PyTorch and Apple MLX, plus a Diffusers code path.
Developer lvladikov pruned Kandinsky Lab’s 4.5B-parameter Kandinsky ImageSR 2.0 to 2.7B parameters, then distilled the smaller model against the original. The pruned 2.7B checkpoint retains the one-step, tiled x1, x2, and x4 upscaling workflow while cutting transformer-weight VRAM by 44% in the published H200 benchmark.
The MIT-licensed release includes a Diffusers integration and separate ComfyUI nodes for PyTorch and Apple MLX. Its custom loaders account for the pruned tensor shapes, which are incompatible with loaders built specifically for the official model.
Fifty blocks, narrower internals
Kandinsky ImageSR 2.0 uses a diffusion transformer to generate each output tile in one pass, avoiding the repeated denoising steps common in diffusion pipelines. The pruned version keeps all 50 transformer blocks but narrows their attention and feed-forward layers.
- Each block retains 12 of its original 20 attention heads.
- Each feed-forward layer retains half of its units.
- Attention and feed-forward weights fall from 3.93B to 2.10B parameters.
- The patch embedding, output layer, timestep tables, and FLUX.1 VAE remain unchanged.
The pruning pass scored each attention head and feed-forward unit by estimating how much its removal would alter predictions on real image tiles. This second-order estimate approximates the effect of a cut without retraining a separate model for every candidate. The process retained the highest-scoring components and refit the weights immediately downstream to absorb some of the removed capacity. In the author’s tests, narrowing every block preserved quality better than removing complete blocks.
Distillation restores texture
Pruning changed both the final predictions and the intermediate representations, so the smaller model was trained as a student of the original. Its loss matched three signals: the teacher’s output, internal block states, and fine-texture statistics within each 64-pixel patch.
The 11,498-tile training set drew from 10,000 FLUX.1 renders and DIV2K’s 800 training photographs. Training covered x2 and x4 upscaling for 2,381 steps with a batch size of 12, taking about five hours on one NVIDIA H200. The local texture term was designed to prevent the softened output that often appears after diffusion models are compressed.
The H200 trade-off
| Metric | Pruned 2.7B | Official 4.5B | Change |
|---|---|---|---|
| Transformer weights in VRAM | 4.45 GB | 8.01 GB | 44% lower |
| Transformer latency, 1024-pixel tile | 0.098 s | 0.144 s | 32% lower |
| 2048 × 2048 to 8192 × 8192, 121 tiles | 28.6 s | 34.1 s | 16% lower |
| Fine-detail ratio, x1 / x2 / x4 | 0.97 / 1.05 / 1.09 | 1.00 baseline | −3% / +5% / +9% |
| PSNR to original, x1 / x2 / x4 | 32.8 / 28.4 / 25.3 dB | 32.8 / 28.5 / 25.6 dB | 0.0 / −0.1 / −0.3 dB |
The transformer itself runs 32% faster per 1024-pixel tile, while the complete 121-tile job improves by 16% because tiling, VAE processing, and other pipeline work remain. Reported PSNR stays within 0.3 dB of the official model across all three scales.
A fine-detail ratio above 1.00 indicates that the pruned model produces more high-frequency texture than the official checkpoint. That metric measures texture volume rather than factual accuracy, so the additional detail can include generated features. The benchmark covers one H200 configuration in bfloat16; total peak memory and throughput can differ across consumer GPUs, Apple Silicon, and CPU execution.
Diffusers and ComfyUI paths
A recent Diffusers build can load the checkpoint through the standard pipeline interface:
from diffusers import DiffusionPipeline
from diffusers.utils import load_image
import torch
pipe = DiffusionPipeline.from_pretrained(
"lvladikov/Kandinsky-ImageSR-2.0-Prune-2.7B",
dtype=torch.bfloat16,
device_map="cuda",
)
image = load_image("input.png")
output = pipe(
image=image,
prompt="x4 · the portrait",
).images[0]
output.save("upscaled.png")
The example requests x4 enlargement in the prompt and adds a short image description. The model supports x1, x2, and x4 modes.
| Runtime | Supported hardware | Purpose |
|---|---|---|
| PyTorch | CUDA, MPS, CPU | General ComfyUI execution |
| Apple MLX | Apple Silicon | Native MLX execution on Macs |
Both node sets include ready-made workflows, an upscale_by control with values of 1, 2, or 4, and a creativity control that selects the diffusion timestep. The pipeline does not sample noise or expose a seed, so identical inputs and settings produce deterministic output.
The pruned checkpoint omits the VAE file and expects the same ae.safetensors used by the official release. It can be downloaded from FLUX.1-schnell; many existing FLUX ComfyUI installations already contain it.
Where the model diverges
- Generated detail will not match the official checkpoint pixel for pixel. Workflows that require exact parity should retain the official model.
- Small, ambiguous features such as freckles in a low-resolution portrait can differ because each model synthesizes them independently.
- A single pass supports up to x4 enlargement. An x8 workflow requires two Upscale nodes configured as x4 followed by x2.
A pruning recipe takes shape
Lvladikov previously applied a related process to SeedVR2-1.4B, reducing ByteDance’s SeedVR2-7B from 36 transformer blocks to six and bringing its transformer weights to 2.69 GB. The two projects share a practical sequence: measure component importance on representative inputs, remove low-impact capacity, refit adjacent weights, and distill against the original with a texture-aware objective.
For batch upscaling and memory-constrained deployments, the immediate benefit is concrete: the Kandinsky variant removes 3.56 GB of transformer weights while preserving the original pipeline and staying close on the reported quality metrics. Developers should still measure total peak VRAM, latency, and output quality on their target hardware and image domain.