Discriminative Score Function: Turning Pretrained Models into Functional Generative Priors
Organizations: Seoul National University
Abstract
Discriminative models are trained with task-specific objectives such as classification, detection, or representation learning, yet their practical utility depends on generalizing beyond the training task to unseen samples from the same domain. This suggests that a discriminative model may retain an implicit trace of the data manifold beyond its task labels. We ask whether this trace can be exposed as a generative signal without task-specific guidance. We introduce the Discriminative Score Function (DSF), which extracts an image-space generative field from the loss-gradient geometry of a pretrained discriminative model. DSF provides a training-free update rule that moves images toward model-consistent visual regions without retraining or task-specific targets. We apply DSF to diverse pretrained discriminative models, including ResNet classifiers, DETR detectors, and DINOv2 ViT encoders. DSF generates unconditional images from noise and supports conditional guidance, editing, inpainting, and explanation through the same field. DSF-generated samples also provide effective zero-shot quantization calibration when real images or labels are unavailable, preserving feature geometry better than data-free calibration baselines. These results show that discriminative training leaves a generative functional signal for synthesis and calibration. Project page: https://junhoo.me/dsf.
Figures & tables
| Downstream usability | Representation geometry | ||||||||||||||
| Calibration | k-NN | Head | fpQ@5 | CLS | Patch | ||||||||||
| 8 | 6 | 4 | 8 | 6 | 4 | 8 | 6 | 4 | 8 | 6 | 4 | 8 | 6 | 4 | |
| Real images † | .659 | .605 | .580 | .269 | .195 | .187 | .882 | .873 | .823 | .939 | .798 | .708 | .968 | .874 | .753 |
| DSF (ours) | .659 | .605 | .589 | .283 | .215 | .202 | .883 | .872 | .825 | .947 | .814 | .710 | .973 | .885 | .760 |
| RegCache | .629 | .564 | .500 | .196 | .148 | .142 | .874 | .859 | .787 | .902 | .744 | .608 | .963 | .849 | .671 |
| Gaussian | .592 | .435 | .077 | .152 | .051 | .003 | .874 | .791 | .058 | .825 | .515 | .102 | .913 | .622 | .153 |
Appendix figures & tables6 assets
Supplementary material from the paper’s appendix.
Appendix
| Asset | Use in this paper | License or terms followed |
|---|---|---|
| ResNet / torchvision [ 19 ] | Public pretrained classifier used as a DSF score model | PyTorch/torchvision code and model access are used under the PyTorch/torchvision BSD-style license terms; ImageNet-trained weights are used only for research evaluation. |
| DINOv2 [ 41 ] | Public pretrained self-supervised ViT used for generation and quantization diagnostics | DINOv2 code and model weights are released under Apache-2.0; pretrained checkpoints are used as fixed evaluation models and are not redistributed. |
| DETR / COCO [ 3 , 35 ] | Public pretrained detector used as a DSF score model | DETR is released under Apache-2.0; COCO data are used or referenced under the official COCO terms and associated image licenses. |
| ImageNet [ 9 ] | Oracle calibration images and downstream evaluation reference | Accessed under ImageNet terms for non-commercial research and educational use; images are not redistributed. |
| CLIP / OpenCLIP [ 6 ] | External guidance model for conditional generation | Public CLIP/OpenCLIP implementations and checkpoints are used under their respective repository/model licenses, including MIT-licensed OpenAI CLIP code, and are not redistributed. |
| SmoothQuant [ 48 ] | Post-training quantization transform used in zero-shot calibration diagnostics | SmoothQuant code is released under the MIT license. |
| Model | Model type | Objective | Representation and score layers |
| Target models | |||
| ResNet | ConvNet classifier | classification | AvgPool/classifier features; conv. and residual-block layers |
| DETR | detection transformer | detection | encoder features; encoder projection layers |
| DINOv2 ViT | ViT encoder | self-supervised learning | final normalized features; late attention and MLP layers |
| External guidance model | |||
| CLIP | vision–language encoder | contrastive image–text learning | visual embedding; visual encoder layers |
| Calibration source | 8-bit scale | 6-bit scale | 4-bit scale |
|---|---|---|---|
| Real images | 2.0 | 0.75 | 0.75 |
| DSF | 2.0 | 0.75 | 1.0 |
| RegCache | 1.5 | 1.0 | 1.25 |
| Gaussian noise | 2.0 | 1.25 | 1.5 |
| MimiQ | 2.0 | 1.25 | 0.75 |
Generative Modeling
Generative modeling learns data distributions to create new samples, from images and text to molecules, simulations, and structured records.
See all 493 papers