neurogen
neurogen is a CLI-based machine learning framework for forecasting outcomes
from text corpora over time. It began life as a citation-impact predictor, but
nothing in the pipeline is specific to academic papers: embed a text dataset,
track it across time windows, train, and evaluate.
The core training loop and data pre-processing are driven entirely by the CLI
and integrate with MLflow to track experiments. Each experiment is a single
self-contained Python module that instantiates its own models, datasets,
samplers, DataLoaders, strategy, tracker, and checkpoint processor, and every
app runs either locally or on Modal GPUs with one --runtime flag.
Install
neurogen installs as one top-level package with a neurogen console script.
PyTorch is not a core dependency; it arrives through one of the mutually
exclusive cpu, cuda126, or cuda130 extras.
pip install neurogen # CLI only; no torch
pip install "neurogen[cpu]" # CPU PyTorch
pip ignores [tool.uv.sources], so select the PyTorch build with its index
explicitly:
# CPU
pip install torch --index-url https://download.pytorch.org/whl/cpu
pip install "neurogen[cpu]"
# CUDA 12.6 (use cuda130 and the whl/cu130 index for CUDA 13.0)
pip install torch --index-url https://download.pytorch.org/whl/cu126
pip install "neurogen[cuda126]"
With uv, the extras resolve the matching index
for you:
uv add "neurogen[cpu]" # or [cuda126] / [cuda130]
Python 3.12 and 3.13 are supported (requires-python = ">=3.12,<3.14").
Quick start
Create a project, then train its generated example for one local step:
neurogen init demo
cd demo
neurogen train -e example --name demo --no-gpu
neurogen init [NAME] writes a real importable package and refuses to
overwrite existing files unless --force is passed. It runs no git init and
no pip install. The generated layout is:
demo/
├── neurogen.toml # project marker and manifest
├── pyproject.toml # project name, dependencies, [tool.neurogen]
├── config.toml # [env], [source], and [runtime] defaults
├── .gitignore
├── README.md
└── demo/
├── __init__.py
├── experiments/example.py # the importable example experiment
├── models/tiny.py
├── datasets/tiny.py
├── strategies/__init__.py
└── tokenisers/__init__.py
Local runs and direct imports
A project declares itself with a neurogen.toml marker or a [tool.neurogen]
table in pyproject.toml. The CLI walks up from the working directory to find
one, prepends the project root to sys.path, and imports the experiment
directly as <package>.experiments.<name>. There is no plugin registry and no
editable install: drop a module under demo/models/ and import it from an
experiment module.
--project PATH overrides discovery. -e/--experiment accepts four forms:
| Input |
Resolution |
name |
<project package>.experiments.name |
pkg.mod.name |
that dotted module |
neurogen:name |
a builtin experiment in neurogen.experiments |
path/to/file.py |
load from the file path |
Builtin experiments run with no project at all:
neurogen -e neurogen:rhlm train -s smoke --no-gpu
Dependencies declared in the project pyproject.toml are yours to install;
third-party packages already in the environment are importable because the CLI
runs in that environment.
Machine settings
Machine settings ([env], [source], [runtime], [models]) are read from
config.toml at the project root — the directory holding the
neurogen.toml marker or the [tool.neurogen] table. A project that predates
the 0.1 layout may keep the file at config/config.toml instead. With no
project marker, discovery finds nothing and the library defaults apply
(sqlite:///mlflow.db for tracking, /tmp/artifacts for artifacts, no
[runtime.modal] section), so a Modal run needs a project. config/config.example.toml
in this repository is the reference for the accepted keys; copy it to
<project>/config.toml and edit it there.
Builtins
Builtin models, datasets, strategies, tokenisers, losses, and experiments ship
with the package and resolve from it. neurogen init copies a minimal example
into the project for editing; the builtin set itself does not change in 0.1.
Deploy to Modal
neurogen deploy builds a builtin-only Modal image from a locally built
neurogen wheel and shells out to the Modal CLI. Install the optional extra
and authenticate once:
pip install "neurogen[modal]" # or: uv add "neurogen[modal]"
modal token new
neurogen deploy
Preprocess, describe, and engineer dispatch to the deployed app by name; train
and eval spawn ephemeral jobs. Train jobs are spawned fire-and-forget: the CLI
prints the MLflow run id and Modal FunctionCall id and returns immediately.
Block until done with modal FunctionCall.from_id(<id>).get(), or watch the run
in the MLflow UI.
The image carries the builtin framework and pinned torch only. Packaging a
user project into the image is not part of 0.1; that is the subject of the
custom-code-on-Modal plan. A project
experiment still runs locally
(--runtime local). Re-deploy after changing neurogen itself; a project code
change does not reach the builtin image. --wheel PATH installs a prebuilt
neurogen wheel instead of building one from the checkout.
Repository layout
neurogen/
├── pyproject.toml
├── config/
│ └── config.example.toml # example machine settings
├── src/
│ └── neurogen/
│ ├── cli.py # root Typer app
│ ├── api.py # public protocol hub
│ ├── __init__.py # lazy __getattr__, __version__
│ ├── __main__.py # python -m neurogen
│ ├── apps/ # Typer CLI apps (train, eval, preprocess, ...)
│ ├── builders/
│ ├── config/ # schemas, loader, env/runtime config
│ ├── data/ # sources, pipelines, datasets, samplers
│ ├── experiments/ # builtin experiments (neurogen:<name>)
│ ├── models/
│ ├── runtime/ # local and Modal backends
│ ├── training/ # engine, strategies, losses, tracking
│ └── utils/
├── plans/
│ ├── legacy/ # archived pre-0.1 plans
│ └── releases/ # feature plans; shipped plans move to archive/
└── tests/
Tech stack
- Core. Python 3.12-3.13 and PyTorch.
- MLOps. MLflow for tracking, Modal for GPUs, scikit-learn for metrics.
- Data. Polars for predicate-pushdown loading and multi-worker serving.
- Validation. Pydantic for typed config schemas.
- Tooling. Typer for the CLI and Rich for logging.
Documentation
- ROADMAP.md — the post-0.1 line.
- CHANGELOG.md — releases, starting at 0.1.0.
- docs/ — apps, experiments, data pipeline, and training
internals.
- plans/releases/archive/0.1.md - the 0.1.0
release plan.
- docs/legacy-changelog.md — pre-0.1 history.