-
Notifications
You must be signed in to change notification settings - Fork 0
NAS
Gaurav14cs17 edited this page Jun 21, 2026
·
1 revision
Automatically discover efficient model architectures under hardware constraints.
FlashOptim NAS searches for optimal architectures that balance accuracy, latency, and model size.
from flashoptim import SearchSpace, Searcher
search_space = SearchSpace(
channels=[16, 32, 64, 128, 256],
kernel_sizes=[3, 5, 7],
depths=[1, 2, 3, 4],
operations=["conv", "dwconv", "mbconv", "skip"],
)
searcher = Searcher(
strategy="evolutionary",
population_size=50,
generations=30,
)
best_arch = searcher.search(
search_space=search_space,
train_data="data/train/",
val_data="data/val/",
constraints={"max_flops": 1e9, "max_params": 5e6},
)| Strategy | Description | Speed | Quality |
|---|---|---|---|
random |
Random sampling | Fast | Baseline |
evolutionary |
Genetic algorithm | Medium | Good |
bayesian |
Bayesian optimization | Slow | Best |
constraints = {
"max_flops": 1.0e9, # Maximum FLOPs
"max_params": 5.0e6, # Maximum parameters
"max_latency_ms": 10.0, # Target latency
"min_accuracy": 0.85, # Minimum accuracy threshold
}searcher = Searcher(
strategy="evolutionary",
hardware="gpu", # "gpu", "cpu", "mobile", "edge"
latency_lookup_table="latency_lut.json",
)flashoptim nas --config configs/flashoptim_nas_search.yaml- Start with random search to understand the search space
- Use proxy tasks (fewer epochs) for faster evaluation
- Hardware-aware search provides more realistic results
- Population size of 50+ recommended for evolutionary search
FlashOptim — Model optimization toolkit | PyPI | MIT License