{"id":20832383,"url":"https://github.com/ermongroup/lagvae","last_synced_at":"2025-08-24T13:43:37.750Z","repository":{"id":84350834,"uuid":"135194357","full_name":"ermongroup/lagvae","owner":"ermongroup","description":"Lagrangian VAE","archived":false,"fork":false,"pushed_at":"2018-07-27T18:52:37.000Z","size":60,"stargazers_count":28,"open_issues_count":0,"forks_count":5,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-31T16:09:41.473Z","etag":null,"topics":["generative-adversarial-network","tensorflow","variational-autoencoder","variational-inference"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ermongroup.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-05-28T18:10:47.000Z","updated_at":"2024-01-04T16:23:26.000Z","dependencies_parsed_at":"2023-03-04T10:00:11.886Z","dependency_job_id":null,"html_url":"https://github.com/ermongroup/lagvae","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ermongroup%2Flagvae","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ermongroup%2Flagvae/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ermongroup%2Flagvae/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ermongroup%2Flagvae/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ermongroup","download_url":"https://codeload.github.com/ermongroup/lagvae/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252979458,"owners_count":21835058,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["generative-adversarial-network","tensorflow","variational-autoencoder","variational-inference"],"created_at":"2024-11-18T00:11:40.657Z","updated_at":"2025-05-08T01:21:18.939Z","avatar_url":"https://github.com/ermongroup.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Lagrangian VAE\n\nTensorFlow implementation for the paper [A Lagrangian Perspective of Latent Variable Generative Models](https://arxiv.org/abs/1806.06514), UAI 2018 Oral.\n\n[Shengjia Zhao](http://szhao.me), [Jiaming Song](http://tsong.me) and [Stefano Ermon](http://cs.stanford.edu/~ermon), Stanford Artificial Intelligence Laboratory\n\n## Overview\n\nIn this paper, we generalize the objective of latent variable generative models to two targets:\n- Primal Problem: \"mutual information objectives\", such as maximizing / minimizing mutual information between observations and latent variables.\n- Constraints: \"consistency\", which ensures that the model posterior is close to the amortized posterior.\n\n**Lagrangian VAE** provides a practical way to find the best trade-off between \"consistency constraints\" and \"mutual information objectives\", as opposed of performing extensive hyperparameter tuning. We demonstrate an example over **InfoVAE**, a latent variable generative model objective that requires tuning the strengths of corresponding hyperparameters.\n\nAs demonstrated in the following figure, LagVAE manages to find a near Pareto-optimal curve for the trade-off between mutual informtation and consistency.\n\n![](lagvae.jpg)\n\n## Requirements\n\n- click \n- gputil \n- tqdm\n\n## Files\n\n- `methods/infovae.py`: InfoVAE implementation (does not optimize Lagrange multiplers)\n- `methods/lagvae.py`: LagVAE implementation (optimization of Lagrange multipliers)\n\n## Examples\n\nPlease set environment variables `EXP_LOG_PATH` and `DATA_PREFIX` for logging experiments and downloading data prior to running the examples.\n\n- InfoVAE: `python examples/infovae.py --mi=1.0 --e1=1.0 --e2=1.0`\n- LagVAE: `python examples/lagvae.py --mi=1.0 --e1=86.0 --e2=5.0`\n\nNote that we scale up MMD by 10000 in the implementation, so `--e2=5.0` for LagVAE means MMD \u003c 0.0005.\n\nFeel free to play around with different `VariationalEncoder`, `VariationalDecoder`, optimizers, and datasets.\n\n## References\n\nIf you find the idea or code useful for your research, please consider citing our paper:\n```\n@article{zhao2018the,\n  title={The Information Autoencoding Family: A Lagrangian Perspective on Latent Variable Generative Models},\n  author={Zhao, Shengjia and Song, Jiaming and Ermon, Stefano},\n  journal={arXiv preprint arXiv:1806.06514},\n  year={2018}\n}\n```\n\n## Acknowledgements\n\n`utils/logger.py` is based on an implementation in [OpenAI Baselines](https://github.com/openai/baselines).\n\n## Contact\n\n`tsong [at] cs [dot] stanford [dot] edu`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fermongroup%2Flagvae","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fermongroup%2Flagvae","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fermongroup%2Flagvae/lists"}