DoFlow: Flow-based Generative Models for Interventional and Counterfactual Forecasting on Time Series

DoFlow is a flow-based generative model built on causal Directed Acyclic Graphs that unifies observational forecasting, interventional predictions, and counterfactual reasoning for multivariate time series while enabling principled anomaly detection through explicit likelihood estimation.

Dongze Wu, Feng Qiu, Yao Xie

Published 2026-03-03
📖 5 min read🧠 Deep dive

Imagine you are a weather forecaster. Usually, you look at the past few days of rain and wind to predict if it will rain tomorrow. That's observational forecasting: "Based on what happened, what will likely happen next?"

But what if you want to answer deeper questions?

  • Interventional: "What if I build a giant dam upstream? How will the river flow change downstream?"
  • Counterfactual: "It rained heavily yesterday and the crops died. But what if I had built that dam yesterday? Would the crops have survived?"

Most modern AI models are great at the first question (predicting the future based on the past) but terrible at the second and third. They are like a car that can drive forward but has no reverse gear and no steering wheel to change direction.

This paper introduces DoFlow, a new AI model designed to be the ultimate "Time Traveler's Dashboard." It doesn't just predict the future; it lets you simulate "What If" scenarios and even rewind time to see how things could have been different.

The Core Idea: The Causal Map

To understand DoFlow, imagine a complex machine, like a hydropower plant or a human body.

  • In a normal AI, all the parts are just a big soup of numbers. If the turbine spins fast, the generator hums. The AI learns this pattern.
  • In DoFlow, the AI is given a Causal Map (a Directed Acyclic Graph, or DAG). Think of this as a plumbing diagram. It knows that Water \to Turbine \to Generator \to Power Grid. It understands that the Turbine causes the Generator to spin, not the other way around.

How It Works: The "Flow" Machine

The magic behind DoFlow is something called a Continuous Normalizing Flow (CNF). Let's use a metaphor to explain this:

Imagine you have a lump of clay (the data).

  1. The Encoder (The Sculptor): DoFlow looks at the current state of the system and "sculpts" it down into a simple, smooth ball of clay (a standard mathematical shape called a Gaussian distribution). This is like compressing a complex movie into a single, perfect file.
  2. The Flow (The Conveyor Belt): Because this process is a "flow," it is perfectly reversible. We can run the conveyor belt backward.
  3. The Decoder (The Builder): To predict the future, DoFlow takes a fresh, random ball of clay and runs it through the conveyor belt in reverse, turning it back into a complex shape (a prediction of the future).

Why is this special?
Because the process is reversible and mathematically precise, DoFlow can do two things normal models can't:

  • Intervention: If you want to see what happens if you force the Turbine to stop, you just stop the clay at that step in the process. The rest of the machine automatically recalculates how the Generator and Grid will react.
  • Counterfactual: If you want to know "What if the Turbine had stopped yesterday?", DoFlow can take the actual clay ball from yesterday, rewind it to the "Turbine Stopped" state, and then run it forward again to see the new timeline.

Real-World Superpowers

The paper tests DoFlow on two very different worlds:

1. The Hydropower Plant (The "What If" Safety Check)
Imagine a dam. Sensors measure water flow, vibration, and electricity.

  • The Problem: Sometimes a turbine breaks. By the time the power grid sees the failure, it's too late.
  • DoFlow's Job: It watches the sensors. If the vibration patterns start to look "weird" (even before a total breakdown), DoFlow calculates the probability of the future. If the probability of a "normal" future drops too low, it sounds an alarm 20 minutes before the actual failure. It's like a doctor who can tell you are getting sick before you even feel a fever.

2. Cancer Treatment (The "What If" Medical Trial)
Imagine a patient undergoing chemotherapy.

  • The Problem: Doctors need to know: "If we gave this patient a higher dose of radiation, would they have done better?" We can't go back in time to test this on the real patient.
  • DoFlow's Job: It takes the patient's actual history, "rewinds" the timeline to the point where the dose was different, and simulates the new outcome. It acts as a virtual time machine for doctors to test treatments without risking the patient's life.

Why This Matters

Currently, if you want to know the effect of a new policy, a new drug, or a new machine setting, you often have to wait for it to happen in the real world, or run expensive, risky experiments.

DoFlow allows us to:

  • Predict the future (Observational).
  • Simulate changes (Interventional).
  • Rewrite history to learn from it (Counterfactual).

It unifies the ability to "guess what happens next" with the ability to "ask what if," all while understanding the cause-and-effect rules of the universe. It's a step toward AI that doesn't just see patterns, but truly understands how the world works.

Get papers like this in your inbox

Personalized daily or weekly digests matching your interests. Gists or technical summaries, in your language.

Try Digest →