{"id":28439922,"url":"https://github.com/divelab/dsearch","last_synced_at":"2025-07-18T12:33:11.350Z","repository":{"id":289333398,"uuid":"942181648","full_name":"divelab/DSearch","owner":"divelab","description":null,"archived":false,"fork":false,"pushed_at":"2025-05-15T21:41:50.000Z","size":41849,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-06-27T10:43:48.631Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/divelab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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,"zenodo":null}},"created_at":"2025-03-03T17:50:00.000Z","updated_at":"2025-06-23T14:48:24.000Z","dependencies_parsed_at":"2025-04-22T19:32:41.885Z","dependency_job_id":null,"html_url":"https://github.com/divelab/DSearch","commit_stats":null,"previous_names":["divelab/dsearch"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/divelab/DSearch","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/divelab%2FDSearch","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/divelab%2FDSearch/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/divelab%2FDSearch/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/divelab%2FDSearch/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/divelab","download_url":"https://codeload.github.com/divelab/DSearch/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/divelab%2FDSearch/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265760817,"owners_count":23824108,"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":[],"created_at":"2025-06-06T03:06:44.816Z","updated_at":"2025-07-18T12:33:11.329Z","avatar_url":"https://github.com/divelab.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# Dynamic Search for Inference-Time Alignment in Diffusion Models (Images)\n\nThis code accompanies the paper on Dynamic Search for Inference-Time Alignment in Diffusion Models (DSearch), where the objective is to maximize downstream reward functions in diffusion models. In this implementation, we focus on generating **images** with high scores.  \n\nNottably, our algorithm is **derivative-free, training-free, and fine-tuning-free**.  \n![image](./media/ddes_intro.png)\n\n![image](./media/ddes.png)\n\n## Code\n\n### Installation\n\nCreate a conda environment following this repo:\n\nhttps://github.com/mihirp1998/AlignProp/\n\nThen do:\n```bash \npip install scikit-learn\n```\n\n### Compressibility  \n\nWe use Stable Diffusion v1.5 as the pre-trained model. We optimize compressibility.  \n\nTest the following for DSearch\n\n### DSearch\n\nDSearch \n```bash\nCUDA_VISIBLE_DEVICES=0 python inference_decoding_nonp.py --reward 'compressibility' --bs 12 --num_images 12 --duplicate_size 5 --variant PM --w 5 --search_schudule exponential --drop_schudule exponential --oversamplerate 5\n```\nDSearch-R\n\nNotes: choose a good replacerate for diversity/reward trade-off, usually 0.01~0.05, but note that we need bs*replacerate\u003e=1. Generate multiple batches.\n```bash\nCUDA_VISIBLE_DEVICES=0 python inference_decoding_nonp.py --reward 'compressibility' --bs 34 --num_images 204 --duplicate_size 5 --variant PM --w 5 --search_schudule exponential --replacerate 0.03\n```\n\n### Baseline SVDD-PM\n\n```bash\nCUDA_VISIBLE_DEVICES=0 python inference_decoding_nonp.py --reward 'compressibility' --bs 12 --num_images 12 --duplicate_size 20 --variant PM\n```\n\nHere is the result.   \n\n![image](./media/comp_trend.png) \n\n\n![image](./media/comp_grid_app.png) \n\n### Aesthetic score  \n\nWe use Stable Diffusion v1.5 as the pre-trained model. We optimize aesthetic scores.  \n\nRun the following command:  \n\n```bash\nCUDA_VISIBLE_DEVICES=0 python inference_decoding_nonp.py --reward 'aesthetic' --bs 12 --num_images 12 --duplicate_size 5 --variant PM --w 5 --search_schudule exponential --drop_schudule exponential --oversamplerate 5\n```\n\nHere is the result.  \n\n![image](./media/aes_trend.png)\n\n![image](./media/aes_grid_app.png)\n\n### Human preference score  \n\nWe use Stable Diffusion v1.5 as the pre-trained model. We optimize human preference scores.  \n\nRun the following command:  \n\n```bash\nCUDA_VISIBLE_DEVICES=0 python inference_decoding_nonp.py --reward 'hps' --bs 12 --num_images 12 --duplicate_size 5 --variant PM --w 6 --search_schudule exponential --drop_schudule exponential --oversamplerate 5\n```\n\nHere is the result.  \n\n![image](./media/HPS-c-plot.png)\n\n![image](./media/hps_grid.png)\n\n### Acknowledgement  \n\nOur codebase is directly built on top of [RCGDM](https://github.com/Kaffaljidhmah2/RCGDM)  \n\n## Reference  \n\nIf you find this work useful in your research, please cite:\n\n```bibtex\n@article{li2025dynamic,\n  title={Dynamic Search for Inference-Time Alignment in Diffusion Models},\n  author={Li, Xiner and Uehara, Masatoshi and Su, Xingyu and Scalia, Gabriele and Biancalani, Tommaso and Regev, Aviv and Levine, Sergey and Ji, Shuiwang},\n  journal={arXiv preprint arXiv:2503.02039},\n  year={2025}\n}\n```\n\n## Acknowledgments\n\nThis work was supported in part by National Institutes of Health under grant U01AG070112.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdivelab%2Fdsearch","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdivelab%2Fdsearch","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdivelab%2Fdsearch/lists"}