Skip to content

[Bug] Image generation: CFG scale setting ignored in UI (always uses 1.0) #2427

Description

@eldesconectado

Title: [BUG] CFG (Guidance) Scale Ignored in Image Generation and Always Uses 1.0 in v1.120

Problem Description

When generating images with KoboldCpp v1.120 (both koboldcpp.exe and koboldcpp-nocuda.exe), the CFG Scale (Guidance) value I enter in the web interface (/sdui) is completely ignored.

Generation always uses CFG Scale: 1.0, regardless of whether I enter 3.0, 6.0, or 9.0. This results in poor image quality, deformities in hands/legs, and, in my specific case, pubic hair, despite using very explicit negative prompts to remove it.

Steps to Reproduce the Error

  1. Load the Flux model (fluxedUpFluxNSFW_71Q8GGUF.gguf) into KoboldCpp v1.120.

  2. Open the image generation web interface (http://localhost:5001/sdui).

  3. Enter a prompt and a negative. Set the Guidance (CFG) to 3.0 (or 9.0) and generate.

  4. When finished, check the image metadata.

  5. Result: The program reports CFG Scale: 1 (or CFG Scale: 1.0) instead of the value I entered.

Expected Behavior

The image metadata should reflect the CFG scale I configured (e.g., CFG Scale: 3.0). Additionally, the image should correctly follow the prompt and negative instructions with that guidance.

Tests performed (excluding common causes)

  • I tested with CFG=3.0 and CFG=9.0 (even higher) and it always reports 1.0.

  • I modified the "VAE Tiling Threshold" to 16 to force tiling, but the CFG failure persists.

  • I tested both the normal .exe (606 MB) and the nocuda (113 MB), and the error occurs in both.

  • I used exactly the same model, same seed, same prompt with sd-cli.exe (the separate stable-diffusion.cpp binary) and the CFG DOES work correctly there, which rules out a problem with the model or parameters. The bug is in KoboldCpp.

Environment

  • Operating System: Windows 10 x64.
    Ryzen 9 5900XT, 32 GB RAN DDR4 -3200 MHz

  • KoboldCpp version: v1.120 (released 3 days ago). I also suspect it occurs in earlier versions, but it's confirmed in the latest one.

  • Executable file: koboldcpp.exe and koboldcpp-nocuda.exe.

  • Model: fluxedUpFluxNSFW_71Q8GGUF.gguf (Flux.1 Dev).

  • Backend: CPU (although it also occurs when selecting others).

Additional context

  • The problem seems to be in how KoboldCpp passes the --cfg-scale parameter to the internal backend (stable-diffusion.cpp). It seems to always send 1.0.

Temporary Solution (for developers)

Review the communication between the web UI (/sdui) and the image generation core, specifically how the command or internal API call is constructed with the --cfg-scale flag.

Thank you for your work!

Activity

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

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions