Skip to main content

SysPlug

CI License: MIT Python 3.9+ Code style: ruff Checked with mypy

SysPlug architecture

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:

  1. MemoryModel: analytic peak-VRAM estimator that introspects the real model (reads hidden size, layers, query/KV heads and the attention implementation from a HuggingFace config instead 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").

  2. 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).

  3. 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

  1. Fork the repository.
  2. Create a feature branch: git checkout -b feature/my-feature
  3. Install dev deps: pip install -e ".[dev]"
  4. Run tests: pytest tests/
  5. Lint: ruff check sysplug/
  6. 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.

Metadata

Release files for sysplug 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sysplug 0.1.0
File Size Uploaded Provenance Actions
sysplug-0.1.0.tar.gz 55.8 kB With provenance Details for sysplug-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sysplug 0.1.0
File Interpreter ABI Platform Actions
sysplug-0.1.0-py3-none-any.whl Python 3 none any Details for sysplug-0.1.0-py3-none-any.whl

Total release size: 116.6 kB

Release files / sysplug-0.1.0.tar.gz

Download URL sysplug-0.1.0.tar.gz
Size 55.8 kB
Tags Source
SHA-256 checksum
How to use checksums
f7095896490d1faf997a2036c5b09171e7fbc324dc3d8508bbb5e2b791fa0f0e
BLAKE2b-256 checksum
How to use checksums
f8b124712c2d6eb7d2be5db6bdd5ca3fe1a1d2d8ba86af855f0e0dbaa9b8b82a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 9, 2026.

Transparency log

Release files / sysplug-0.1.0-py3-none-any.whl

Download URL sysplug-0.1.0-py3-none-any.whl
Size 60.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
01b7103d96c78809dfe8631cb6bf3e01cd68c736b2a839f464df8c41c024bc8c
BLAKE2b-256 checksum
How to use checksums
7e10492d5ab9f83ecd37ff0a8a90c4d63ff0ba1e79c66d3db284efeaeac45dc7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 9, 2026.

Transparency log

Security for sysplug 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for sysplug-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 9, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page