← all repositories
IDSIA/sacred

Decorate your functions to save your experiments

Sacred wraps Python experiments in decorators to automatically capture parameters, seed randomness, and log runs to MongoDB so your research stays reproducible.

4.4k stars Python LLMOps · EvalData Tooling
sacred
Not currently ranked — collecting fresh signals.
star history

What it does

Sacred is a Python library that wraps experiments in decorators to capture configuration, inject parameters by name into functions, and log runs via pluggable observers. It generates a command-line interface for every experiment and can store configurations, dependencies, host details, and results in MongoDB. The idea is to remove the tedious bookkeeping around your actual experiment code so you can rerun or reproduce a specific setup later.

The interesting bit

The core mechanic is the @ex.config decorator: local variables inside a function become your experiment’s hyperparameters, and Sacred automatically injects those values into any function that asks for them by name. It is a distinctly Pythonic approach to experiment management—born at IDSIA and published at SciPy 2017—that relies on decorators and MongoDB rather than external configuration files.

Key highlights

  • Config scopes turn ordinary function-local variables into structured experiment parameters
  • Automatic config injection passes parameters into functions by matching argument names
  • Built-in observers log configurations, dependencies, host details, and results to MongoDB
  • Automatic seeding controls randomness to aid reproducibility
  • A small ecosystem of third-party frontends (Omniboard, Incense, Sacredboard) provides dashboards and Jupyter integration

Caveats

  • Dashboard frontends are externally maintained and fragmented; at least one early prototype (Prophet) is explicitly discontinued
  • MongoDB is the primary documented storage backend, with support for other databases unclear

Verdict

Sacred suits researchers and Python developers who want self-hosted experiment tracking without subscribing to a managed service, especially if they already run MongoDB. Teams looking for a polished, collaborative SaaS experience will likely find modern alternatives more convenient.

Frequently asked

What is IDSIA/sacred?
Sacred wraps Python experiments in decorators to automatically capture parameters, seed randomness, and log runs to MongoDB so your research stays reproducible.
Is sacred open source?
Yes — IDSIA/sacred is open source, released under the MIT license.
What language is sacred written in?
IDSIA/sacred is primarily written in Python.
How popular is sacred?
IDSIA/sacred has 4.4k stars on GitHub.
Where can I find sacred?
IDSIA/sacred is on GitHub at https://github.com/IDSIA/sacred.

heatdrop uses Google Analytics to see which pages get read — nothing else. Your call. How we handle data.