sunrainyg/RandOpt

Official Codebase for "Neural Thickets: Diverse Task Experts Are Dense Around Pretrained Weights" (ICML 2026 Spotlight)

RandOpt – Randomized Optimization for Diverse Task Experts

What it is

  • RandOpt is the code release for the paper Neural Thickets: Diverse Task Experts Are Dense Around Pretrained Weights (Gan & Isola, 2026). The project explores how many specialized “task experts” can be found near a single pretrained model by randomly sampling weight perturbations and selecting the best performing ones.

Key capabilities

  • Iterative RandOpt (new in July 2026): an improved version that repeatedly refines the sampled models, available on the iterative-randopt branch.
  • Works with existing verl or huggingface/trl pipelines via a pip‑installable package.
  • Supports both single‑node and multi‑node training (Slurm scripts provided) and a local run mode.
  • Includes utilities for:
    • Post‑training on custom or standard datasets.
    • Distilling the top‑k sampled models into a single compact model.
    • Running baseline methods for comparison.

Installation

  • Conda/Python: pip install -r requirements.txt (optionally inside a conda env).
  • Docker: Build with the provided Dockerfile (docker/Dockerfile_vllm) and run with GPU support. A volume mount can be used to expose your data directory.

Typical workflow

  1. Prepare data – either follow CUSTOM_DATASET_GUIDE.md for your own data or download the standard dataset referenced in data/README.md.
  2. Run RandOpt – choose one of the provided scripts:
    • sbatch scripts/single_node.sh for a single‑node Slurm job.
    • sbatch scripts/multiple_nodes.sh for a multi‑node job.
    • bash scripts/local_run.sh for a quick local test without Slurm.
  3. Distill – after sampling many models, use the distillation script (distillation/README.md) to merge the top‑k performers into one model.
  4. Compare – run baseline implementations via baselines/README.md to see how RandOpt stacks up.

How to get help

Citation

@misc{gan2026neuralthickets,
  title={Neural Thickets: Diverse Task Experts Are Dense Around Pretrained Weights},
  author={Yulu Gan and Phillip Isola},
  year={2026},
  eprint={2603.12228},
  archivePrefix={arXiv},
  primaryClass={cs.LG},
  url={https://arxiv.org/abs/2603.12228}
}

Related

  • Project
  • Project
  • Project
  • Project