Lecture 19 · Unsupervised Distribution Alignment

Deep Unsupervised Learning · Lecture 19。个人学习讲义与配套实验,按主题整理并持续修订。

课程源码 ZIP ↓

个人整理的学习笔记,非官方讲义;课程来源与整理说明见课程介绍。配套示例未逐一运行验证。

本篇目录

Maps to: UC Berkeley CS294-158 Deep Unsupervised Learning (Spring 2024), Lecture 10 · Thu 3/21/2024 · Semi-Supervised Learning and Unsupervised Distribution Alignment (106 slides), second part (slides 74–106): the alignment problem (samples of p(a)p(a) and p(b)p(b), never a pair), applications (low-resource translation, style transfer, data augmentation), marginal matching and its ambiguity, cycle consistency (dual learning, back-translation), CycleGAN with images ↔ segmentations and its failure cases, stochastic mappings and Augmented CycleGAN, CycleGAN “cheating”, sub-component alignment in language (word2vec, alignment by a rotation, unsupervised machine translation), and the Language Quantized AutoEncoder. The first part (semi-supervised learning) is Lecture 18. Basis: The slides draw 1-D sketches of marginal matching and its ambiguity by hand and show published CycleGAN results. These notes count the ambiguity exactly (how many maps preserve the marginals of ShapeWorld’s caption language), train 1-D CycleGANs and classify the maps they find, translate between two ShapeWorld domains whose images are parsed exactly — so a translation is right or wrong, not “looks right” — catch CycleGAN hiding information in pixel values, and align the words of two caption “languages” without a dictionary, with the exact ceiling that symmetries of the language impose. Code: code/lecture19/ (4 scripts + alignment.py; numpy, scipy, PyTorch (CPU); 6 small CycleGANs, cached (~20 minutes each on one core); each script runs in seconds to 3 minutes once its models exist) Reading time: 2.5 hours including running the code


0. How to read this lecture

0.1 Learning goals

After this lecture you should be able to:

  1. State the unsupervised alignment problem and explain why marginal matching alone is under-determined, exactly: which maps preserve a distribution.
  2. Explain what cycle consistency adds (bijectivity) and what it does not (which bijection), and why CycleGAN works in practice anyway (inductive biases of the architecture).
  3. Explain why a deterministic cycle between domains with different amounts of information forces the model to hide information (“steganography”), and why adding noise to the generator does not make it stochastic.
  4. Explain how sub-components with their own statistics (words) make alignment possible where whole objects (sentences) are hopeless; align two word-vector spaces with a rotation (Procrustes), with and without a seed dictionary.
  5. Say which parts of a language can never be aligned without supervision — those related by a symmetry of the distribution — and compute the resulting ceiling.

0.2 Prerequisites and scope

AssumedIntroduced here
Lectures 9–10 (GANs, least-squares GANs)marginal matching, cycle consistency, CycleGAN, Augmented CycleGAN
Lecture 15 (word vectors: PPMI + SVD, word2vec)word-vector alignment (Procrustes, unsupervised initialization), unsupervised MT
Lecture 18 (semi-supervised learning: another way to use unlabeled data)LQAE (described)

0.3 Map

§1  the problem: samples of p(a) and p(b), no pairs
§2  marginal matching and its ambiguity                       ← code 01
§3  cycle consistency                                         ← code 01, Part 2
§4  CycleGAN: what each ingredient contributes                ← code 02
§5  when the domains carry different information: cheating, stochastic maps   ← code 03
§6  sub-components: aligning words without a dictionary       ← code 04
§7  unsupervised machine translation; the Language Quantized AutoEncoder
§8 summary   §9 pitfalls   §10 exercises   §11 further reading   §12 next lecture

0.4 Notation

Domains AA and BB with distributions p(a)p(a), p(b)p(b); a (deterministic) translator GAB:A→BG_{AB}: A \to B and GBA:B→AG_{BA}: B \to A, or stochastic q(b∣a)q(b \mid a); the pushforward G#pG_\# p (the distribution of G(a)G(a) for a∼pa \sim p); W1\mathrm{W}_1 the Wasserstein-1 distance.


1. The problem

We have samples of p(a)p(a) and samples of p(b)p(b), but never a pair (a,b)(a, b) from the joint. We would like p(b∣a)p(b \mid a) and p(a∣b)p(a \mid b). The slides’ examples: translation to and from languages for which no parallel text is economical to collect; image-to-image translation without paired examples (horses ↔ zebras, photos ↔ paintings, summer ↔ winter, photos ↔ segmentation maps); generating extra labeled examples. With pairs this would be ordinary supervised learning (pix2pix, Isola et al. 2017); without them, what could possibly tell us which bb belongs to which aa?

Two properties hold for every true alignment, so they can be used as learning signals:

  1. Marginal matching: translated samples must be distributed like real samples of the other domain, ∫q(b∣a) p(a) da=p(b)\int q(b \mid a)\,p(a)\,da = p(b) (and the same in the other direction).
  2. Cycle consistency: translating there and back returns the original, GBA(GAB(a))=aG_{BA}(G_{AB}(a)) = a and GAB(GBA(b))=bG_{AB}(G_{BA}(b)) = b (for one-to-one relations).

The rest of the lecture is about how far these two go.


2. Marginal matching and its ambiguity

Marginal matching asks only that GAB # p(a)=p(b)G_{AB\,\#}\,p(a) = p(b). The slides warn about two kinds of failure:

  • If q(b∣a)q(b \mid a) may be any conditional, q(b∣a)=p(b)q(b \mid a) = p(b) — ignore aa entirely — matches the marginal perfectly. Deterministic maps rule this out, which is why the literature uses GAB:A→BG_{AB}: A \to B.
  • Even among deterministic maps, many push p(a)p(a) onto p(b)p(b). In one dimension (the slides’ hand-drawn example), the increasing map FB−1(FA(a))F_B^{-1}(F_A(a)) and the decreasing map FB−1(1−FA(a))F_B^{-1}(1 - F_A(a)) both do, and so do maps that fold the line.

Discrete distributions, exactly. For a one-to-one map between two finite alphabets, G#pA=pBG_\# p_A = p_B holds iff every symbol goes to a symbol of the same probability. So symbols with equal probabilities can be permuted freely: if a probability value occurs mm times, there are m!m! ways to match those symbols, and the number of marginal-matching bijections is ∏vmv!\prod_v m_v!. Script 01, Part 1 computes the exact word probabilities of ShapeWorld’s caption language (Lecture 15’s enumeration of all 25,600 captions):

word probabilitywordswhich
0.125003a, at, the
0.098962center, middle
0.062502., and
0.031254big, huge, small, tiny
0.015628the eight kinds
0.013024bottom, left, right, top

3!⋅2!⋅2!⋅4!⋅8!⋅4!=3! \cdot 2! \cdot 2! \cdot 4! \cdot 8! \cdot 4! = 557,383,680 word maps preserve every word frequency (out of 23!≈2.6×102223! \approx 2.6 \times 10^{22}). For whole captions it is far worse: the 25,600 possible captions take only 32 distinct probability values (the largest tie: 2,368 captions), so about 1068,33510^{68{,}335} caption-to-caption maps preserve all caption probabilities. The slides’ NLP remark — “two semantically unrelated sentences might have the same frequency, and cycle consistency won’t rule that out either” — is an understatement.


3. Cycle consistency

Cycle consistency (also dual learning, back-translation) requires GBA∘GAB=idG_{BA} \circ G_{AB} = \mathrm{id} and GAB∘GBA=idG_{AB} \circ G_{BA} = \mathrm{id}: the maps must be inverse bijections. That removes everything that is not one-to-one — q(b∣a)=p(b)q(b \mid a) = p(b), folded maps, many-to-one maps — but it does not choose which bijection: every map counted in §2 is a bijection, and both monotone maps of the 1-D example are invertible.

Experiment (script 01, Part 2). AA is a mixture of two Gaussians (weights 0.7 / 0.3 at −1 and 2), BB another one (0.35 / 0.65 at −2 and 1.5). Both monotone maps push AA exactly onto BB (W1\mathrm{W}_1 0.033 and 0.024, against 0.023 between two samples of BB). We train tiny 1-D CycleGANs (MLP generators and discriminators, least-squares GAN loss) with 10 seeds, with and without the cycle loss, and compare the learned GG with both maps:

| losses | increasing | decreasing | other | W1(G(a),B)\mathrm{W}_1(G(a), B) | cycle error ∣F(G(a))−a∣|F(G(a)) - a| | |---|---|---|---|---|---| | GAN only (marginal matching) | 0 | 0 | 10 (folded: 1–7 changes of direction) | 0.25–0.58 | 0.31–2.19 | | GAN + cycle | 0 | 8 | 2 (monotone, but W1\mathrm{W}_1 ≈ 1.2: not converged) | 0.17–0.20 (the 8) | 0.02–0.06 |

Learned 1-D maps with and without cycle consistency

Without the cycle loss every run found a folded map — several regions of AA sent to the same region of BB — that matches the marginal roughly but cannot be inverted (cycle errors up to 2). With the cycle loss all maps became monotone and invertible, and 8 of 10 found the decreasing map: the optimization, not the losses, decided between two equally valid answers (here it preferred sending AA‘s heavy mode to BB‘s heavy mode). Two runs settled on an increasing map that did not match the marginal. The slides’ summary is exact: marginal matching and cycle consistency are “obviously not enough in general”; what else decides is the inductive bias of the model and the optimizer.


4. CycleGAN: what each ingredient contributes

CycleGAN (Zhu et al. 2017) combines both principles: least-squares GANs make translated images look like the target domain (marginal matching), and an L1 cycle loss makes the two generators inverses (cycle consistency): L=LGAN(GAB,DB)+LGAN(GBA,DA)+λ(∥GBA(GAB(a))−a∥1+∥GAB(GBA(b))−b∥1).\mathcal{L} = \mathcal{L}_{\text{GAN}}(G_{AB}, D_B) + \mathcal{L}_{\text{GAN}}(G_{BA}, D_A) + \lambda\big(\|G_{BA}(G_{AB}(a)) - a\|_1 + \|G_{AB}(G_{BA}(b)) - b\|_1\big). The slides show it translating images ↔ segmentation maps, horses ↔ zebras, photos ↔ paintings — and failure cases (a dog → cat translation that changes texture but not shape: CycleGAN is good at local appearance changes, bad at geometric ones).

4.1 Experiment: filled shapes ↔ outlines (script 02)

Domain A: filled shapes (square, disk, triangle, diamond; sizes 2–5; any position; 12 × 12). Domain B: their outlines (the boundary pixels). The correct translation is local (keep the boundary / fill the inside), but the four kinds are equally likely, so “every filled square → a disk outline” (and so on) matches the marginals just as well and is just as cycle-consistent — the ambiguity of §2. 20,000 unpaired images per domain, 4,000 steps; every output is parsed exactly to (kind, size, x, y). Our generators are small residual CNNs whose output starts as the identity (a skip connection from input to output logit, as in CycleGAN’s ResNet generators):

modeldirectionvalidright kindright sizeright positionexactcycle A → B → A exact
CycleGAN, conv generatorsA → B100%100%100%100%100%100%
B → A100%100%100%100%100%
GAN losses only (no cycle)A → B0%0%0%0%0%0%
cycle loss only (no GAN)A → B0%0%0%0%0%0%
CycleGAN, MLP generators (same skip)A → B17.9%17.9%17.9%17.9%17.9%94.9%
B → A64.5%64.5%64.5%64.5%64.5%
CycleGAN, conv generators without the identity skipA → B2.1%2.1%0%0%0%19.1%
B → A35.9%35.9%0%0%0%

What each ingredient contributes:

  1. Everything together works perfectly: every translation is the correct outline (or filling) of the correct shape — although the four kind-swapping bijections were equally valid solutions of both losses. The architecture chose.
  2. The GAN loss alone collapsed: both generators learned to output empty images — a degenerate equilibrium of the adversarial game in which nothing tied the output to the input.
  3. The cycle loss alone has a trivial solution — the identity, whose outputs are filled shapes, not outlines. Our run reached it (cycle loss 10−510^{-5} after 800 steps) and then drifted to empty images, where the saturated sigmoid outputs gave no gradient back; either way, no B images.
  4. Without locality (MLP generators, same identity start), the cycle was mostly closed (94.9%) but only 18% of the outlines were valid — the network must learn the outline of every shape at every position separately; when its outputs are valid they are right.
  5. Without the identity start, the CNN drew outline-like strokes of the wrong size in the wrong place (35.9% valid fillings in one direction, never the right size or position). In our first attempts (all generators without the skip) every CycleGAN failed this way, with or without instance noise, an identity loss or a patch discriminator; adding the skip fixed it at once (100%), with a global or a patch discriminator.

The slides’ summary, made concrete: marginal matching and cycle consistency define a set of acceptable translations; the inductive biases of the generator — local operations, and small changes from the input — pick the right one. For domains that differ by a local change (textures, styles, outlines) that bias is correct; for geometric changes (the dog → cat failure) it is not.


5. When the domains carry different information

5.1 Stochastic mappings

A deterministic one-to-one map is too restrictive when one domain carries less information than the other: a segmentation mask is consistent with many photographs (slides). The natural extension gives the generator a noise input, GAB(a,z)G_{AB}(a, z) (DualGAN-style). But the cycle loss then forces GBA(GAB(a,z),z′)=aG_{BA}(G_{AB}(a, z), z') = a for every z,z′z, z' — so the choice of zz becomes irrelevant, and the generator learns to ignore it (Exercise 3). Augmented CycleGAN (Almahairi et al. 2018) adds latent variables to both domains and learns encoders for them, so that the cycle can be closed through the latent codes instead of through the image.

5.2 CycleGAN can “cheat”

If A→BA \to B loses information, how does a CycleGAN still reconstruct aa from GAB(a)G_{AB}(a)? It hides the missing information in GAB(a)G_{AB}(a) — in details the discriminator does not penalize: low-amplitude pixel patterns, or small visible deviations from realistic outputs (the slides’ “CycleGAN can cheat”; Chu et al. 2017 called it “a master of steganography”). The translation then looks consistent with the cycle while the “information” never went through the semantic content at all.

5.3 Experiment: shapes → centre markers (script 03)

Domain A: filled shapes (kind, size, position). Domain M: only a 3 × 3 plus at the shape’s centre — kind and size are gone (64 possible images). GMAG_{MA} gets two channels of uniform noise. A cycle A → M → A can only succeed if kind and size travel through the “markers” somehow.

Our CycleGAN for this pair uses the identity-skip generators of §4 and a PatchGAN discriminator (one realism score per 7 × 7 neighbourhood: on this 64-image domain a single global score gave cleaner markers but no hidden channel — see the plan-vs-reality notes of the code). 2,000 / 4,000 test shapes:

What the A → M generator outputs. Only 7.0% of its outputs are proper markers, none at the right place: marginal matching failed on this tiny domain. Yet the outputs carry exactly what M should not contain — a linear classifier reads the kind (81.7%) and the size (94.5%) from them; from true markers the kind is at chance (24.4%) and the size partly guessable from the position (67.5%: big shapes sit in the middle).

Where the information travels (A → M → A):

intermediate imagevalid filled shapeexact source recovered
the generator’s “markers”, as they are11.2%11.2%
the same images rounded to 0/11.8%1.8%
plus Gaussian noise, sd 0.025.3%5.3%

The pixel values deviate from 0/1 by only 0.013 on average, yet rounding them away cuts the exact reconstructions by a factor of six: part of the information travels in deviations far too small to see — steganography, in miniature. (Our cycle is far from perfect; Chu et al.’s full-size CycleGAN hid enough to reconstruct photos almost exactly from aerial maps.)

The noise input (Part 3). Given real markers — which carry no hidden signal — and 10 values of the noise each, GMAG_{MA} produced valid shapes only 3.4% of the time, never at the marker’s position, and those were always the same tiny disk: it learned to decode its own hidden channel, not to sample the missing kind and size from zz. That is the failure Augmented CycleGAN addresses.


6. Sub-components: aligning words without a dictionary

6.1 Why words help

The slides’ way out of the sentence-level ambiguity: sentences are made of words, and it is unlikely that the words of two unrelated sentences have the same statistics. Sub-components can be aligned on their own, using their co-occurrence statistics — which is what word vectors summarize (Lecture 15). Mikolov et al. (2013) observed that word-vector spaces of two languages are related by a nearly linear map, and Xing et al. (2015) that, with normalized vectors, it is best taken orthogonal — “only a rotation away”. With a seed dictionary of pairs (xi,yi)(x_i, y_i) the best rotation is the orthogonal Procrustes solution W=UV⊤W = UV^\top from the SVD X⊤Y=UΣV⊤X^\top Y = U\Sigma V^\top. Conneau et al. (2018, MUSE) found the rotation without a dictionary (adversarially, then refined), and Artetxe et al. (2018, VecMap) with an isometry-invariant initialization: describe each word by the sorted similarities to all words of its own language — unchanged by any rotation, so comparable across languages — then refine with Procrustes.

6.2 Experiment: two caption languages (script 04)

Language 1 is ShapeWorld’s English-like captions; language 2 describes the same kind of images with cipher words (“a huge ring at the top left …” becomes “pebe taxo lope risu voly …”; the dictionary is hidden). Each language gets its own 20,000 captions of different images — no parallel sentences — and its own word vectors (positive PMI over a ±4-word window, SVD, Lecture 15). One-to-one dictionaries are chosen with the Hungarian algorithm; every number is averaged over 5 independent pairs of corpora.

Supervised (a seed dictionary of kk random pairs), accuracy on the other words:

seed pairs kk251023 (all)
symmetric (ShapeWorld) language9.5%26.7%49.2%100% on the seeds
asymmetric world (below)17.1%31.1%61.5%100%

With the true dictionary the best rotation leaves a relative residual of 0.22: the spaces are roughly one rotation apart, up to sampling noise. Yet even 10 seed pairs leave half the remaining words wrong — the reason is the next table.

Unsupervised, in ShapeWorld’s (symmetric) language:

methodall wordskindssizesrowscolumnsfunction words
frequency (log-count matching)35.7%8%25%67%53%60%
structure (similarity signatures)56.5%15%80%47%73%100%
frequency + structure58.3%15%80%73%60%100%
ceiling of any unsupervised method (exact)56.5%12%75%67%67%100%

6.3 What can never be aligned

ShapeWorld’s caption language is symmetric: the 8 kinds are exchangeable (uniform, independent of everything else except the copy rule, which treats all kinds alike), so are big and huge (both always sit in the middle centre), top and bottom, left and right (the panel is symmetric). Permuting the words of such a group leaves every statistic of the language unchanged — so no unsupervised method, with any amount of data, can tell them apart. A word in an exchangeable group of size mm can at best be matched with probability 1/m1/m; everything else (the function words, tiny vs small, middle vs center) has its own statistics. The exact expected ceiling is 56.5% of the words (13 of 23 in expectation). The aligners reach it (58.3% is within the luck of 5 corpus pairs): structure aligned every word that can be aligned, and the kinds are at chance. A seed dictionary helps only for the words it contains, which is why the supervised rows above stay low.

Break the symmetries. In a world where kinds have different frequencies (Zipf-like), sizes are unequally likely and shapes prefer the left and, less strongly, the bottom, every word has its own fingerprint (script 04, Part 3):

methodall wordskindssizesrowscolumnsfunction words
frequency91.3%100%100%100%100%60%
structure62.6%22%60%73%100%100%
frequency + structure100.0%100%100%100%100%100%

Frequency now separates the content words (their frequencies differ), but not the function words “a”, “at”, “the” (all twice per caption); structure separates the function words (different neighbours) but not the kinds (a kind’s context does not depend on which kind it is — only its frequency does). Together they align every word. This is the slides’ point in its sharpest form: alignment without supervision works exactly as far as the statistics differ, and natural languages are full of such differences.

Another word order (Part 4). If the second language also puts the kind before the size and the column before the row, the co-occurrence windows no longer correspond: the residual of the best rotation grows from 0.252 to 0.336 and structure-only alignment falls from 62.6% to 33.0% (frequency + structure: 87.8%). Word vectors are only approximately isometric across languages with different syntax — one reason MUSE-style alignment works better for related languages.


7. Unsupervised machine translation; the Language Quantized AutoEncoder

Unsupervised MT (Lample et al. 2018; Artetxe et al. 2018) combines all three principles of the lecture (slides):

  1. Sub-component alignment: an initial word-by-word translation from aligned word vectors (§6);
  2. Marginal matching: a denoising language model in each language makes outputs fluent — translations must look like real sentences of the target language;
  3. Cycle consistency: back-translation — translate a target-language sentence into the source with the current model, then train the source→target model to recover the original sentence from it; iterate, improving both directions.

Our word alignment (§6) gives the first step; the reordering a word-by-word translation gets wrong (Part 4’s “kind before size”) is what the language model and back-translation would repair.

The Language Quantized AutoEncoder (LQAE; Liu, Yan, Abbeel 2023; on the slides) aligns images with text without paired data: a VQ autoencoder whose codebook is the frozen token-embedding table of a pretrained language model (RoBERTa), trained to reconstruct images from masked versions of their token sequences. Each image becomes a sequence of text tokens, which a frozen large language model can then use in few-shot prompts (e.g., image classification from a handful of examples). The tokens are not human-readable words for the image’s content, but they live in the LLM’s input space — alignment by construction rather than by matching statistics.


8. Summary

  1. Unsupervised alignment sees only p(a)p(a) and p(b)p(b). Marginal matching is massively ambiguous: every map that preserves the distribution qualifies — 557 million word maps and ~1068,33510^{68{,}335} caption maps for ShapeWorld’s language.
  2. Cycle consistency restricts to bijections but cannot choose among them: 1-D CycleGANs found folded maps without it, monotone ones with it — mostly the decreasing one, a choice made by the optimization.
  3. CycleGAN (filled shapes ↔ outlines, parsed exactly) translated 100% of the shapes correctly — although kind-swapping maps satisfy both losses equally well. The choice came from the architecture: without the generator’s identity skip 0% were right, with MLP generators 18–65%; the GAN loss alone and the cycle loss alone both collapsed.
  4. When one domain lacks information (shapes → centre markers), the CycleGAN hid kind and size in its outputs (readable at 82% / 95%; rounding the outputs to 0/1 cut exact reconstructions from 11.2% to 1.8%) and ignored its noise input on real markers.
  5. Words have their own statistics: word-vector spaces of two languages are (approximately) a rotation apart; frequency + structure aligned 100% of the words in an asymmetric world without any dictionary. In ShapeWorld’s symmetric language, no method can exceed the exact ceiling of 56.5%: words related by a symmetry of the distribution are fundamentally indistinguishable.
  6. Unsupervised MT = word alignment + language models + back-translation; LQAE aligns images to text by quantizing them into a frozen LM’s vocabulary.

9. Common pitfalls

  1. Believing a realistic-looking translation is a correct one. Marginal matching only checks that outputs look like the target domain; our exact parser shows translations that are perfect outlines of the wrong shape (§4).
  2. Thinking cycle consistency identifies the alignment. It only enforces invertibility; every symmetry of the data gives another cycle-consistent answer.
  3. Trusting the cycle loss as evidence of understanding. A near-zero cycle error can come from information hidden in invisible pixel deviations (§5).
  4. Adding noise to a CycleGAN generator to make it stochastic. The cycle loss makes the generator ignore the noise.
  5. Evaluating word alignment on exchangeable words. No method can align words that a symmetry of the language exchanges; report the ceiling.
  6. Assuming word vectors are isometric across languages. Different syntax changes co-occurrence windows; the best rotation’s residual tells you how far from isometric they are.

10. Exercises

Exercise 1 (counting matching maps — derivation). Show that a bijection ff between finite alphabets satisfies f#pA=pBf_\# p_A = p_B iff pB(f(a))=pA(a)p_B(f(a)) = p_A(a) for all aa, and that the number of such bijections is ∏vmv!\prod_v m_v!.

Answer

For a bijection, (f#pA)(b)=∑a:f(a)=bpA(a)=pA(f−1(b))(f_\# p_A)(b) = \sum_{a: f(a) = b} p_A(a) = p_A(f^{-1}(b)), so f#pA=pBf_\# p_A = p_B iff pA(f−1(b))=pB(b)p_A(f^{-1}(b)) = p_B(b) for every bb, i.e. pB(f(a))=pA(a)p_B(f(a)) = p_A(a). Hence ff maps the mvm_v symbols of probability vv in AA onto the mvm_v symbols of probability vv in BB (the counts must agree), in any of mv!m_v! ways, independently for each value vv: ∏vmv!\prod_v m_v! in total.

Exercise 2 (two monotone transports — derivation). Show that for continuous distributions on R\mathbb{R} with CDFs FAF_A, FBF_B, both T↑=FB−1∘FAT_\uparrow = F_B^{-1}\circ F_A and T↓=FB−1∘(1−FA)T_\downarrow = F_B^{-1}\circ(1 - F_A) push pAp_A onto pBp_B.

Answer

If a∼pAa \sim p_A, then U=FA(a)U = F_A(a) is uniform on [0,1][0, 1] (probability integral transform), and so is 1−U1 - U. For uniform UU, FB−1(U)F_B^{-1}(U) has CDF FBF_B (inverse transform sampling). Both maps are therefore samplers of pBp_B. T↑T_\uparrow is increasing, T↓T_\downarrow decreasing, and both are invertible — cycle consistency cannot choose between them.

Exercise 3 (why the noise is ignored). A CycleGAN generator GBA(b,z)G_{BA}(b, z) takes noise zz. Show that if the cycle loss E ∣GBA(GAB(a),z)−a∣\mathbb{E}\,|G_{BA}(G_{AB}(a), z) - a| is zero, then GBA(⋅,z)G_{BA}(\cdot, z) does not depend on zz on the range of GABG_{AB}.

Answer

Zero loss means GBA(GAB(a),z)=aG_{BA}(G_{AB}(a), z) = a for almost all aa and zz. For any b=GAB(a)b = G_{AB}(a) in the range, GBA(b,z)=aG_{BA}(b, z) = a for all zz: the output is the same for every noise value. The generator can only be stochastic on inputs that GABG_{AB} never produces — and on real bb, which carry no hidden information, it has learned nothing about how to use zz (§5). Augmented CycleGAN adds latent variables for the missing information to both directions so that the cycle can be closed without ignoring them.

Exercise 4 (orthogonal Procrustes — derivation). Show that min⁡W⊤W=I∥XW−Y∥F\min_{W^\top W = I}\|XW - Y\|_F is attained at W=UV⊤W = UV^\top where X⊤Y=UΣV⊤X^\top Y = U\Sigma V^\top.

Answer

∥XW−Y∥F2=∥X∥2+∥Y∥2−2 tr(W⊤X⊤Y)\|XW - Y\|_F^2 = \|X\|^2 + \|Y\|^2 - 2\,\mathrm{tr}(W^\top X^\top Y) since ∥XW∥=∥X∥\|XW\| = \|X\| for orthogonal WW. Maximize tr(W⊤UΣV⊤)=tr(Σ V⊤W⊤U)\mathrm{tr}(W^\top U\Sigma V^\top) = \mathrm{tr}(\Sigma\, V^\top W^\top U). The matrix Z=V⊤W⊤UZ = V^\top W^\top U is orthogonal, so its diagonal entries are at most 1 and the trace is at most ∑iσi\sum_i \sigma_i, reached at Z=IZ = I, i.e. W=UV⊤W = UV^\top.

Exercise 5 (the ceiling). Verify the 56.5% ceiling of §6.3 by listing the exchangeable groups of the caption language and their sizes.

Answer

Groups: 8 kinds, {big, huge}, {top, bottom}, {left, right}; all other 9 words are distinguishable (a, at, the, and, ”.”, tiny, small, middle, center). Expected correct words: 9+8⋅18+2⋅12+2⋅12+2⋅12=139 + 8\cdot\tfrac18 + 2\cdot\tfrac12 + 2\cdot\tfrac12 + 2\cdot\tfrac12 = 13 of 23 = 56.5%.

Exercise 6 (coding). In script 04, make only the kind frequencies non-uniform (keep sizes and positions symmetric). Predict the new ceiling and which method reaches it.

Answer

(Run it.) Kinds become distinguishable by frequency; big/huge, top/bottom and left/right remain exchangeable: expected ceiling (9+8+3)/23≈87%(9 + 8 + 3)/23 \approx 87\%. Frequency matching should now align the kinds, structure the function words; their combination should reach the ceiling.


11. Further reading

From the slides

  • P. Isola, J.-Y. Zhu, T. Zhou, A. Efros. Image-to-Image Translation with Conditional Adversarial Networks (pix2pix), CVPR 2017; J.-Y. Zhu, T. Park, P. Isola, A. Efros. Unpaired Image-to-Image Translation using Cycle-Consistent Adversarial Networks (CycleGAN), ICCV 2017.
  • Z. Yi, H. Zhang, P. Tan, M. Gong. DualGAN, ICCV 2017; A. Almahairi, S. Rajeswar, A. Sordoni, P. Bachman, A. Courville. Augmented CycleGAN: Learning Many-to-Many Mappings from Unpaired Data, ICML 2018.
  • T. Mikolov, Q. Le, I. Sutskever. Exploiting Similarities among Languages for Machine Translation, 2013; C. Xing, D. Wang, C. Liu, Y. Lin. Normalized Word Embedding and Orthogonal Transform for Bilingual Word Translation, NAACL 2015; A. Conneau, G. Lample, M. Ranzato, L. Denoyer, H. Jégou. Word Translation Without Parallel Data (MUSE), ICLR 2018; G. Lample, A. Conneau, L. Denoyer, M. Ranzato. Unsupervised Machine Translation Using Monolingual Corpora Only, ICLR 2018.
  • H. Liu, W. Yan, P. Abbeel. Language Quantized AutoEncoders: Towards Unsupervised Text-Image Alignment, NeurIPS 2023.

Added by these notes

  • C. Chu, A. Zhmoginov, M. Sandler. CycleGAN, a Master of Steganography, 2017 — the hidden-information experiment of §5.
  • M. Artetxe, G. Labaka, E. Agirre. A Robust Self-Learning Method for Fully Unsupervised Cross-Lingual Mappings of Word Embeddings (VecMap), ACL 2018 — the similarity-signature initialization of §6.
  • P. Schönemann. A Generalized Solution of the Orthogonal Procrustes Problem, Psychometrika 1966.

12. Next lecture

Lecture 20 turns to compression: why no compressor can shrink everything, prefix codes and Huffman’s algorithm, entropy as the limit (Kraft–McMillan, Shannon), the cost of coding with the wrong model, and arithmetic coding — the bridge that turns any autoregressive model of this course into an actual compressor.

← 返回课程目录