relflow builds PyTorch/Lightning models from nested records streamed through Apache Arrow. Typed fields represent values; branches combine them into local contexts; decoders learn to predict selected fields from the available context.
Install
Python 3.11 or newer:
uv add relflow
Add relflow[text] for Hugging Face text encoders or relflow[serving] for the
HTTP runtime.
Describe One Record
For example, predict whether a payment will be disputed:
payment_id: payment-42
amount: 86.50
merchant: grocery
disputed: false
import relflow as rf
model = rf.Model.xs(
amount=rf.Number,
merchant=rf.Category,
disputed=rf.Boolean(mask=True),
)
Parent keywords name each field. mask=True makes disputed a supervised
prediction target whose label is excluded from the inputs. payment_id remains
available as application metadata. Add repeated contexts with rf.Branch(...)
when a prediction needs transaction history or other related records.
Train And Predict
The application supplies Arrow tables named train_table, validation_table,
and request_table. Training and validation include the dispute label;
prediction requests omit it.
data = rf.ArrowDataModule(
model=model,
train=train_table,
validate=validation_table,
)
model.fit(data, batch_size=128, learning_rate=1e-4, weight_decay=0.01, max_epochs=30)
predictions = model.predict(request_table, batch_size=256, retain=("payment_id",))
model.save("artifacts/payment.rf")
Fitting includes early stopping and restoration of the best validation model.
Configure AdamW directly on fit; each call starts with the current model
parameters and fresh optimization state. Hardware, logging, and Lightning
options can also be supplied to the model methods.
Predictions are an Arrow table: decoded results use schema field names such as
predictions.disputed, and repeated branches become lists of records. Requested
embeddings appear separately in representations. Retention adds an inputs
column. For larger file-backed jobs, use an Arrow data module with rf.Writer
to stream predictions to Parquet.
Documentation
- Getting started
- Add transaction history
- Model structure
- Data types
- Arrow data loading
- Preprocessing
- Training and checkpoints
- Batch inference
- Prediction output
Documentation, modeling proofs, and branding sources live in the separate
relflow/docs repository. Its website uses
static examples and Typst diagrams and builds independently of this package.
Run package checks here with uv run pytest; follow the documentation
repository's instructions to run learning experiments explicitly.
See CONTRIBUTING.md for development conventions.
Metadata
Release files for relflow 0.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| relflow-0.3.2.tar.gz | 235.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| relflow-0.3.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 484.9 kB
Release files / relflow-0.3.2.tar.gz
| Download URL | relflow-0.3.2.tar.gz |
|---|---|
| Size | 235.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8f90282f6cc8137afc30070176767d71cef61d878e0619b5bf6cf00547b5e088
|
|
BLAKE2b-256 checksum How to use checksums |
52577f6e77d44d2944aa88d7b0ca3349e0168a5686e5980bf8ce0697fd1f4414
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 18, 2026.
Transparency logRelease files / relflow-0.3.2-py3-none-any.whl
| Download URL | relflow-0.3.2-py3-none-any.whl |
|---|---|
| Size | 249.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7e261c0f3f86935ff8121d031f33ca4eb7fc20ff6ba776d63e67802a2afedce6
|
|
BLAKE2b-256 checksum How to use checksums |
03c080201f4337a8b1d82a0ff0e68de1856f8a51d54e6932bb9d0afa3bea707e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Oct 18, 2026.
Transparency log