Skip to main content

relflow

PyPI version Read the documentation CI on main Dependency compatibility on main Line coverage on main Required Python version AGPL-3.0-only license Discord community

User Guide · Benchmarks · API map · Community

Featureless modeling, shaped by your data

relflow is a predictive modeling framework, intended for any predictive task. You describe your records, their relationships, and the outcomes you want to predict using a typed Python schema. relflow builds a model from that schema, then learns features and predictions together during training.

A customer has usage history and support tickets. An asset has sensor readings and maintenance records. An insurance claim has invoices and line items. Keep those records and their relationships in the model, without first turning every history into a hand-crafted table of counts and averages.

Why relflow?

  • Featureless. Learn features from typed values and nested records inside the model, without a separate feature engineering pipeline.
  • Modular. Compose models from fields and branches. Extend them with your own custom leaf types and connect to your own custom data sources.
  • Scalable. Stream massive datasets from disk or cloud storage through batched training and inference.
  • Flexible. Predict probabilities, numbers, or several outcomes together. Targets can live at the root or inside nested collections of records.
  • Deployable. Use the trained model for batch prediction and real-time serving, with its learned vocabularies and normalizers included.
  • State of the art. On the nine published RelArena tasks with more than one million training observations, relflow beats TabPFN-3 on 9 of 9 and TabPFN-3.5 on 6 of 9. Inspect the scores and comparison records.

Philosophy

relflow was designed to be the first-of-its-class featureless modeling paradigm, providing a scalable solution in which model architecture embodies the latent data structure.

By internalizing feature processing as model components, relflow keeps the same learned vocabularies and normalizers throughout training and inference. The typed schema describes both the data contract and the architecture, including how related records contribute context to each prediction.

Install

Requires Python 3.12 or newer. With uv:

uv add relflow
uv run relflow --version

With pip, use python -m pip install relflow. Add optional capabilities with uv add "relflow[text,serving]" for text encoders and HTTP serving. See Installation for the full list.

Describe your data. Define your predictions.

Suppose you want to predict whether a subscriber will cancel within 90 days. The model can use their current plan, monthly usage, and support history:

import relflow as rf


class MonthlyUsage(rf.Branch):
    """One month of a subscriber's product usage."""

    month = rf.Period("month_of_year")
    minutes = rf.Number
    data_gb = rf.Number
    overage_fee = rf.Number


class SupportTicket(rf.Branch):
    """One support ticket in a subscriber's history."""

    channel = rf.Category
    resolved = rf.Boolean
    days_open = rf.Number


class ChurnModel(rf.Model):
    """A subscriber with usage and support histories."""

    plan = rf.Category
    tenure_months = rf.Number
    monthly_usage = MonthlyUsage(length=12, overflow="tail")
    support_tickets = SupportTicket(length=32, overflow="tail")
    churn_90d = rf.Boolean(mask=True)


if __name__ == "__main__":
    model = ChurnModel(preset="small")
    data = rf.ArrowDataModule(
        train="customers/train/*.parquet",
        validate="customers/validation/*.parquet",
        test="customers/test/*.parquet",
    )
    model.fit(data, preset="small")
    validation_metrics = model.validate(data)
    test_metrics = model.test(data)
    model.save("churn.rf")

The schema is the architecture. Fields describe individual values; branches keep related records together. relflow uses that structure to build its representations, context encoders, prediction heads, and learning objectives. Class declarations describe the contract; constructing ChurnModel(...) creates a new, untrained model.

The constructor preset selects architecture defaults. The preset on fit independently selects training defaults, including the optimizer, batch size, and training budget. The bundled small and medium presets are alternative recipes; you do not need to configure those settings individually to get started.

mask=True makes churn_90d a supervised target: the historical answer trains the model without becoming an input. Validation and test records also include observed answers, hidden in the same way for evaluation. New prediction requests may omit the target. Each history is supplied oldest to newest; overflow="tail" retains the most recent records up to the declared cap. See Targets and masking for multiple objectives and targets within nested collections.

The Parquet files contain one subscriber observation per row, with nested usage and ticket records and the historical churn_90d answer. Your application owns the decision cutoff, labels, and evaluation split. Training streams those files; the complete dataset does not need to fit in memory. Cloud storage paths use the same data-module interface.

Predict for new records

Load the saved model and pass a Polars DataFrame. New request records contain the same known inputs and a customer_id to retain, with the future answer omitted:

import polars as pl
import relflow as rf

model = rf.Model.load("churn.rf")
requests = pl.read_parquet("customers/requests.parquet")
result = model.predict(requests, batch_size=256, retain=("customer_id",))

print(result.select("inputs", "predictions"))

The result is an eager Polars DataFrame. Each row retains its customer identifier under inputs; predictions.churn_90d.content.probability holds the estimated probability of cancellation. For larger prediction jobs, stream output to files with batch inference. Use rf.PolarsDataModule when training and validation data are already in memory.

What can you build with relflow?

The User Guide uses six examples to show how the same typed modeling approach generalizes across datasets and prediction tasks:

Use case Available context Predictions
Support tickets Product details and a conversation Escalation probability and time to resolution
Customer churn Subscriber details, usage, and support histories Cancellation within 90 days
Demand forecasting Sales history and planned promotions Units sold for each supplied future week
Credit risk An application, credit accounts, and inquiries Default within 12 months
Predictive maintenance Sensor readings and completed work orders Failure within 30 days
Insurance claims Policies, claims, invoices, and line items Payout and fraud probability for each claim

These illustrate the same modeling contract across different data structures, leaf types, and prediction targets. Explore the data, model, and class schema and learn about leaf types.

Results you can inspect

On the nine published RelArena tasks with more than one million training observations, relflow beats TabPFN-3 on 9 of 9 and TabPFN-3.5 on 6 of 9. This is the recorded comparison checked November 10, 2026; the benchmark page includes individual scores, task sizes, comparison rules, and source records.

A retained Amazon item-lifetime-value model has 926,554 task-trained parameters, about 0.42% of the approximately 220 million in the TabPFN-3.5 base checkpoint. Including its shared frozen text encoder, the relflow model has 23,640,282 parameters. See the model-size comparison for exactly what is counted.

The Evidence library explores individual learning capabilities with controlled comparisons, source code, measurements, and execution provenance.

Selected historical learning checks · relflow 0.4.2
Experiment relflow result Control
Match IDs absent from training 0.9991 AUC with Hash 0.5000 with unknown Category labels
Recall a value by an unfamiliar ID 0.100 normalized RMSE, median of three seeds 1.401 after corrupting the lookup IDs
Distinguish nulls from zero 100% accuracy with value states preserved 50% after filling nulls with zero

These are recorded synthetic tasks, with their original controls and revision. Each linked page explains the setup, limitations, and retained results.

Go further

Join the Discord community, contribute through CONTRIBUTING.md, or work on the site using the documentation guide.

Public relflow releases beginning with 0.5.0 are free and open source under the GNU Affero General Public License, version 3 only (AGPL-3.0-only). This covers project-authored code, documentation, examples, schema machinery, cache implementations, and preset definitions unless a file states otherwise. See NOTICE for attribution and licensing for scope and source-sharing obligations.

Additional licensing permissions require written approval from both Grantham Taylor and Reid Taylor and the necessary contribution rights.

Metadata

Release files for relflow 0.5.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 relflow 0.5.0
File Size Uploaded Provenance Actions
relflow-0.5.0.tar.gz 336.8 kB With provenance Details for relflow-0.5.0.tar.gz

Built distribution (wheel)

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

Total release size: 673.4 kB

Release files / relflow-0.5.0.tar.gz

Download URL relflow-0.5.0.tar.gz
Size 336.8 kB
Tags Source
SHA-256 checksum
How to use checksums
47bfbb3df4b58f6866a02ce37b8b69023f88367a361971efaea2c5847d1f1553
BLAKE2b-256 checksum
How to use checksums
9384cc8138b0cd0b59fa51602b995fd11ae08ef3f1272e5e1b90c3fb99411dc2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 16, 2026.

Transparency log

Release files / relflow-0.5.0-py3-none-any.whl

Download URL relflow-0.5.0-py3-none-any.whl
Size 336.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1ad774ff447520d73eb75cf484c4f2b0995ff252f8d3787f7d91103c13c1decc
BLAKE2b-256 checksum
How to use checksums
56c977202e845f7fc568e545bc097a1b52cb9ea35278b6c77787e7cb06757f5e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 16, 2026.

Transparency log

Security for relflow 0.5.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 relflow-0.5.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 Nov 16, 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.

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