AI Glossary / Probabilistic machine learning / Intermediate
Persistent contrastive divergence
Definition
Persistent contrastive divergence, or PCD, is a learning method for energy-based models that maintains sampling chains across parameter updates. It uses these continuing chains to approximate expectations under the model distribution. Unlike ordinary short-run contrastive divergence, it does not restart the negative-phase chains from the current training examples at every update.
What it means
Training a restricted Boltzmann machine involves comparing statistics supported by the data with statistics produced by the model. The model-side expectation is often expensive to compute exactly because it involves many possible states.
PCD keeps a collection of sampled model states, sometimes called fantasy particles, and advances them as learning continues. The hope is that a chain already near the previous model distribution can remain useful after a modest parameter change. Persistence saves repeated restarts, but the chains still need to explore adequately; keeping a poor chain alive does not make its samples representative.
How it works
Estimate the positive-phase statistics using training data and the model's conditional hidden-state distribution. Separately maintain one or more persistent chains for the negative phase. Advance those chains using valid transitions, such as alternating Gibbs updates in a binary restricted Boltzmann machine.
Compute model-side statistics from the updated persistent states and subtract them from the data-side statistics to obtain an approximate likelihood-gradient update. Change the parameters and retain the chain states for the next training iteration.
The model distribution changes during learning, so the chains are tracking a moving target. Learning rate, transition count, number of chains, initialization, and mixing all matter. A small parameter update can help tracking, but it is not a universal guarantee of an accurate gradient or successful training.
Three practical examples
- Restricted Boltzmann machine training: approximate negative-phase feature correlations using chains that continue across mini-batches.
- Energy-model experiments: compare data-restarted and persistent sampling to inspect how the negative-phase approximation changes learned distributions.
- Training diagnostics: monitor chain diversity and model statistics over time to detect when persistent particles remain trapped in a small part of the state space.
Think of it this way
Think of surveyors who continue exploring a landscape as it changes gradually, rather than restarting at the same familiar landmarks every day. Their previous positions can save effort, but they may still fail to reach distant regions. The analogy has limits: the landscape is a probability distribution defined by model parameters, and the sampling rule - not the surveyors' judgment - determines how exploration proceeds.
Worked example
Consider an original scalar weight update in a binary restricted Boltzmann machine with energy containing the term −w v h. The likelihood-gradient contribution for w is the data-side expectation of v h minus its model-side expectation.
Suppose the positive-phase estimate is 0.75. Four persistent negative-phase states after a Gibbs update are (v, h) = (1, 1), (1, 1), (1, 0), and (0, 1). Their v h values are 1, 1, 0, and 0, so the negative-phase average is 0.5.
The estimated gradient is 0.75 − 0.5 = 0.25. With learning rate 0.1 and no other terms, w increases by 0.025. If w was 0.4, it becomes 0.425.
For the next iteration, the chains start from those retained states and advance under the updated model. They are not replaced by the next mini-batch's data examples. The assumed states make the arithmetic easy to verify; they do not prove equilibrium sampling, an unbiased finite-sample gradient, or an increase in the exact likelihood after the update.
Illustrative case study
Fictional case: Hazel Learning compares two restricted Boltzmann machine training procedures on a small research dataset. One restarts short chains from data; the other retains persistent chains. The team examines held-out model behavior and the diversity of negative-phase samples.
Persistent particles initially explore well, but later some chains remain in similar states for long periods. Analysts investigate transition count and parameter-update size rather than assuming that persistence alone resolves mixing. On a tiny model, they compare estimated gradients with exact enumeration. This case illustrates a verification strategy, not a claimed performance result.
Common misconceptions and mistakes
PCD does not mean that chain states remain unchanged. They are retained as starting points and then updated by the sampling procedure.
It is also not the same as performing a long data-initialized chain independently for every mini-batch. Its defining feature is continuity between parameter updates.
The negative phase is not a collection of labeled negative examples. It estimates statistics generated by the current model.
Finally, the original method aims to improve the model-expectation approximation, but finite chains can remain biased or highly correlated. Claims of exactness require assumptions about mixing and learning dynamics, not just a persistent-state implementation.
Business use
For a team maintaining or researching energy-based models, PCD is a practical way to reduce the repeated cost of obtaining model samples. Its value should be assessed through model quality and computational cost together.
Record how persistent states are initialized, updated, and preserved across checkpoints. Inspect whether chains cover relevant modes and compare small cases with exact calculations when feasible. A stable-looking training curve or attractive reconstructed example does not independently establish that the negative phase is sampling the intended distribution.
People also ask
Are fantasy particles training records?
They are model states maintained for sampling; their role is different from the observed examples used in the positive phase.
Does one Gibbs step always suffice?
No. The appropriate amount of sampling depends on mixing and how rapidly the model changes.
Is PCD an exact maximum-likelihood algorithm in ordinary finite training?
Generally no. Its model expectations are approximated by continuing finite chains, so approximation error must be considered.
Check your understanding
A program saves model weights after each mini-batch but reinitializes every negative-phase chain from the new data. Is it implementing persistent contrastive divergence?
Answer: No. Persistence concerns retaining the sampling-chain states across parameter updates, not merely retaining or checkpointing model weights.
Related terms
- Contrastive divergence
- Restricted Boltzmann Machine
- Energy-based model
- Gibbs sampling
- positive phase
- negative phase
- mixing
- stochastic maximum likelihood
Learn next
Review the data-minus-model expectation form of an energy-model gradient. Then trace chain initialization and continuation for ordinary contrastive divergence and PCD. On a model small enough to enumerate, compare negative-phase estimates with exact expectations while varying learning rate and sampling effort.
More in Probabilistic machine learning
- Partial regression - Partial regression examines the linear relationship between an outcome and a predictor after removing the linear contributions of other specified predictors.
- Particle path degeneracy - Particle path degeneracy is the loss of diversity in the earlier parts of trajectories represented by a particle filter.
- Periodic kernel - A periodic kernel is a covariance function that represents repeating relationships in a Gaussian process or another suitable kernel model.
- Perturb-and-MAP sampling - Perturb-and-MAP sampling generates random configurations by perturbing an objective or energy function and then optimizing the perturbed function.
- Poisson regression - Poisson regression models a nonnegative count outcome using a Poisson distribution whose mean depends on predictors.
- Policy gradient theorem - The policy gradient theorem expresses how an agent's expected cumulative reward changes when the parameters of its action-selection policy change.
Sources
Tieleman, Training Restricted Boltzmann Machines using Approximations to the Likelihood Gradient, original paper, university-hosted copy: https://www.cs.cmu.edu/~bhiksha/courses/deeplearning/Fall.2016/pdfs/Tieleman.2008.pdf Tieleman Section 3 persistent-chain initialization, fantasy particles and finite-update approximation were independently consulted.
Previous: Persistent Betti number Next: Persistent failure model