SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2004.02088 · ICML · 2020

Feature Quantization Improves GAN Training

Yang Zhao, Chunyuan Li, Ping Yu, Jianfeng Gao, Changyou Chen, Generator Discriminator

arXiv · PDF · Open in the Atlas

Code that ran

3 of 4 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 0 honoured the contract we drafted, 0 violated it and 2 have no contract verdict; 1 failure of our instrument; 1 no recorded run), measured 2026-11-21; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2004.02088.json · badge: /api/ran/2004.02088.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
taki0112/UGATIT canonical (classifier label)
classifier basis: census
2 ran · 1 no recorded run
YangNaruto/FQ-GAN canonical (classifier label)
classifier basis: classifier_2025
1 ran · 0 no recorded run
FunctionStatusWhere it lives
Quantize Ran
ran on a synthesized input
YangNaruto/FQ-GAN/FQ-BigGAN/vq_layer.py
pointer only (licence: NONE) · get_code("0be995ce42c516e0")
How it ran

The body of this sample is withheld: GitHub detected no licence in this paper's repository, YangNaruto/FQ-GAN when it was checked. The setup block that called it is withheld with it, because it is written against that body. source_path and origin say where the code lives, to read under the repository's own terms. A run is recorded.

load_test_data Ran
ran on a synthesized input
taki0112/UGATIT/utils.py
code served (permissive licence) · get_code("dcce1222c3697159")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ndarray, ndim 4, dtype family float, shape (1, 256, 256, 3) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import cv2
import numpy as np
import tempfile
import os

# Create a temporary test image
temp_dir = tempfile.mkdtemp()
test_image_path = os.path.join(temp_dir, "test_image.jpg")

# Create a simple RGB test image (256x256x3)
test_img = np.random.randint(0, 256, (256, 256, 3), dtype=np.uint8)
cv2.imwrite(test_image_path, cv2.cvtColor(test_img, cv2.COLOR_RGB2BGR))

ARGS = {
    "image_path": test_image_path,
    "size": 256
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
cv2, numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 4, dtype family float, shape (1, 256, 256, 3) — shape (1, 256, 256, 3) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
save_images Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
taki0112/UGATIT/utils.py
code served (permissive licence) · get_code("dfa35c437d3cf0d5")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned bool, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

# Analyze the function chain: save_images -> imsave -> merge
# - save_images takes: images, size, image_path
# - images goes through inverse_transform (expects numpy array with shape considerations)
# - Then to imsave which calls merge
# - merge expects images.shape = (batch, height, width, 3) for RGB
# - size is a tuple for grid layout (rows, cols)
# - image_path is a string filepath

# Create sample images: batch of 2, height 4, width 3, 3 channels (RGB)
# Values in range [-1, 1] since inverse_transform expects this range
images = np.random.uniform(-1, 1, size=(2, 4, 3, 3)).astype(np.float32)

# Size tuple: (rows, cols) for merging grid - with 2 images, use (1, 2)
size = (1, 2)

# Image path - just a string (won't actually write due to sandbox constraints)
image_path = "/tmp/test_image.jpg"

ARGS = {
    "images": images,
    "size": size,
    "image_path": image_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
cv2, numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bool, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
augmentation Not yet run
unverified (harvested, no recorded run)
taki0112/UGATIT/utils.py
code served (permissive licence) · get_code("76abd03df3e34279")
How it ran

no invocation recorded.

Also present in other papers' code

Of 4 samples lifted from this paper's linked repositories, 4 carry a function identity and 0 do not. Of the 4 distinct functions with an identity, 3 are also present in other papers whose code we hold (3 with at least one paper dated earlier, 0 the same month, 1 later) and 1 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
save_images 7 other papers
5 dated earlier, 2 later
1703.03208 (2017-03)
Compressed Sensing using Generative Models
1802.08406 (2018-02)
Solving Linear Inverse Problems Using GAN Priors: An Algorithm with Provable Guarantees
1811.03205 (2018-11)
Robustness of Conditional GANs to Noisy Labels
and 4 more not named here
augmentation 2 other papers
2 dated earlier
1703.00848 (2017-03)
Unsupervised Image-to-Image Translation Networks
1907.10830 (2019-07)
U-GAT-IT: Unsupervised Generative Attentional Networks with Adaptive Layer-Instance Normalization for Image-to-Image Translation
load_test_data 1 other paper
1 dated earlier
1907.10830 (2019-07)
U-GAT-IT: Unsupervised Generative Attentional Networks with Adaptive Layer-Instance Normalization for Image-to-Image Translation

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-21.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

The instability in GAN training has been a longstanding problem despite remarkable research efforts. We identify that instability issues stem from difficulties of performing feature matching with mini-batch statistics, due to a fragile balance between the fixed target distribution and the progressively generated distribution. In this work, we propose Feature Quantization (FQ) for the discriminator, to embed both true and fake data samples into a shared discrete space. The quantized values of FQ are constructed as an evolving dictionary, which is consistent with feature statistics of the recent distribution history. Hence, FQ implicitly enables robust feature matching in a compact space. Our method can be easily plugged into existing GAN models, with little computational overhead in training. Extensive experimental results show that the proposed FQ-GAN can improve the FID scores of baseline methods by a large margin on a variety of tasks, including three representative GAN models on 9 benchmarks, achieving new state-of-the-art performance.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2004.02088")
get_code_for_paper("2004.02088")
have("2004.02088")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2004.02088.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2004.02088.svg)](https://syntology.ai/paper/2004.02088)

Connect an agent — have() is free.