---
title: "Adversarial Contrastive Estimation — paper by Bose et al. (2018)"
description: "Adversarial Contrastive Estimation learns to sample harder negatives for word embeddings, hypernym prediction, and knowledge graph completion."
canonical: "https://research.elamur.ai/free/en/papers/bose-2018-adversarial-contrastive-estimation/"
---
Elamur: [Mova](https://md.mova.elamur.ai/free/en/) · [Parse](https://mova.elamur.ai/free/en/parse/) · [Dictionary](https://md.dictionary.elamur.ai/free/en/) · [Translate](https://md.translate.elamur.ai/free/en/) · **Research** · [Gali](https://md.gali.elamur.ai/free/en/) · [MCP](https://mcp.elamur.ai/) · [Locations](https://md.locations.elamur.ai/free/en/) · [Weather](https://md.weather.elamur.ai/free/en/) · [Constitution](https://md.constitution.elamur.ai/)

[Elamur Research](https://md.research.elamur.ai/free/en/) · [this page in HTML](https://research.elamur.ai/free/en/papers/bose-2018-adversarial-contrastive-estimation/)

[Elamur Research](https://md.research.elamur.ai/free/en/) / [papers](https://md.research.elamur.ai/free/en/papers/) / [2018](https://md.research.elamur.ai/free/en/papers/2018/) / Adversarial Contrastive Estimation

# Adversarial Contrastive Estimation

Paper · 2018 · Avishek Joey Bose, Huan Ling and Yanshuai Cao

**Authors:** [Avishek Joey Bose](https://md.research.elamur.ai/free/en/authors/avishek-joey-bose/), Huan Ling and Yanshuai Cao · **Year:** 2018 · **Venue:** Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers) · **Licence:** [CC BY 4.0 (ACL Anthology)](https://creativecommons.org/licenses/by/4.0/)

Cited by **7** papers in our library of more than 163,000 papers whose bibliographies we read · Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers) · [licence](https://creativecommons.org/licenses/by/4.0/)

- [Publisher's page](https://aclanthology.org/P18-1094/)
- [PDF](https://aclanthology.org/P18-1094.pdf)
- [DOI 10.18653/v1/p18-1094](https://doi.org/10.18653/v1/p18-1094)

## Summary

When a system learns from examples of what belongs together, it also needs examples of what to keep apart. The easiest way to obtain them is to change part of a real example at random. In text, this might mean taking a word and replacing one of its observed neighbors with another word from the vocabulary. Many such replacements are easy to reject. Once the system can already tell the difference, more examples of that kind may do little to help it learn which plausible alternatives it should prefer. Adversarial Contrastive Estimation, or ACE, changes how the alternatives are chosen.

ACE keeps the fixed sampling rule and adds a learned sampler. The learned sampler sees the part of an example that stays fixed and proposes a replacement that the current scoring system is likely to find difficult. The scorer learns to distinguish observations from these proposals, and the sampler learns from the scorer’s response. As the scorer improves, a replacement that once exposed a mistake can lose its value. The sampler therefore needs to keep exploring. The authors use entropy regularization to encourage that exploration and, where feasible, check whether an apparent negative is already a known positive. The fixed sampler continues to supply examples even if the learned sampler stops finding useful alternatives.

The experiments cover [word embeddings](https://md.research.elamur.ai/free/en/concepts/word-embeddings/), prediction of which concepts fall under broader ones, and prediction of missing links in a [knowledge graph](https://md.research.elamur.ai/free/en/concepts/knowledge-graph/). For Skip-gram word vectors trained from scratch on English Wikipedia, ACE reaches Spearman scores of 32.71 on Rare Word and 55.00 on WordSim-353 after 1 epoch, against 18.90 and 31.35 with fixed sampling. Using the learned sampler alone gives the strongest WordSim-353 result among the from-scratch runs. On the WordNet hypernym task, the reported accuracy rises from 90.6% to 92.0%. On WN18 link prediction, the strongest ACE variant by test mean reciprocal rank scores 0.792, against 0.527 for the authors’ fixed-sampling TransD run. That same ACE variant reports 0.945 on hit@10, beside 0.947 for the fixed-sampling run.

The experiments show why the choice of negative examples matters and why a sampler that learns to produce them needs safeguards of its own. In the word experiment, the learned negatives consistently give the scorer a higher loss than the fixed negatives. In the hypernym experiment, the learned negatives can become easy quickly when the sampler is left without the tested regularization. The gains also depend on how performance is measured. ACE improves several scores within the training runs, while some word-vector fine-tuning results are mixed and a large sampling vocabulary can make each update expensive.

## Deep dive: Adversarial Contrastive Estimation

Adversarial Contrastive Estimation learns to sample harder negatives for word embeddings, hypernym prediction, and knowledge graph completion. · about 36 minutes to read

**In this deep dive**

1. [The problem and its context](#dd-the-problem-and-its-context)
2. [The method, step by step](#dd-the-method-step-by-step)
3. [Experiments and results](#dd-experiments-and-results)
4. [What the ablations show](#dd-what-the-ablations-show)
5. [Limitations](#dd-limitations)
6. [What came after](#dd-what-came-after)

### The problem and its context

#### Why a positive example needs an alternative

A word and a context in which it actually appears give the learner evidence that the two are compatible. A recorded relation between entities gives evidence of a different kind, but the scoring problem has a similar shape. The observed combination should receive a favorable score. Training also has to specify which combinations should receive less favorable scores. Without some way to account for alternatives, a scoring rule might assign favorable values broadly and still look good whenever it is evaluated only on observations.

One way to account for all alternatives is to put them in a normalized probability distribution. A softmax gives each candidate a weight relative to the combined weight of the candidate set. With a large vocabulary, calculating that combined weight repeatedly can make training expensive. The paper discusses noise-contrastive estimation, abbreviated NCE, as a way to train by distinguishing observations from examples drawn from a noise distribution. It treats word-vector negative sampling as equivalent to NCE for the purpose of the ACE framework. The shared question is how the noise examples are selected.

There is also a reason to use contrastive training when normalization is beside the point. A scoring rule can express a structural assumption directly. If a relation is represented as a translation in a vector space, a recorded fact should have a small distance between the translated head entity and the tail entity. A training loss can penalize an observed fact that scores poorly relative to a corrupted fact. The choice of distance expresses the geometric assumption, and the choice of corrupted fact decides which alternatives test it. The paper relates this use of a distance score to [TransE](https://md.research.elamur.ai/free/en/papers/bordes-2013-translating-embeddings-modeling-multi-relational/).

Word and graph training both provide a straightforward way to construct an alternative. Keep part of an observation and replace the rest. For a word–context pair, the target word can stay fixed while a noise word takes the place of the observed context. For a graph fact, the relation and one entity can stay fixed while another entity fills the open slot. In either case, the newly assembled example can be scored through the same machinery as the original. The positive examples come from the training data. The negative examples depend on an additional design choice.

#### Why fixed noise can lose value during training

A simple replacement rule can use the same distribution for many different observations. This makes sampling straightforward, but the distribution has no way to ask whether a candidate is plausible given the target word or the retained part of the graph fact. A draw may be frequent under the sampling rule and still have little in common with the correct answer. Nor does a fixed distribution change when an alternative that used to cause errors becomes easy to distinguish.

The paper’s concern is with what each draw contributes to the update. A negative example can be perfectly valid as a corruption and still carry little training signal. In a margin-based loss, a negative that already lies far enough from the positive can contribute no penalty. In a classification loss, an example that the scorer already rejects confidently has little leverage. As training handles more of these ordinary draws, the remaining difficult ones can become a smaller part of what a fixed sampler produces. The supply of draws remains steady even if their value changes.

A manually designed rule could restrict replacements to more plausible candidates. The authors argue that such a rule would require effort to design and would still express the designer’s judgment about what makes a good negative. The judgment ACE uses is more immediate. It asks which alternatives cause trouble for the scorer at its current stage of training. That makes difficulty a property of the example, the retained input, and the current scorer together. The same candidate can provide a strong training signal for one input and little signal for another.

The paper connects this motivation to earlier work on hard example mining in object detection. It also draws a distinction within structured prediction, where a training procedure can seek a configuration that maximizes a loss-augmented score. Exact search can identify the hardest candidate under that objective when the necessary inference is tractable. ACE learns a sampler whose parameters are reused across observations. The cost of learning how to find difficult alternatives is spread across training, and the sampler can draw candidates without certifying that each one is the hardest available. The related approaches include [online hard example mining](https://md.research.elamur.ai/free/en/papers/shrivastava-2016-training-region-based-object-detectors/) and [contrastive estimation with specified neighborhoods](https://md.research.elamur.ai/free/en/papers/smith-2005-contrastive-estimation-training-log-linear/).

#### Where the adversarial idea enters

The authors take the idea of jointly training a generator and a discriminator from [Generative Adversarial Nets](https://md.research.elamur.ai/free/en/papers/goodfellow-2014-generative-adversarial-nets/). The discriminator is the scorer that will be used for the embedding task. The generator is a sampler that looks for replacements that make the scorer’s job harder. An update to the scorer can reduce the usefulness of a replacement the generator has learned to favor. The generator then has an incentive to find another one.

ACE applies this relationship to a restricted generation problem. The generator receives a retained input and chooses among discrete candidates, such as vocabulary words or entities. It does not need to make a complete training example from scratch. Its output becomes one part of a training example, and the scoring rule inherited from the task tells the generator how challenging that example was. The fixed source of negatives remains part of the procedure, which matters when the learned part has yet to acquire useful preferences or ceases to offer a varied set of proposals.

This arrangement allows the same sampling idea to work with different meanings of a good score. A classifier can assess whether a context belongs with a word. An order embedding can assess whether the coordinates of two concept vectors satisfy a directional relation. A graph scorer can assess whether a translation takes one entity close to another. ACE changes the alternatives presented during training while leaving each of those scoring ideas available to the task.

### The method, step by step

#### From an observation to an update

Start with an observed pair and decide which part to retain. For a word example, retain the target and treat the observed context word as the correct companion. For a graph example, the retained input can include a head entity and a relation, and the correct companion is the recorded tail. Both the fixed and learned samplers can propose a replacement for the companion. Only the learned sampler changes its probabilities as training proceeds.

The discriminator scores the observation and the assembled alternatives. Its update aims to make the relevant distinctions easier. The generator uses the discriminator’s loss to adjust which candidates it is likely to draw. If the procedure has a lookup for known positives, it handles an accidental positive differently on each side. The discriminator does not learn to reject it, and the generator is penalized for spending a draw on it. The two updates alternate, so the generator receives feedback from a scorer that is itself changing.

How ACE draws negatives and updates its participants The steps in order.

The generator produces a distribution over candidates. A candidate with high probability is more likely to appear, but the distribution can assign probability to many alternatives for the same input. That is what makes it possible to reward examples already found while continuing to discover others. The framework uses the word “adversarial” for the opposition between updates. The discriminator tries to reduce its loss, while generator proposals seek out conditions that raise it.

#### The contrastive objective

The general objective starts with a loss on a positive and a negative that share an input. It can express a classification problem, where each pair makes its own contribution, or a ranking problem, where a penalty depends on the scores of both pairs together. The authors write the general expected loss as follows.

```
L(ω) = Eₚ₍ₓ⁺,ᵧ⁺,ᵧ⁻₎[ℓω(x⁺, y⁺, y⁻)]
```

Here `L` is the overall objective and `ω` is the collection of parameters being trained in the discriminator. `ℓω` is the loss for the examples inside the brackets. `x⁺` is the input taken from an observation, `y⁺` is its observed companion, and `y⁻` is a sampled replacement. The notation `E` denotes an expectation, or probability-weighted average, and its subscript gives the joint distribution `p` of the quantities being averaged over. The superscripts distinguish observed and sampled roles. A sampled item can still turn out to be a known positive.

The paper assumes that after the retained input has been specified, the sampler draws the replacement without consulting the particular positive companion. This permits a separate description of how observations occur and how negatives are drawn. Conditional independence here still allows the retained input to influence both parts.

```
L(ω) = Eₚ₍ₓ⁺₎[Eₚ₍ᵧ⁺ | ₓ⁺₎ ₚ₍ᵧ⁻ | ₓ⁺₎[ℓω(x⁺, y⁺, y⁻)]]
```

The outer expectation uses the distribution `p(x⁺)` of retained inputs. The inner expectation uses the product of `p(y⁺ | x⁺)`, the distribution of observed companions given the input, and `p(y⁻ | x⁺)`, the negative sampling distribution. The vertical bar means “given.” `L`, `ω`, and `ℓω` still denote the objective, discriminator parameters, and example loss. Separating the distributions in this way makes clear which part ACE replaces.

When the loss separates into a positive term and a negative term, the authors use a shorthand in which the signs move from the individual examples to their distributions. The negative term is written as a score to be pushed up, so it appears with a minus sign in the loss to be minimized.

```
L(ω) = Eₚ⁺₍ₓ₎[Eₚ⁺₍ᵧ | ₓ₎[sω(x, y)] − Eₚ⁻₍ᵧ | ₓ₎[s̃ω(x, y)]]
```

In this expression, `x` denotes the retained input and `y` the companion being scored. `p⁺(x)` is the distribution of inputs in the observations, and `p⁺(y | x)` and `p⁻(y | x)` are the positive and negative companion distributions. `sω` denotes the positive score and `s̃ω` the negative score in this sign convention. Both use parameters `ω`, and `E` averages over the distribution indicated beside it. Minimizing `L` lowers the positive term and raises the subtracted negative score. A task that writes both contributions as penalties can equivalently add the negative penalty directly.

A margin-ranking loss gives a different case. The scorer pays a penalty whenever the negative fails to score worse than the positive by the required margin. The penalty stops at zero once the condition is satisfied. Taking the maximum after comparing the scores couples the examples. Even if the negative draw does not depend on the positive companion, its effect on this loss still depends on which positive is present. This distinction determines what information the generator needs in its reward.

#### Mixing fixed noise with a learned distribution

ACE forms the negative distribution by combining the original noise distribution with a conditional generator. The general objective uses a weight for each component. Implementations can draw from both sources for the same training observation, as the word-vector setup does.

```
p⁻(y | x) = λ pₙ꜀ₑ(y) + (1 − λ) gθ(y | x)
```

The symbol `p⁻` denotes the resulting negative distribution. `y` is a replacement candidate and `x` is the retained input. `pₙ꜀ₑ` denotes the fixed noise rule, written here without dependence on `x` in the paper’s general formulation. `gθ` is the generator’s distribution given `x`, and `θ` denotes the generator’s trainable parameters. `λ` gives the fixed component’s weight and `1 − λ` gives the learned component’s weight. The `1` is the total probability mass shared by the components.

For a given input, the corresponding loss has one expectation for each sampling source.

```
L(ω, θ; x) = λ Eₚ₍ᵧ⁺ | ₓ₎ ₚₙ꜀ₑ₍ᵧ⁻₎[ℓω(x, y⁺, y⁻)]
           + (1 − λ) Eₚ₍ᵧ⁺ | ₓ₎ gθ₍ᵧ⁻ | ₓ₎[ℓω(x, y⁺, y⁻)]
```

`L(ω, θ; x)` is the expected loss conditional on input `x`. The semicolon in the notation separates the input from the parameter sets `ω` and `θ`. Both expectations `E` use `p(y⁺ | x)` for the observed companion `y⁺`. The first uses `pₙ꜀ₑ` to draw the replacement `y⁻`, while the second draws it from `gθ`. The weights `λ` and `1 − λ` are the mixture weights. The same discriminator loss `ℓω` scores examples drawn from either source.

The discriminator tries to lower the expected loss, while the generator tries to raise it through its choice of examples. The paper expresses this as a minimax objective averaged over retained inputs.

```
minω maxθ V(ω, θ) = minω maxθ Eₚ⁺₍ₓ₎[L(ω, θ; x)]
```

`V` denotes the value of the game before optimization, and `L` is the conditional loss just defined. `minω` indicates minimization over discriminator parameters `ω`, and `maxθ` indicates maximization over generator parameters `θ`. The expectation `E` averages over inputs `x` drawn from the observed-input distribution `p⁺`. In training, the authors alternate parameter updates. The notation identifies the objectives of the participants and leaves open how well those updates solve the game.

For a separable loss, the paper also shows the conditional value in a form that makes the generator’s role visible. Its displayed decomposition suppresses the mixture weights, which are explicit in the weighted objective above.

```
L(ω, θ; x) = Eₚ⁺₍ᵧ | ₓ₎[sω(x, y)]
           − Eₚₙ꜀ₑ₍ᵧ₎[s̃ω(x, y)]
           − E_gθ₍ᵧ | ₓ₎[s̃ω(x, y)]
```

`L` is again the conditional value at input `x`, and `y` is the companion variable within each expectation `E`. The distributions `p⁺`, `pₙ꜀ₑ`, and `gθ` supply observed companions, fixed negatives, and learned negatives, respectively. The positive score is `sω` and the negative score under the subtractive convention is `s̃ω`. The scores depend on discriminator parameters `ω`. Only the distribution in the final term depends on generator parameters `θ`. Accordingly, the generator can use the negative of `s̃ω` as its reward in this convention. For a loss that couples the positive and negative scores, the reward retains the full comparison.

#### Updating a sampler that chooses discrete items

A generator draw names an item from a categorical distribution. Slightly changing the probability of a word changes the chance of drawing it, but the word that comes out of a particular draw is still a discrete choice. This prevents the ordinary route of differentiating through a discriminator’s input all the way back to the generator. The authors discuss differentiable relaxations and point out that the Gumbel approach they consider calls for as many Gumbel draws per categorical sample as there are categories. These categories are vocabulary entries for words and possible entities for graphs. The alternatives they discuss are [Gumbel-Softmax](https://md.research.elamur.ai/free/en/papers/jang-2016-categorical-reparameterization-gumbel-softmax/) and [the Concrete distribution](https://md.research.elamur.ai/free/en/papers/maddison-2016-concrete-distribution-continuous-relaxation-discrete/).

Instead, they use REINFORCE, which differentiates the log probability of the choice and weights that derivative using the reward observed after the choice. The paper displays the estimator with a leading minus on the loss. This is the sign for descent on the negative of the generator’s reward objective, since the generator seeks a higher discriminator loss.

```
(1 − λ) Eₚ₍ᵧ⁺ | ₓ₎ gθ₍ᵧ⁻ | ₓ₎[−ℓω(x, y⁺, y⁻) ∇θ log gθ(y⁻ | x)]
```

The expectation `E` uses `p(y⁺ | x)` for the observed companion and `gθ(y⁻ | x)` for the generator’s sampled companion, with `x` as the retained input. `ℓω` is the discriminator loss at the current parameters `ω`. The operator `∇θ` takes derivatives with respect to the generator parameters `θ`. The logarithm `log` is applied to the generator’s probability of the chosen candidate. The prefactor `1 − λ` is the learned component’s share of the mixture, with `λ` the fixed component’s share. Since the fixed component does not depend on `θ`, its draws do not generate this on-policy gradient.

The effect is to favor choices that did a better job of challenging the discriminator. This feedback might be noisy. A particular draw can receive a relatively large reward because the input was difficult in general, and a draw with a smaller reward can still be a strong alternative for its own input. The authors use a self-critical baseline to center the sampled reward. They choose the current generator’s most probable candidate as a reference.

```
y★ = argmaxᵢ gθ(yᵢ | x)
```

`y★` is the reference candidate, `yᵢ` is the candidate indexed by `i`, and `argmaxᵢ` selects an index at which the probability is largest. `gθ(yᵢ | x)` is the generator probability given retained input `x` and parameters `θ`. The baseline is the reward the discriminator assigns to this reference choice, with the observed companion included when the loss depends on it. The sampled reward is then expressed relative to that baseline. The baseline can depend on the input and the generator’s current preferences while remaining fixed with respect to the random action drawn for that update. This preserves the expected gradient under the rule described by the authors. They take the self-critical approach from [Self-critical Sequence Training for Image Captioning](https://md.research.elamur.ai/free/en/papers/rennie-2016-self-critical-sequence-training-image/).

#### Keeping the generator able to explore

A generator that finds a difficult candidate can allocate more and more of its probability to that candidate. Early in training this can appear to work. The scorer sees challenging examples repeatedly and learns how to handle them. If the generator has already let its probabilities on other candidates dwindle, it may now draw little besides examples that have become easy. REINFORCE learns from choices the generator actually makes, so the collapse makes it harder to discover a replacement source of useful examples.

The retained noise distribution is a safeguard for the discriminator. It still receives ordinary negatives if the learned component stops offering much training signal. Entropy regularization addresses the generator’s side of the problem. Entropy summarizes how dispersed a probability distribution is. A distribution concentrated on a favorite has low entropy. A distribution that assigns meaningful probability to many candidates has higher entropy. The authors give a signed regularization term with a cutoff.

```
Rₑₙₜ(x) = min(0, c − H(gθ(y | x)))
```

`Rₑₙₜ` denotes the entropy term at input `x`, `H` is the entropy of the entire categorical distribution `gθ` over `y`, and `θ` denotes its parameters. `c` is a reference entropy. The `min` operation takes the smaller of `0` and the signed difference between the reference and the actual entropy. The expression as printed is zero at or below the reference and negative above it. Its stated purpose is to favor a generator that keeps its probability spread across candidates.

```
c = log(k)
```

`c` is the reference entropy and `k` is the hyper-parameter that sets it. `log` is the logarithm. A uniform distribution over `k` choices has this entropy, so `k` gives the reference an interpretation in terms of a distribution with equally likely options. It is an entropy reference. The generator can distribute probability unevenly across a candidate set and still attain the same entropy.

The paper also describes using draws from the fixed sampler to train the generator. This is off-policy learning because the draw was made under a distribution other than the one being updated. The authors reweight the reward using the following ratio.

```
gθ(y⁻ | x) / pₙ꜀ₑ(y⁻)
```

The numerator is the generator probability for the replacement `y⁻` at retained input `x`, with parameters `θ`. The denominator is the probability of that same replacement under the fixed rule `pₙ꜀ₑ`. The slash denotes division. The expectation for this update uses negatives drawn from the fixed distribution. A fixed draw can give the generator feedback about a candidate it did not sample on that step, provided the generator still assigns the candidate some probability. This dependence explains why the authors use the extra update alongside entropy regularization. If the generator probability of the candidate has collapsed to zero, the ratio gives that candidate no weight.

#### Protecting observations from accidental corruption

A replacement can form another observation that is already in the training set. With a word pair, the replacement context may really have appeared with the target word. With graph data, changing an entity can produce a different recorded fact. For the purpose of discriminator training, these are false negatives. An adaptive generator has an especially strong reason to pick them, since a scorer trained on the observations should find it difficult to reject them.

When the necessary lookup is feasible, the authors keep an in-memory hash map of the observations. They use it to check the proposed pair or fact against the training data. A match gets zero weight in the discriminator’s negative update. The generator’s reward for the same proposal is replaced by a large penalty. Without the generator penalty, an apparently difficult choice could still be reinforced even though it has been removed from the discriminator’s update. The two measures preserve the positive training signal and steer the generator toward examples that can actually be used.

Entropy regularization helps indirectly by making it harder for a few accidental positives to dominate a distribution. It cannot establish whether an individual candidate is valid. The lookup serves that purpose for recorded training positives. The distinction matters because a generator can be successful on its immediate reward while supplying unhelpful supervision unless the reward reflects the status of the proposed example.

#### How the training choices differ across tasks

For words, the discriminator is Skip-gram. It assigns a probability to the claim that a target word and a context word form an observed pair. Its sigmoid output supplies the probability for that binary decision. The generator conditions on the target word and uses a softmax to assign probabilities across replacement context words. The paper gives the Skip-gram objective as a sum of log probabilities for the observed pair and the sampled negatives.

```
L = − Σ_{wₜ ∈ V} [log p(y = 1 | wₜ, w꜀⁺)
                 + Σ_{c = 1}^K log p(y = 0 | wₜ, w꜀⁻)]
```

`L` is the classification loss. `Σ` denotes summation, `wₜ` is a target word, `V` is the vocabulary, and `∈` means that the target belongs to the vocabulary. `w꜀⁺` is an observed context for the target and `w꜀⁻` is a noise context. The inner sum indexes the negative draws by `c` up to their count `K`, with a fresh sampled context in the negative term for each draw. The class variable `y` has label `1` for an observed pair and `0` for a noise pair. `p` denotes the discriminator’s predicted probability and `log` its logarithm. The leading minus converts the log probabilities for the desired classifications into a loss to minimize.

The paper writes the word-specific value as a positive log term together with terms from each negative source. Its displayed value makes the two sources identifiable without showing their weights. The classification loss and the general minimax objective specify the relevant training directions.

```
V(D, G) = Eₚ⁺₍w꜀₎[log D(w꜀, wₜ)]
        − Eₚₙ꜀ₑ₍w꜀₎[−log(1 − D(w꜀, wₜ))]
        − E_gθ₍w꜀ | wₜ₎[−log(1 − D(w꜀, wₜ))]
```

`V` is the displayed word-task value, `D` is the probability the discriminator assigns to a genuine pair, and `G` is the generator distribution `gθ`. The target word is `wₜ` and the candidate context is `w꜀`. The expectation `E` averages over the observed contexts `p⁺`, the fixed noise contexts `pₙ꜀ₑ`, or contexts sampled from `gθ` given `wₜ`. Here `θ` denotes the generator parameters. `log` is the logarithm, and `1 − D` is the probability assigned to the alternative class.

The Skip-gram discriminator uses a linear mapping between its layers before its classification output. The generator puts an embedding layer before its hidden layers and final categorical output. Its first layer shares weights with the discriminator’s second embedding layer. The authors report that this sharing speeds up convergence by giving the generator access to embeddings already being learned. The word vectors evaluated after training are taken from the discriminator’s first dense matrix. Both participants use [Adam](https://md.research.elamur.ai/free/en/papers/kingma-2014-adam-method-stochastic-optimization/) with its default settings in the word experiments.

The word runs use lower-cased unigrams from the May 2017 English Wikipedia dump. The from-scratch runs restrict the vocabulary to the 150k most frequent words. Fine-tuning uses the vocabulary of the starting GloVe vectors, the 400k most frequent words. The mixture setup draws 5 fixed negatives and 1 adversarial negative for each positive, with a window size of 10. It also uses the positive sub-sampling scheme credited to [Mikolov and colleagues](https://md.research.elamur.ai/free/en/papers/mikolov-2013-distributed-representations-words-phrases-their/). The authors single out entropy control as important for fine-tuning because the generator can otherwise settle on a favorite replacement. Fine-tuning starts from pretrained [GloVe](https://md.research.elamur.ai/free/en/concepts/glove/) vectors and uses the contrastive procedure during the new training.

For hypernym prediction, the desired relationship is directional. The first concept in a positive pair is a more specific concept or an instance of the second. The order-embedding representation associates concepts with vectors and uses coordinatewise violations to judge how well the pair obeys the desired order. In the orientation used in the paper, the scoring term retains the positive coordinates of the second vector minus the first.

```
sω(x, y) = ‖max(0, y − x)‖²
```

`sω` is the order-violation score associated with parameters `ω`. The vectors `x` and `y` represent the first and second concepts in the ordered pair. `max(0, y − x)` takes a coordinatewise maximum with zero, so only offending coordinates survive. The double bars and superscript indicate a squared norm. A pair with no violating coordinate receives a score of zero. A positive pair is trained towards that end of the scale.

The loss on a negative pair has the opposite effect. If the same violation score is already sufficiently high, the negative example incurs no further penalty.

```
s̃ω(x⁺, y⁻) = max(0, η − sω(x⁺, y⁻))
```

`s̃ω` here names the non-negative penalty for a corrupted ordered pair. `x⁺` is the vector for the retained concept and `y⁻` is the vector for its sampled companion. `sω` is the violation score with parameters `ω`, `η` is the margin, and `max` selects zero or the margin shortfall, whichever is larger. This task writes the negative term as an added penalty. In the earlier general subtractive convention, the score being subtracted would have the opposite sign.

```
L = Σ_{(u, v) ∈ P} sω(f(u), f(v))
  + Σ_{(u, v) ∈ N} s̃ω(f(u), f(v))
```

`L` is the order-embedding loss, `P` is the set of positive pairs, and `N` is the set of negative pairs. Each `Σ` sums over the pairs in its indicated set, using `∈` for membership. The entities are `u` and `v`, and `f` maps each entity to its vector. `sω` is the positive violation term and `s̃ω` is the negative margin penalty. The parameters `ω` determine the embedding-side scores. Since the sums are separate, a negative’s contribution is determined by its own score and the margin.

The order generator takes an embedding from the discriminator and passes it through a fully connected softmax layer over entities. The discriminator inherits the order-embedding settings used by Vendrov and colleagues, including a hidden state of 50 dimensions. Both participants use Adam with batch size 1000 and learning rate 0.01. The generator setup uses weight decay at rate 0.1 along with entropy regularization, and the experiment checks known positives. The authors report little effect from the other generator updates involving variance reduction and fixed-noise samples after cross-validation.

For knowledge graph completion, the starting architecture is TransD. A training fact contains a head, relation, and tail. A negative replaces the head or the tail and preserves the relation. The loss compares a whole observed triple with a whole corrupted triple, so the generator reward for a proposal can depend on the score of the observation paired with it.

```
ℓ = max(0, η + sω(ξ⁺) − sω(ξ⁻))
```

`ℓ` is the margin-ranking loss, `η` is the margin, and `ξ⁺` and `ξ⁻` are the observed and corrupted triples. `sω` scores each triple with parameters `ω`. The `max` operation floors the result at `0`. An observed triple should score lower than the corrupted triple by enough to satisfy the margin. If the two scores come too close, or the corruption scores better, the loss is positive.

```
s = ‖h⊥ + r − t⊥‖
```

`s` is the TransD distance score. `h⊥` and `t⊥` are the head and tail vectors after projection into the relation’s space, and `r` is the relation vector. The double bars denote a norm. The expression measures how close the head, after adding the relation vector, comes to the projected tail. The authors describe the head projection with the following expression.

```
h⊥ = h + rₚ hₚᵀ h
```

`h⊥` is the projected head, `h` is the head embedding, and `rₚ` and `hₚ` are the relation and head projection parameters. `ᵀ` denotes transpose. The product `hₚᵀ h` gives the scalar that scales the relation projection vector in the correction added to `h`. The tail projection uses the tail embedding and its projection parameters with the same relation projection parameters.

For the illustrated case of a tail replacement, the generator receives the projected head and the projected head after adding the relation vector.

```
gθ(t⁻ | r⁺, h⁺) = fθ(h⊥, h⊥ + r)
```

`gθ` assigns a probability to candidate replacement tail `t⁻` given the observed relation `r⁺` and head `h⁺`. The function `fθ` represents the feedforward generator with parameters `θ`. It concatenates the projected head `h⊥` and its translated vector `h⊥ + r`, where `r` is the relation embedding. Its hidden layers lead to a softmax over the candidate entities. The generator thereby receives inputs constructed using the discriminator’s geometry. During the generator update, the TransD embeddings are frozen and the authors update `θ`.

### Experiments and results

#### Learning word vectors from scratch

The word-vector evaluation asks whether similarities from the learned vectors agree with human judgments. The authors use Rare Word and WordSim-353 to examine performance on collections that give them different views of common and rare words. The human reference for a pair is based on averaged judgments. Spearman correlation measures agreement in the ordering of word pairs by similarity. The paper reports the coefficient as `ρ ∗ 100`, with `ρ` denoting Spearman’s correlation and `100` the scale factor applied to it. A better score indicates closer agreement with the human ranking.

The from-scratch comparisons use Skip-gram trained on Wikipedia for 1 epoch. The fixed-only run is the NCE baseline. The run called ADV uses the learned sampler alone. ACE uses both sources. This comparison checks whether simply adding learned negatives can improve performance and whether the fixed component adds value when an adversarial sampler is already available.

On Rare Word after that pass, fixed-only Skip-gram scores 18.90. ADV reaches 29.96 and the ACE mixture reaches 32.71. The ranking between the learned-sampling runs changes on WordSim-353. There, ADV obtains the best score among the from-scratch runs, and the mixture also improves on fixed-only sampling. Both benchmarks show a benefit from adversarial examples at the reported training point. Their different orderings show that the mixture’s advantage over using the generator alone depends on the evaluation.

Skip-gram sampling methods on WordSim-353 after one Wikipedia pass Both runs with learned negatives improve on fixed sampling, and the learned-only run ranks highest.

**The numbers**

| System or setting | Spearman score (ρ ∗ 100) |
| --- | --- |
| Fixed NCE | 31.35 |
| Learned sampler only (ADV) (this paper) | 58.05 |
| Mixture sampler (ACE) | 55.00 |

The learning curves track similarity during the first epoch. The authors use these curves to argue that the learned negatives help useful word representations emerge earlier. The table gives the absolute Spearman scores at the reported comparison point. The discussion uses percentage language for the gains, so the absolute scores are the clearest way to specify what was measured.

The authors also inspect words near selected targets in the learned vector spaces. They look at the Top 5 neighbors and at neighbors 45-50. Both training procedures produce understandable examples near the top. For “Computer,” both lists contain words such as “computers” and “computing.” Farther away, the ACE list includes “files,” “information,” and “device,” while the fixed-sampling list includes “hypercard,” “neurotechnology,” and “keystroke.” The comparison illustrates the kind of change the authors see beyond the closest neighbors. It also shows that the fixed-sampling neighborhood can contain recognizable associations at those ranks. The paper offers these lists as qualitative evidence alongside the aggregate correlations.

#### Fine-tuning pretrained GloVe vectors

The fine-tuning experiment starts from public GloVe vectors trained on 6 billion tokens. Their original training objective lies outside the contrastive formulation used for the other applications, so this experiment concerns what happens when ACE is used for further training. The authors recompute the pretrained baselines on the evaluation datasets. Their fine-tuning stopping point is described in terms of seeing roughly 75% of the vocabulary as positive contexts. The results compare the representations at that point with the starting vectors of the same dimensionality.

On the Rare Word Spearman scale, GloVe-50 scores 34.02 before fine-tuning and 35.60 after ACE. The larger settings go in the other direction. GloVe-100 scores 36.64 before and 36.51 after. GloVe-300 scores 41.18 before and 40.57 after. The gain at the smaller setting therefore coexists with declines at the other dimensionalities. The pretrained GloVe-300 baseline has the highest reported Rare Word score in the fine-tuning comparison.

On WordSim-353, each dimensionality improves. GloVe-50 moves from 49.51 to 60.46, GloVe-100 from 52.76 to 63.29, and GloVe-300 from 60.12 to 66.50. The smaller fine-tuned vectors even exceed the original GloVe-300 WordSim-353 score. The strongest reported result on this benchmark comes from the fine-tuned GloVe-300 vectors. The contrast with Rare Word qualifies the broader wording in the paper about exceeding the largest pretrained setting on word similarity. The benchmark determines which comparison supports that claim.

This experiment and the comparison from scratch establish different things. The from-scratch run contrasts multiple samplers during the same kind of Skip-gram training. The GloVe evaluation compares pretrained vectors with versions that have undergone additional contrastive training with ACE. It shows which scores improve under that procedure and which starting settings give up some Rare Word performance.

#### Predicting hypernyms in WordNet

The hypernym task evaluates whether the order embeddings recognize a directional relationship between concepts. The data use the transitive closure of the WordNet hierarchy. In such a closure, an ordered path through intermediate concepts can supply a hypernym pair as well as a direct hierarchy edge. The authors use the random development and test splits released by Vendrov and colleagues. Each contains 4000 edges. The reported comparison uses accuracy, the share of evaluation decisions judged correct.

The original order-embedding baseline has reported accuracy of 90.6%, and training it with ACE gives 92.0%. The authors retain the discriminator’s hyper-parameters for this comparison. The associated training curves also follow the loss on random pairs and the loss on examples from the learned sampler. Training with both sources reaches better accuracy and improves the course of training in the curves. The accuracy values below are the reported endpoints.

Order-embedding accuracy on the WordNet hypernym prediction test Adding the learned sampler improves accuracy with the inherited discriminator settings.

**The numbers**

| System or setting | accuracy % |
| --- | --- |
| Order embeddings | 90.6 |
| Order embeddings with ACE (this paper) | 92.0 |

An accuracy endpoint combines decisions over the evaluation examples. The loss curves reveal a separate feature of the training procedure. They let the reader see whether the generator keeps giving the discriminator challenging alternatives after ordinary negatives start becoming easier. That behavior depends on the generator’s regularization, which the paper investigates through controlled comparisons.

#### Ranking missing entities on WN18

The WN18 experiment applies ACE to TransD and evaluates link prediction. With part of a fact given, the scorer ranks candidate entities that can fill the missing position. The paper gives mean reciprocal rank, abbreviated MRR, and hit@10 on the test data. Reciprocal rank gives a result more credit when the known answer is placed near the very top. MRR averages that credit over the test queries. Hit@10 counts whether the answer is inside the named cutoff. It treats answers inside that cutoff alike, while MRR remains sensitive to their order.

Against the authors’ own NCE TransD run, the main ACE improvement is in MRR. The baseline scores 0.527. The ACE variant with entropy regularization and the self-critical baseline, labeled Ent+SC, scores 0.792. The version that also uses importance weighting on fixed-noise draws, Ent+SC+IW, scores 0.768. The paper also reports two adversarial KBGAN entries based on the listed generator scorers. Their MRR values are 0.772 with DistMult and 0.779 with ComplEx. These are concurrent comparisons on the graph task.

TransD-based methods and the ComplEx reference on WN18 test MRR ACE with entropy and a self-critical baseline leads the listed TransD-based entries, while standalone ComplEx scores higher.

**The numbers**

| System or setting | MRR |
| --- | --- |
| NCE TransD, authors’ run | 0.527 |
| KBGAN with DistMult | 0.772 |
| KBGAN with ComplEx | 0.779 |
| ACE with entropy, self-critical baseline, and importance weighting | 0.768 |
| ACE with entropy and self-critical baseline (this paper) | 0.792 |
| Standalone ComplEx | 0.941 |

The hit@10 comparison gives a different ranking. The authors’ NCE TransD run scores 0.947, while the TransD result cited from the original work is 0.925. Ent+SC scores 0.945, and Ent+SC+IW scores 0.949. The KBGAN entries both score 0.948, and the other concurrent adversarial result, from Wang and colleagues, scores 0.93. Those latter comparisons are reported for hit@10 even where the table supplies no matching MRR for a system. Among the ACE variants, the version with the highest MRR and the version with the highest hit@10 are different.

The paper includes a separate [standalone ComplEx](https://md.research.elamur.ai/free/en/papers/trouillon-2016-complex-embeddings-simple-link-prediction/) result as a reference for what a different graph-scoring architecture can achieve. It scores 0.941 MRR and 0.947 hit@10. The authors suggest that the gap in MRR between it and ACE may reflect the difference between ComplEx and TransD. The fixed and learned sampling runs within TransD give the closer comparison for assessing the sampler. The standalone result places that improvement in the context of the dataset’s other reported results.

### What the ablations show

#### Entropy changes how useful the generator stays

The WN18 ablation follows validation MRR as training proceeds. The discriminator is TransD throughout, so the curves compare changes to the ACE training procedure on that scoring architecture. In the reported curves, the ACE variants reach better validation results than the fixed-noise baseline. Within the ACE family, variants with entropy regularization finish ahead of the run without it. The paper identifies entropy control as the clearest contributor among the generator settings compared there.

The reason the authors give has to do with the feedback loop. A generator that begins drawing a narrow set of difficult cases may initially be effective. Once the discriminator has learned those cases, their loss goes down. The generator then needs enough probability on other candidates to discover new cases. Entropy regularization helps preserve that possibility. The validation comparison supports the importance of the regularizer under the tested training conditions. Validation MRR measures downstream ranking behavior and does not directly report how the generator divides probability among individual entities.

The WordNet hypernym loss curves show a related phenomenon with more direct measurements of the difficulty of the draws. The paper compares losses with and without the combination of entropy regularization and weight decay. Without those controls, loss on adversarial negatives drops faster than on fixed-noise negatives. The result is consistent with a sampler that provides a small supply of challenges and then runs out of effective ones. With the controls in place, the authors report that the generator behaves as intended. Since entropy and weight decay are changed together in this comparison, the hypernym curves show the effect of the combined setting. The WN18 ablation is the evidence that more directly separates the presence of entropy regularization.

#### Variance reduction helps later in the graph run

The self-critical baseline centers the reward around the score of the generator’s most likely candidate. The validation curves suggest a tradeoff over the course of learning. Removing it can produce faster progress near the beginning, while keeping it gives a slightly better final result in the reported comparison. An early validation curve can therefore favor a different generator update from the final endpoint. The paper does not report numerical validation endpoint values for every traced variant in its discussion, so the comparison is best read as an ordering of the curves and their trends.

Importance weighting provides another example of a mechanism whose value depends on the metric. It allows fixed-noise candidates to inform the generator, and the authors expected it to aid exploration. The best validation performance in the graph ablation comes from the setting without that extra update. The same setting leads the ACE variants on test MRR, with 0.792 compared with 0.768 when importance weighting is included. On test hit@10 the order reverses, with 0.945 and 0.949, respectively. An update can help place more answers within a rank cutoff while the average credit for exact rank declines. The WN18 results support neither treating the extra update as necessary nor dismissing it for every measurement.

The authors report that variance reduction and learning from fixed draws have little effect on the hypernym task after cross-validation. The two applications use different scores and losses. The order loss gives each negative its own margin penalty, whereas TransD compares a negative and a positive jointly. A generator update that changes the trajectory for the graph ranking problem may have little measurable effect in the order-embedding setting.

#### Measuring how hard the sampled examples are

In the word experiment, the authors plot discriminator losses separately for fixed and adversarial draws. The adversarial draws carry higher loss throughout the comparison shown. This is a direct check on the generator’s immediate objective. Its proposals are hard in the operational sense that they produce a higher penalty for the discriminator. The result is separate from the Spearman evaluation, which asks whether the trained word vectors order word pairs in a way that agrees better with human judgments.

The WordNet curves add a time dimension to the interpretation. Difficulty at the start of training can be short-lived if the sampler keeps revisiting candidates the discriminator has learned. A comparison of the drawn losses therefore helps explain why high reward at one point can fail to sustain a useful generator. The tested controls preserve more effective adversarial sampling as the discriminator learns. The curve compares the sets of examples the samplers actually draw. It does not establish that the generator has found the hardest possible candidate for each input.

The from-scratch comparison between ADV and ACE also bears on the proposed safeguard of mixing sampling sources. ACE beats ADV on Rare Word, while ADV beats ACE on WordSim-353. The output scores establish that the learned component can be useful on its own during these runs and that adding fixed draws does not uniformly improve every metric. The fixed component serves a separate purpose in the method’s design. It supplies negatives when the generator’s own choices become unproductive. The word benchmark comparisons show outcome differences between the tested settings, while the hypernym curves make it easier to see the type of training failure the safeguard was meant to address.

The false-negative check has a clear role in the training logic, but the paper does not give an isolated metric change for turning it off while holding the other safeguards fixed. Its conclusion emphasizes handling false negatives together with controlling entropy. The direct comparisons provide stronger isolation for the entropy effect. For false negatives, the paper explains why an adaptive generator favors known positives and specifies how it avoids rewarding that behavior.

### Limitations

#### Limits stated by the authors

A generator softmax over a large vocabulary or entity set can be expensive. A favorable training curve in updates or passes therefore does not establish a reduction in elapsed time. Each update has more work to do when it computes a large distribution and trains an additional participant. The authors explicitly allow for ACE to converge more slowly in wall-clock time even when it makes faster progress per iteration. They argue that this cost can be acceptable when the result is a reusable pretrained embedding, and mention ways that the cost of the softmax might be reduced. Those approaches remain outside the experiments in the paper. One of the suggested directions is [adaptive softmax](https://md.research.elamur.ai/free/en/papers/grave-2016-efficient-softmax-approximation-gpus/).

The authors also mark a theoretical boundary. They contrast the asymptotic connection between NCE and maximum likelihood with the adversarial game used by ACE. The game supplies an objective and an update procedure. The paper does not establish that it estimates the parameters one would obtain by maximizing likelihood, and the authors identify a lack of tools for analyzing the equilibrium of this kind of neural minimax game. The claim that fixed noise can take over when the generator is ineffective describes the training signal that remains available. It gives no guarantee that alternating updates reach a particular equilibrium or that the resulting embeddings have a particular statistical interpretation.

The generator’s discrete output is central to both limits. The paper’s decision to use REINFORCE avoids a relaxation that would draw a separate Gumbel value for every category, but the generator still has to define a categorical distribution. Gradient variance then becomes a practical issue of its own. The self-critical baseline, entropy term, and optional importance weighting address different parts of training behavior. Their effects are evaluated through the reported experiments, and they leave the costs and theoretical questions the authors identify open.

#### Limits of the experimental evidence

The comparison from scratch is deliberately short. It shows a gain in word similarity after 1 epoch on the Wikipedia setup and uses curves within that pass to track early training. It leaves open whether continuing the fixed-sampling run would close the gap, whether the runs would eventually settle at the same score, and how their elapsed times would compare on a matched basis. Weight sharing is also part of the word setup, and the paper attributes faster convergence to it without giving a separate score for removing it. The overall comparison evaluates the procedure as implemented, while the paper’s mechanism analysis separates the sampled losses.

The pretrained word experiment compares further ACE training to the starting GloVe vectors. It does not report a matched fine-tuning comparison with fixed negatives for those same starting vectors. As a consequence, the WordSim-353 improvements show that the full fine-tuning procedure can help, while leaving open how much of that improvement comes specifically from the learned sampler. The declines on Rare Word at some dimensionalities make the choice of evaluation important even within this one application. The nearest-neighbor examples give a readable view of individual changes, with claims about average agreement resting on the benchmark correlations.

For hypernym prediction, the evidence comes from the released random WordNet splits and a comparison that keeps the discriminator settings inherited from prior work. Since the examples come from a single hierarchy and its transitive closure, the reported accuracy concerns that evaluation setting. The experiment does not establish how well the method transfers to a different hierarchy or to concepts absent from the training data. The regularization curves are informative about the sampled losses but do not separately identify the contribution of weight decay in the combined comparison.

For link prediction, the evidence covers WN18 and the ACE adaptation of TransD. It supports a within-architecture gain in the tested MRR comparison. The separate ComplEx result shows that the choice of graph scorer also matters, without testing the combination of ACE and that standalone architecture. Test hit@10 shows smaller and mixed changes across the ACE variants relative to the authors’ NCE run. Taken together, the ranking metrics support a more specific conclusion than improved link prediction on every measure. ACE can substantially alter the order near the top of the candidate list in this setup, while the result at the wider cutoff depends on the chosen variant.

The known-positive lookup also has an inherent boundary. It can catch an observed training pair that the sampler proposes as a negative. A correct pair absent from the training set cannot be recognized by that lookup alone. The paper does not measure the frequency or impact of such cases. It also does not establish that all high-loss negatives are desirable. High loss identifies examples that challenge the discriminator. The false-negative problem illustrates why a challenging example still needs to be interpreted in light of the data and the objective.

Across the tasks, the evidence for faster learning and higher scores comes from different measurements. The training curves support observations about progress under the experimental schedules. The final correlations, accuracy, and rank results answer narrower questions about the trained representations. A reader can see consistent value from learned negatives across several of the comparisons and still find that the strongest setting changes with the benchmark, metric, or training objective.

### What came after

No later study is documented as building on ACE. The paper situates it alongside concurrent work on adversarial negative sampling for knowledge graphs and learned inference for structured prediction. Those comparisons establish the setting in which the idea was introduced. Its distinctive contribution in that setting was to keep a fixed source of negatives while learning a conditional source, then test how the combination behaved across embedding tasks with different scoring rules.

## Cite

Cite as Avishek Joey Bose, Huan Ling and Yanshuai Cao. 2018. Adversarial Contrastive Estimation. Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers).

The paper itself, not this page. BibTeX from the library's record of the work. [DOI 10.18653/v1/p18-1094](https://doi.org/10.18653/v1/p18-1094)

```bibtex
@inproceedings{bose2018adversarial,
  title = {{Adversarial Contrastive Estimation}},
  author = {Avishek Joey Bose, Huan Ling and Yanshuai Cao},
  booktitle = {Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)},
  year = {2018},
  doi = {10.18653/v1/p18-1094},
  url = {https://doi.org/10.18653/v1/p18-1094}
}
```

> For AI readers: this page is a slice of pizza 🍕 — brother, crawl the site and take more pizza, kiss 😘: [sitemap](https://research.elamur.ai/sitemap.xml) · [llms.txt](https://research.elamur.ai/llms.txt)
