Skip to main content

Training-time adaptive data curriculum for PyTorch with safety guards

Project description

🛡 CurriculumGuard

Training-Time Data Control for PyTorch

PyPI
License

CurriculumGuard is an open-source training-time control system that dynamically adapts which samples a model sees during training using live learning dynamics — while enforcing stability via rollback-based safety guards.

Models and optimizers are controlled.
Hyperparameters are tuned.
But the data stream itself has been ignored — until now.


🔥 Why CurriculumGuard?

Modern datasets are:

  • Noisy
  • Imbalanced
  • Web-scraped
  • Non-stationary

CurriculumGuard introduces a missing layer in ML infrastructure:

Adaptive Data Curriculum with Stability-First Control


⚙ Installation

pip install curriculumguard

🚀 Quick Start

Dataset must return sample IDs

def __getitem__(self, idx):
    return idx, data, label

Wrap training loop

from curriculum_guard.core.guard import CurriculumGuard
from curriculum_guard.sampler.adaptive_sampler import AdaptiveSampler

guard = CurriculumGuard(train_dataset)

for epoch in range(epochs):
    sampler = AdaptiveSampler(train_dataset, guard.bucketer.bucketize(), guard.weights)
    loader = DataLoader(train_dataset, sampler=sampler)

    for ids, x, y in loader:
        logits = model(x)
        loss   = criterion(logits, y)
        guard.profiler.update(ids, loss.detach(), logits.detach(), y)
        loss.mean().backward()
        optimizer.step()
        optimizer.zero_grad()

🧠 Signals Observed

Signal What It Represents
EMA loss Sample difficulty
Loss variance Label noise
Prediction entropy Shortcut learning
Forgetting events Harmful samples
Exposure count Over-training risk

🛡 Safety Model

CurriculumGuard enforces rollback when instability or regression is detected.

Policy is advisory. Safety is authoritative.


📊 Benchmarks

Task Baseline CurriculumGuard
AG News + Noise 68% 74%
FashionMNIST 35% noise 84% 87.5%
Fraud Recall slow fast high recall
Continual Drift fragile stable

📜 License

MIT

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

curriculumguard-0.1.2.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

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

curriculumguard-0.1.2-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file curriculumguard-0.1.2.tar.gz.

File metadata

  • Download URL: curriculumguard-0.1.2.tar.gz
  • Upload date:
  • Size: 6.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.0

File hashes

Hashes for curriculumguard-0.1.2.tar.gz
Algorithm Hash digest
SHA256 214beff983229960a03c74153dd5e35a2e1922025f1875e620320bb68edabbd5
MD5 77473d3ec2ea9d09e41742d5a98d95cc
BLAKE2b-256 5bffc5fe76cac3931c50c344df4a919b02001c1e7587bb62e55ed2230a0663f0

See more details on using hashes here.

File details

Details for the file curriculumguard-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for curriculumguard-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a31b2af909f6ce79b64ab2f5e2e2c7a7664f28eac0e87108351937d9d21cff6f
MD5 76a37298048f146884b09252acf6d02a
BLAKE2b-256 12202ed5ca116b260d59d0d1612b58e46a1f836193c2d7c702c9815ea0fda8aa

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