Skip to main content

Generic Bayesian self-optimizing hyperparameter tuning engine

Project description

AutoTuneNet

A generic, open-source Python library that enables self-optimizing model training by dynamically tuning hyperparameters during training using Bayesian Optimization.

Instead of traditional manually tuning learning rates, batch sizes, or regularization values before training, AutoTuneNet continuously observes training behavior and automatically adjusts hyperparameters to improve convergence and performance.

Why This Project Exists

Hyperparameter tuning is one of the most time-consuming and error-prone parts of machine learning workflows.

Common problems:

  • Manual trial-and-error
  • Grid/random search waste compute
  • Hyperparameters are fixed before training
  • Optimal values often change during training

AutoTuneNet solves this by making hyperparameter tuning part of the training loop itself.

Core Idea

AutoTuneNet treats hyperparameter tuning as a learning problem.

During training:

  1. The model trains normally
  2. Training and validation metrics are observed
  3. A Bayesian optimizer models the relationship between hyperparameters and performance
  4. Hyperparameters are updated incrementally and safely
  5. Training continues with improved settings

This creates a closed-loop, self-optimizing training system.

What This Is (and Is Not)

This project is

  • A generic hyperparameter optimization engine
  • Model-agnostic
  • Dataset-agnostic
  • Designed to plug into existing training loops
  • Suitable for research and production workflows

This project is not

  • A single ML model
  • Offline AutoML that runs many full trials
  • Grid or random search
  • Neural Architecture Search

Design Philosophy

  • Framework-agnostic core
    The Bayesian optimization logic does not depend on PyTorch or TensorFlow.

  • Thin framework adapters
    Framework-specific code lives in adapters (PyTorch first).

  • Safety first
    Guardrails prevent unstable updates and allow rollback.

  • Minimal user code changes
    Users should be able to integrate this with a few lines of code.

Key features

  • Training time hyperparameter optimization
  • Bayesian Optimization (Optuna-backed, ask-tell)
  • Stability guards with rollback protection
  • Metric Smoothing for noisy signals
  • PyTorch Adapter
  • Multi-parameter tuning(lr, momentum, weight_decay etc.)
  • Config-driven tuning via YAML or dict
  • Fully Unit Tested
  • Lightweight & Modular

Installation

pip install AutoTuneNet

Quick Usage

import torch 
import torch.nn as nn
import torch.optim as optim

from AutoTuneNet.core.parameters import ParameterSpace
from AutoTuneNet.core.bayesian_optimizer import BayesianOptimizer
from AutoTuneNet.adapters.pytorch.adapter import PyTorchHyperparameterAdapter

model = nn.Linear(10, 1)
optimizer = optim.Adam(model.parameters(), lr=0.01)

param_space = ParameterSpace({
    "lr": (1e-4, 1e-1)
})

autotune = BayesianOptimizer(param_space)

adapter = PyTorchHyperparameterAdapter(
    torch_optimizer=optimizer,
    autotune_optimizer=autotune
)

for epoch in range(20):
    train_loss = train_one_epoch(model)
    val_metric = -train_loss  # higher is better

    adapter.on_epoch_end(metric=val_metric)

    print(f"Epoch {epoch} | lr={optimizer.param_groups[0]['lr']:.6f}")

That's it AutoTuneNet will:

  • explore hyperparameters
  • keep the best configuration
  • rollback unsafe updates automatically

How it works?

AutoTuneNet runs a suggest -> observe loop inside training.

  1. Suggest new hyperparameters (Bayesian optimization)
  2. Apply them tentatively
  3. Observe training or validation metric
  4. Accept or rollback based on stability rules

This loop repeats throughout training without breaking it.

Safety and Stability and Support

AutoTuneNet is designed to never destabilize training.

  • Built-in protections:
  • Regression detection
  • Consecutive failure thresholds(patience)
  • Cooldown after rollback
  • Restore last known good configuration

If a suggested hyperparameter harms training, it is reverted immediately.

It supports

  • PyTorch Adapter or Integration
  • Multi-paramter Tuning
  • Config-Driven Tuning

Testing

AutoTuneNet is fully unit tested.

python -m pytest -v

Tests cover:

  1. optimizer lifecycle
  2. stability logic
  3. rollback behavior
  4. PyTorch adapter
  5. config loading

Folder Structure

autotunenet/
├── AutoTuneNet/   # Bayesian optimizer, parameter space
├── safeguards/    # Stability and rollback logic
├── adapters/      # Framework integrations (PyTorch)
├── config/        # Config schema & loaders
├── logging/       # Structured logging

License

MIT License

Contributing

Contributions are welcome.

  • Open issues for bugs or ideas
  • PRs fro improvement or adapters
  • Tests required for new features

Acknowledgements

Built on top of:

  • Optuna
  • PyTorch Inspired by real-world ML systems where stability matters more than speed.

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

autotunenet-1.0.1.tar.gz (13.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

autotunenet-1.0.1-py3-none-any.whl (15.9 kB view details)

Uploaded Python 3

File details

Details for the file autotunenet-1.0.1.tar.gz.

File metadata

  • Download URL: autotunenet-1.0.1.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.1

File hashes

Hashes for autotunenet-1.0.1.tar.gz
Algorithm Hash digest
SHA256 0b863275582bffad9818cf4c5d7bab322964f0e2b4644c46af70f975be9f0c09
MD5 6692c3bae01bbc69f84f8f21729c0e5d
BLAKE2b-256 d29bec0ed1dcfb507fcbcdd130f678a81293fe1744012b6b54b0a5b4e6ee684f

See more details on using hashes here.

File details

Details for the file autotunenet-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: autotunenet-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 15.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.1

File hashes

Hashes for autotunenet-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 be5d35c5eb996237e1950dfd98aaef559c1caa2d83e555a58ab5edc2c4921292
MD5 7e9ac00c855644b1163a630eff3eb8ce
BLAKE2b-256 21b28a5659dd8b7ab4366bc365c858808b2d79affa184c2a69899c8c9230b53d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page