Run A DARTS Search
This tutorial shows the intended end-to-end DARTS workflow in ForeBlocks: configure a search trainer, run a small multi-fidelity search, inspect the promoted candidates, and optionally analyze the final run.
Install
Core DARTS workflow, including the analyzer:
bash
pip install "foreblocks[darts]"At this point you have a search controller, not just a single model. It knows how to generate candidates, train searched models, derive discrete architectures, and retrain the best one.
Step 2: run a small multi-fidelity search
python
results = trainer.multi_fidelity_search(
train_loader=train_loader,
val_loader=val_loader,
test_loader=test_loader,
num_candidates=12,
search_epochs=8,
final_epochs=40,
max_samples=32,
top_k=4,
use_amp=False,
)The most useful keys are:
final_model: retrained fixed modelbest_candidate: the promoted/search-trained winnerfinal_results: metrics and training informationtrained_candidates: per-candidate search artifacts
Step 4: save the winning discrete model
python
trainer.save_best_model("best_darts_model.pth")Bilevel search for one candidate
python
from darts import DARTSTrainConfig
train_config = DARTSTrainConfig(
epochs=15,
arch_learning_rate=3e-3,
model_learning_rate=1e-3,
)
search_run = trainer.train_darts_model(
model=candidate_model,
train_loader=train_loader,
val_loader=val_loader,
train_config=train_config,
)Retrain that fixed model
python
final_run = trainer.train_final_model(
model=fixed_model,
train_loader=train_loader,
val_loader=val_loader,
test_loader=test_loader,
epochs=50,
)Use this when you want:
- architectural feature summaries
- simple statistical inspection of promoted candidates
- plots that help explain why some candidates won
Reading the result like a practitioner
Focus on these questions:
- Did zero-cost ranking surface plausible candidates?
- Did the promoted models improve after short DARTS training?
- Did the final retrained model preserve that advantage?
- Did the search collapse onto one family too early?
If the answer to any of those is no, tighten the search space before you increase the budget.