Scale-Aware Prompt Decoder
- Scale-Aware Prompt Decoder is a lightweight, inference-time module that adaptively selects optimal classifier-free guidance scales for each prompt.
- It leverages a data-driven synthetic oracle and a compact multi-layer perceptron to model prompt-semantics and guide quality predictions without retraining the backbone.
- Empirical validation on image and audio tasks shows enhanced generative fidelity, improved alignment, and superior perceptual quality compared to fixed guidance scales.
A Scale-Aware Prompt Decoder is a lightweight, inference-time module that predicts and selects the optimal classifier-free guidance scale (CFG scale) for each input prompt in text-to-image or text-to-audio diffusion models. Traditional CFG uses a fixed guidance scale, which has limited ability to generalize across prompts of varying semantic complexity. A scale-aware approach adaptively chooses the guidance strength per prompt, enhancing generative fidelity, prompt alignment, and perceptual quality without additional backbone retraining. The methodology is underpinned by modeling the dependence of multi-metric generation quality on both prompt semantics and the guidance scale, realized through a fully data-driven synthetic oracle and a trained multi-layer perceptron predictor (Zhang et al., 25 Sep 2025).
1. Construction of the Synthetic Oracle Dataset
To capture the relationship between prompt, guidance scale, and generation quality, a synthetic dataset is constructed as follows:
- Prompt Pool: For image tasks, approximately 8,000 prompts are randomly sampled from MSCOCO 2014 captions. For audio tasks, about 6,000 from AudioCaps.
- Guidance Scales (): A discrete set of candidate scales (e.g., $1.0$ to $10.0$ in $0.5$ steps, with ).
- Sample Generation: For each prompt and each scale , a pretrained diffusion model (SDXL for images or AudioLDM2 for audio) is run times (e.g., ) under CFG with guidance weight , generating outputs .
- Quality Metric Evaluation:
- Images: Metrics include KID, CLIP, ImageReward, Precision, Recall.
- Audio: Metrics include AudioBox-Aesthetics, and optionally FAD and CLAP score.
- Oracle Aggregation: For each metric ,
with the oracle quality vector for prompt/scale pair.
This dataset forms the empirical basis for supervised training of the predictor.
2. Architecture of the Lightweight Predictor
The scale-aware decoder is a compact, feed-forward multi-layer perceptron with the following components:
- Inputs:
- Semantic embedding : Extracted from a frozen vision-language encoder (CLIP for images, ; CLAP for audio, ).
- Complexity features : Metrics such as prompt length, token entropy, perplexity, modifier diversity, punctuation count; projected via , with .
- Scale (normalized to ).
- Concatenated vector: .
- Network:
- 2–3 fully connected layers (hidden sizes ), ReLU activations, optional dropout ().
- Output layer returns estimated metric values.
- Output:
- , per-metric.
The total parameter count is –4 million, reflecting a lightweight profile suitable for inference.
3. Mathematical Formulation and Guidance Scale Selection
Key formulations underlying the scale selection process:
- Classifier-Free Guidance: For conditional noise estimators and unconditional ,
and the distribution is reweighted: .
- Multi-Metric Quality Curves:
The predictor estimates .
- Utility Function and Scale Optimization: Nonnegative metric weights and quadratic regularization centered at anchor (default scale) are used:
4. Training Procedure
- Dataset: All pairs from the synthetic oracle are used.
- Inputs: ; Targets: (multi-metric oracle).
- Loss Function:
with .
- Optimization: Adam, learning rate , batch size $64$, $20$ epochs, early stopping on validation set.
- Regularization: Optional label-smoothing or target noise.
This regime ensures the predictor generalizes multi-metric quality as a function of prompt and scale.
5. Inference Workflow
The deployment process is as follows:
- Feature Extraction: For incoming prompt , extract and , compute .
- Metric Prediction: For each guidance scale , concatenate , compute .
- Utility Maximization: Compute , select .
- Sample Generation: Run the diffusion model under CFG with to generate the final sample.
This workflow eliminates the need for run-time grid-search, selecting the optimal scale per-prompt.
6. Empirical Validation and Performance
Experiments on MSCOCO 2014 (images, SDXL backbone; 3,000 validation captions) and AudioCaps (audio, AudioLDM2 backbone; 1,000 validation captions) demonstrate quantifiable improvements:
Image Generation (Table 1)
| Method | FID↓ | CLIP↑ |
|---|---|---|
| No guidance () | 62.44 | 0.27 |
| Vanilla CFG (default ) | 31.04 | 0.31 |
| Prompt-aware () | 30.74 | 0.33 |
Audio Generation (Table 2)
| Method | CE↑ | CU↑ | PC↑ | PQ↑ |
|---|---|---|---|---|
| No guidance () | 3.62 | 5.18 | 3.13 | 5.76 |
| Vanilla CFG (default ) | 3.66 | 5.25 | 3.04 | 5.79 |
| Prompt-aware () | 3.68 | 5.22 | 3.16 | 5.81 |
- Ablation: Using all four training metrics (KID, CLIP, ImageReward, Precision) outperforms KID+CLIP or vanilla CFG, with FID 30.74 versus 31.81 (KID+CLIP only) and 31.04 (CFG default).
- Perceptual Preference: Human raters prefer prompt-aware outputs over vanilla CFG in approximately 60% of comparisons.
7. Trade-offs and Parameter Tuning
- Scale Dynamics: Increasing guidance scale generally increases semantic alignment (CLIP, Audio-CLAP) but can reduce diversity (Recall) and, past a mid-range , lead to fidelity loss via over-sharpening.
- Quadratic Penalty: The regularizer discourages extreme scale choices when predicted utility gains are marginal.
- Utility Weights:
- Increase for alignment-sensitive tasks.
- For highly detailed prompts, use lower and higher to mitigate over-guidance.
- Dev-set sweeps allow empirical setting of and to match task priorities.
These mechanisms enable controlled trade-off navigation across fidelity, alignment, and diversity in prompt-conditional generation.
By directly modeling prompt-scale dependencies with a learned Quality Curve Predictor and utility-based scale selection, the Scale-Aware Prompt Decoder provides a practical, computationally efficient enhancement over fixed CFG weighting, delivering improved generation metrics and perceptual outcomes across diverse prompts (Zhang et al., 25 Sep 2025).