GPU-aware hyperparameter advisor for any deep learning training loop
Project description
SysPlug
GPU-aware hyperparameter advisor for any deep learning training loop.
SysPlug analyses your GPU hardware, estimates memory and throughput requirements, and recommends the optimal batch size, learning rate, precision, gradient accumulation, and parallelism strategy for your training run, before you waste hours hitting OOM or under-utilizing hardware.
Unlike a param-count guesser, SysPlug reads the real model architecture (hidden size, layers, attention heads including GQA, and the attention implementation) straight from a HuggingFace config, models the O(S²) attention-score memory that dominates long-context training, and reports a conservative, OOM-safe bound: if it says a config fits, it fits.
Quick Start
pip install sysplug
import sysplug
advisor = sysplug.Advisor(model=model, training_type="sft")
# Get an optimised configuration
cfg = advisor.suggest_config({"batch_size": 8, "learning_rate": 2e-5})
# What if I try a larger batch?
result = advisor.what_if({"batch_size": 32})
print(result.changed_params) # shows what changed and why
# Monitor training in real time
with advisor.monitor(check_interval_steps=100) as mon:
for step, batch in enumerate(dataloader):
loss = train_step(batch)
mon.record(step=step, loss=loss.item())
Installation
# Core
pip install sysplug
# With Hugging Face Trainer integration
pip install sysplug[hf]
# With DeepSpeed integration
pip install sysplug[deepspeed]
# Development
pip install sysplug[dev]
API Reference
Advisor
The main entry point.
advisor = sysplug.Advisor(
model, # nn.Module, string ("llama-3-8b"), or int
hardware="auto", # "auto" or HardwareSnapshot
training_type="supervised", # "sft"|"rlhf"|"dpo"|"grpo"|"supervised"
objective="balanced", # "throughput"|"memory"|"balanced"
verbose=True,
device_ids=None, # list of GPU IDs; None = all
)
suggest_config(base_config: dict) -> SysPlugConfig
Returns the best safe configuration for the given starting point. Runs hardware profiling → memory estimation → constrained optimisation.
what_if(change: dict, current_config=None) -> WhatIfResult
Evaluates a proposed change, locking the specified parameters and re-solving the rest. Returns WhatIfResult with new_config, changed_params, reason, and feasible.
monitor(check_interval_steps=50, reconfig_policy="suggest") -> Monitor
Returns a context manager that runs GPU polling and stability checks in a background thread.
SysPlugConfig
The output type of suggest_config. Key methods:
| Method | Description |
|---|---|
to_dict() |
Serialise to a plain dict |
to_training_arguments(**kwargs) |
Create transformers.TrainingArguments |
to_deepspeed_config(base_config) |
Merge into a DeepSpeed config dict |
apply_to_optimizer(optimizer) |
Set LR on an existing optimizer |
summary() |
Rich-formatted table |
Framework Integrations
Hugging Face Trainer
from sysplug.integrations.huggingface import SysPlugTrainerCallback
trainer = Trainer(
...,
callbacks=[SysPlugTrainerCallback(advisor)],
)
DeepSpeed
from sysplug.integrations.deepspeed import patch_deepspeed_config
ds_config = patch_deepspeed_config(my_ds_config, advisor)
RLHF / PPO
from sysplug.integrations.rlhf import RLHFAdvisor, PPOConfigHelper
advisor = RLHFAdvisor(model=policy, training_type="rlhf")
advisor.record_reward(step, mean_reward=0.7, reward_std=0.1)
advisor.record_kl(step, kl_divergence=0.3)
if advisor.detect_reward_hacking():
print("Reward hacking suspected!")
ppo_cfg = PPOConfigHelper(advisor).suggest(ppo_epochs=4)
CLI
python -m sysplug suggest --model llama-3-8b --batch-size 8 --precision bf16
python -m sysplug hardware
python -m sysplug version
How SysPlug Compares
| Feature | SysPlug | W&B Sweeps | Ray Tune | Manual tuning |
|---|---|---|---|---|
| No training runs required | ✅ | ❌ | ❌ | ❌ |
| Memory-safe suggestions | ✅ | ❌ | ⚠ | ❌ |
| LR scaling rules | ✅ | ❌ | ❌ | Manual |
| Online instability detection | ✅ | ❌ | ❌ | ❌ |
| ZeRO / FSDP awareness | ✅ | ❌ | ❌ | Manual |
| HF Trainer integration | ✅ | ✅ | ✅ | N/A |
| What-if analysis | ✅ | ❌ | ❌ | ❌ |
| No GPU required for suggestions | ✅ | ❌ | ❌ | N/A |
| Pip installable | ✅ | ✅ | ✅ | N/A |
How It Works
SysPlug combines three components:
-
MemoryModel: analytic peak-VRAM estimator that introspects the real model (reads hidden size, layers, query/KV heads and the attention implementation from a HuggingFace
configinstead of guessing from the parameter count), models full O(S²) attention-score memory for eager attention and drops it for FlashAttention/SDPA, covers optimizer states and ZeRO-0..3 / FSDP sharding, and reports a conservative upper bound the solver treats as OOM-safe ("if it says it fits, it fits"). -
ThroughputModel: roofline-based throughput predictor using GPU hardware specs (peak FLOP/s, memory bandwidth), where per-step compute is 6×params×seq×batch, weight traffic is read once per step, and activation traffic scales with batch (so throughput ramps then plateaus).
-
ConfigSolver: constrained solver that adjusts the configuration (batch size, gradient accumulation, precision, LR) subject to GPU memory constraints and applies literature-backed LR scaling rules (Goyal et al. 2017, Krizhevsky 2014).
The Monitor runs these checks in a background thread during training, detecting loss divergence and OOM risk without blocking the training loop.
How accurate is it?
Validated against real training on an NVIDIA RTX PRO 5000 (24 GB):
- Memory: 10.1% mean error, and the conservative upper bound covered the true out-of-memory threshold (allocator reserved peak) for 100% of tested configurations — GPT-2 125M–775M and a grouped-query-attention LLaMA model.
- Throughput: 7.3% mean error after a short one-time calibration.
- The
O(S²)eager-attention memory term was validated independently across sequence lengths 256/512/1024.
Reproduce it yourself with python -m paper.experiments.measure_gpu. Scope: validation so far is single-GPU on GPT-2 and LLaMA-family models; broader coverage (more architectures, longer contexts, multi-GPU) is in progress. Full method and numbers are in the paper.
Contributing
- Fork the repository.
- Create a feature branch:
git checkout -b feature/my-feature - Install dev deps:
pip install -e ".[dev]" - Run tests:
pytest tests/ - Lint:
ruff check sysplug/ - Open a pull request.
Please make sure all tests pass and coverage stays above 85%.
Citation
If you use SysPlug in research, please cite:
@software{sysplug2026,
title = {{SysPlug}: GPU-aware Hyperparameter Advisor for Deep Learning Training},
author = {Gautam, Arpit Singh},
year = {2026},
url = {https://github.com/arpitsinghgautam/sysplug},
version = {0.1.0},
}
License
MIT License. See LICENSE for details.
Project details
Release history Release notifications | RSS feed
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 sysplug-0.1.0.tar.gz.
File metadata
- Download URL: sysplug-0.1.0.tar.gz
- Upload date:
- Size: 55.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f7095896490d1faf997a2036c5b09171e7fbc324dc3d8508bbb5e2b791fa0f0e
|
|
| MD5 |
7958e45503c6400e40d33a6e1a5ff821
|
|
| BLAKE2b-256 |
f8b124712c2d6eb7d2be5db6bdd5ca3fe1a1d2d8ba86af855f0e0dbaa9b8b82a
|
Provenance
The following attestation bundles were made for sysplug-0.1.0.tar.gz:
Publisher:
publish.yml on arpitsinghgautam/sysplug
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sysplug-0.1.0.tar.gz -
Subject digest:
f7095896490d1faf997a2036c5b09171e7fbc324dc3d8508bbb5e2b791fa0f0e - Sigstore transparency entry: 2123732937
- Sigstore integration time:
-
Permalink:
arpitsinghgautam/sysplug@53bd446455a213297a027c26c2b8e00f9747c9f9 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/arpitsinghgautam
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@53bd446455a213297a027c26c2b8e00f9747c9f9 -
Trigger Event:
push
-
Statement type:
File details
Details for the file sysplug-0.1.0-py3-none-any.whl.
File metadata
- Download URL: sysplug-0.1.0-py3-none-any.whl
- Upload date:
- Size: 60.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
01b7103d96c78809dfe8631cb6bf3e01cd68c736b2a839f464df8c41c024bc8c
|
|
| MD5 |
f8fcaa35deb55e8996f9ce97eb68ddd1
|
|
| BLAKE2b-256 |
7e10492d5ab9f83ecd37ff0a8a90c4d63ff0ba1e79c66d3db284efeaeac45dc7
|
Provenance
The following attestation bundles were made for sysplug-0.1.0-py3-none-any.whl:
Publisher:
publish.yml on arpitsinghgautam/sysplug
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sysplug-0.1.0-py3-none-any.whl -
Subject digest:
01b7103d96c78809dfe8631cb6bf3e01cd68c736b2a839f464df8c41c024bc8c - Sigstore transparency entry: 2123733007
- Sigstore integration time:
-
Permalink:
arpitsinghgautam/sysplug@53bd446455a213297a027c26c2b8e00f9747c9f9 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/arpitsinghgautam
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@53bd446455a213297a027c26c2b8e00f9747c9f9 -
Trigger Event:
push
-
Statement type: