DPO Neural Architecture Search
Project description
DPO-NAS: Direct Preference Optimization for Neural Architecture Search
A state-of-the-art, modular implementation of Direct Preference Optimization (DPO) based Neural Architecture Search (NAS) with ensemble evaluation, adaptive constraints, and island model population diversity. DPO-NAS V2 delivers superior performance across multiple NAS benchmarks while maintaining computational efficiency.
Table of Contents
- Overview
- Key Features
- Performance
- Installation
- Quick Start
- Documentation
- Examples
- Configuration
- Contributing
- License
- Citation
Overview
DPO-NAS implements a novel evolutionary algorithm that combines Direct Preference Optimization principles with advanced NAS techniques. The algorithm uses an ensemble of surrogate models for architecture evaluation, adaptive constraint handling, and an island model for maintaining population diversity.
Algorithm Highlights
- Direct Preference Optimization: Learns from pairwise architecture comparisons to guide search
- Ensemble Evaluation: Combines multiple surrogate models for robust performance estimation
- Adaptive Constraints: Dynamically adjusts resource constraints during optimization
- Island Model: Maintains population diversity through isolated subpopulations
- Multi-Objective Optimization: Balances accuracy, latency, memory, and FLOPs
Key Features
🔬 Advanced Architecture Search
- Gene-based Representation: Flexible architecture encoding with operations, kernels, and skip connections
- Multi-Objective Fitness: Simultaneous optimization of accuracy and resource constraints
- Adaptive Parameters: Self-tuning hyperparameters during optimization
🏗️ Modular Design
- Plugin Architecture: Easily extensible with custom estimators and constraints
- Ensemble Evaluation: Multiple surrogate models for robust predictions
- Constraint Handlers: Flexible resource constraint management
🚀 Performance & Efficiency
- Island Model: Parallel subpopulation evolution for diversity
- Adaptive Constraints: Dynamic resource allocation during search
- Early Stopping: Intelligent termination based on convergence criteria
📊 Benchmark Suite
- Comprehensive Testing: Validated against HPOBench, NAS-Bench-201, and NAS-Bench-301
- Statistical Significance: Proper variance injection for meaningful comparisons
- Performance Metrics: AUC, regret, time-to-threshold analysis
Performance
DPO-NAS demonstrates superior performance across multiple NAS benchmarks:
HPOBench Results (Credit-G Dataset)
| Method | Best Accuracy | AUC@50 | Sig. vs DPO |
|---|---|---|---|
| TL-DPO | 0.9732±0.0067 | 0.8343±0.0061 | - |
| Local Search | 0.9168±0.0529 | 0.8958±0.0531 | *** |
| Regularized Evolution | 0.9312±0.0143 | 0.8793±0.0195 | ** |
| BOHB | 0.8739±0.0671 | 0.8564±0.0657 | *** |
NAS-Bench-201 Results (CIFAR-10)
| Method | Best Accuracy | AUC@50 | Sig. vs DPO |
|---|---|---|---|
| TL-DPO | 0.9541±0.0083 | 0.9350±0.0082 | - |
| Local Search | 0.9541±0.0083 | 0.9396±0.0008 | *** |
| SMAC | 0.9541±0.0083 | 0.9170±0.0205 | *** |
| Random Search | 0.9541±0.0083 | 0.8740±0.0763 | *** |
Results show mean ± standard deviation across 3 seeds. Statistical significance: *** p<0.001, ** p<0.01, * p<0.05
Installation
From PyPI (Recommended)
pip install dpo-nas
From Source
git clone https://github.com/yourusername/dpo-nas.git
cd dpo-nas
pip install -e .
Optional Dependencies
# Development dependencies
pip install dpo-nas[dev]
# Documentation
pip install dpo-nas[docs]
# GPU support
pip install dpo-nas[gpu]
Requirements
- Python 3.8+
- NumPy
- SciPy
- Matplotlib (optional, for plotting)
Quick Start
Basic Usage
from dpo import DPO_NAS, DPO_Config
# Configure the optimizer
config = DPO_Config(
population_size=40,
max_iterations=200,
alpha_0=0.1,
strategy='ensemble'
)
# Initialize and run optimization
optimizer = DPO_NAS(config)
results = optimizer.optimize()
# Access results
print(f"Best Fitness: {results['best_fitness']:.4f}")
print(f"Best Architecture: {results['best_architecture']}")
Custom Estimator
from dpo import DPO_NAS, DPO_Config
from dpo.evaluation.ensemble import EnsembleEstimator
# Create custom estimator
estimator = EnsembleEstimator(models=['latency', 'memory', 'flops'])
# Configure with custom estimator
config = DPO_Config(population_size=50, max_iterations=300)
optimizer = DPO_NAS(config, estimator=estimator)
results = optimizer.optimize()
Advanced Configuration
from dpo import DPO_NAS, DPO_Config
from dpo.constraints.handler import AdvancedConstraintHandler
# Advanced configuration
config = DPO_Config(
population_size=100,
max_iterations=500,
num_islands=4, # Island model
island_model=True,
adaptive_alpha=True,
w_loss=1.0,
w_latency=0.1,
w_memory=0.1,
w_flops=0.1,
latency_constraint=50.0, # ms
memory_constraint=1000.0, # MB
flops_constraint=2000.0, # MFLOPs
)
# Custom constraint handler
constraint_handler = AdvancedConstraintHandler(config)
optimizer = DPO_NAS(config, constraint_handler=constraint_handler)
results = optimizer.optimize()
Documentation
📖 Full Documentation: https://dpo-nas.readthedocs.io/
Key Sections
Examples
The dpo/examples/ directory contains comprehensive examples:
basic_usage.py- Simple optimization examplecustom_estimator.py- Using custom evaluation modelsadvanced_config.py- Advanced configuration optionsbenchmark_single.py- Single benchmark evaluationbenchmark_population.py- Population-based benchmarkingcomparative_analysis.py- Statistical comparison with baselines
Running Examples
# Basic usage
python dpo/examples/basic_usage.py
# Professional benchmark suite
python dpo/examples/professional_benchmark.py --seeds 5 --budget 100
Configuration
DPO-NAS offers extensive configuration options through the DPO_Config class:
Core Parameters
population_size: Number of architectures in population (default: 40)max_iterations: Maximum optimization iterations (default: 200)num_islands: Number of subpopulations for island model (default: 3)
Optimization Weights
w_loss: Weight for accuracy loss (default: 1.0)w_latency: Weight for latency constraint (default: 0.1)w_memory: Weight for memory constraint (default: 0.1)w_flops: Weight for FLOPs constraint (default: 0.1)
Constraints
latency_constraint: Maximum latency in ms (default: 50.0)memory_constraint: Maximum memory in MB (default: 1000.0)flops_constraint: Maximum FLOPs in MFLOPs (default: 2000.0)
Advanced Options
adaptive_alpha: Enable adaptive alpha parameter (default: True)island_model: Enable island model evolution (default: True)decay_power: Parameter decay exponent (default: 2.0)
Contributing
We welcome contributions! Please see our Contributing Guide for details.
Development Setup
git clone https://github.com/Arya1718/dpo-nas.git
cd dpo-nas
pip install -e .[dev]
Running Tests
pytest tests/
Code Style
black dpo/
flake8 dpo/
License
This project is licensed under the MIT License - see the LICENSE file for details.
Citation
If you use DPO-NAS in your research, please cite:
@software{dpo_nas_2026,
title={DPO-NAS: Direct Preference Optimization for Neural Architecture Search},
author={Arya H},
year={2026},
url={https://github.com/Arya1718/dpo-nas}
}
DPO-NAS - Revolutionizing Neural Architecture Search through Direct Preference Optimization
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file dpo-1.0.3.tar.gz.
File metadata
- Download URL: dpo-1.0.3.tar.gz
- Upload date:
- Size: 101.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b0fbb235c558058b112721ba294855618aad336b5a76c846809c446b07462637
|
|
| MD5 |
cabf163524c192dbbadcee673f89a3a6
|
|
| BLAKE2b-256 |
ceebae31f96bbad1cbf77b125d955e7560aa76e8d8c32f186c86ff2ba37c1e1a
|
File details
Details for the file dpo-1.0.3-py3-none-any.whl.
File metadata
- Download URL: dpo-1.0.3-py3-none-any.whl
- Upload date:
- Size: 127.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4f8f765a8773c74d8544383e7b517b88cbf4f5165640cc16fd3655513865c5fb
|
|
| MD5 |
2c21cdcbde6f16a3301b5435f724fb39
|
|
| BLAKE2b-256 |
690177ed09231ce01c62a44175c32c4d90068f0f2a8c651569dd70096f8d71be
|