Skip to content

moritzhauschulz/samplingEBMs

Repository files navigation

Training Energy Based Models by Learning to Sample with Discrete Flows

The final manuscript is here: https://raw.githubusercontent.com/moritzhauschulz/samplingEBMs/main/REPORT.pdf

Abstract

Training energy-based models with contrastive divergence is a challenging problem due to the requirement to generate negative samples from the model distribution during training. This is particularly challenging in discrete domains, since conventional MCMC methods cannot exploit gradient information well and convergence is difficult to assess. Discrete flows are generative models that transform a source distribution to a data distribution through continuous time Markov chains, whose rate matrix or generating velocity is parameterized by a neural network. This work attempts to address the challenges in the training of energy based models by using discrete flows. We contribute to the literature on discrete flows, specifically that on discrete flow matching, by proposing to directly learn the generating velocity through a regression loss instead of constructing it at sampling time from learned posteriors. We further employ importance sampling techniques to adapt the method to a data-free setting where beyond the target energy model, only a proposal distribution is available. Equipped with new tools that enable discrete flows to act as learned samplers, we propose and assess three different ways of applying them in the training of energy-based models. We demonstrate that all three have the capacity to learn on relatively low-dimensional synthetic benchmark problems, but find that without the use of MCMC-based refinements, they are not competitive in higher dimensions where suitable proposal distributions are difficult to construct.

Author

Supervisors

  • Yingzhen Li - Imperial College London
  • Zijing Ou - Imperial College London

Methods

Installation and Example

To reproduce the results or use the model, follow these steps:

  1. Clone the repository:

    git clone https://github.com/moritzhauschulz/samplingEBMs.git
  2. Install dependencies:

    pip install -r requirements.txt
  3. Download datasets:

  4. Run example codes (here specified only for toy data, and excluding models that reequire pretrained EBMs):

    bash example_scripts/velo_dfm.sh
    bash example_scripts/velo_dfs.sh
    bash example_scripts/velo_ebm.sh
    bash example_scripts/velo_bootstrap_ebm.sh
    bash example_scripts/velo_baf_ebm.sh
    • Output will appear in nested folders under the respective method for each run.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •