Skip to content

AutoRound: user-passed quantization_config silently overwrites checkpoint's quant settings #15120

Open

Description

@OnePunchMonk

Describe the bug

DiffusersAutoQuantizer.merge_quantization_configs (in src/diffusers/quantizers/auto.py) is supposed to let users override runtime-only fields like backend on an AutoRoundConfig while keeping the checkpoint's own quantization settings. Instead, it loops over every field in the user-supplied AutoRoundConfig.__dict__ and overrides any field that differs from the checkpoint's value, not just backend.

The documented call is AutoRoundConfig(backend="auto"). That object still carries the dataclass defaults bits=4, group_size=128, sym=True. So loading a checkpoint that was quantized with, say, group_size=32 silently rewrites it to group_size=128 before convert_hf_model reads it — producing a shape mismatch at best, wrong (dequantized-as-the-wrong-grouping) outputs at worst.

Reproduction

from diffusers.quantizers.auto import DiffusersAutoQuantizer
from diffusers.quantizers.quantization_config import AutoRoundConfig

# Simulates the checkpoint's own config.json quantization_config
checkpoint_config = AutoRoundConfig(bits=4, group_size=32, sym=False, backend="torch")

# The documented way to override just the runtime backend
args_config = AutoRoundConfig(backend="auto")

merged = DiffusersAutoQuantizer.merge_quantization_configs(checkpoint_config, args_config)

print(merged.backend)     # "auto" - expected
print(merged.group_size)  # 128  <- should be 32, the checkpoint's own value
print(merged.sym)         # True <- should be False, the checkpoint's own value

System Info

  • diffusers @ main, commit aaf57d0
  • Python 3.12, Linux

Who can help?

@sayakpaul

Activity

  1. changed the title [-]Several correctness bugs in src/diffusers/quantizers/[/-] [+]AutoRound: user-passed quantization_config silently overwrites checkpoint's quant settings[/+] on Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions