CTPPL: A Continuous Time Probabilistic Programming Language

Avi PfefferIJCAI 2009

Introduction

Continuous Time Probabilistic Programming Language (CTPPL) is a functional language designed to treat continuous time as a "first-class" element. Most existing probabilistic programming languages (PPLs) are either static or operate in discrete time steps, requiring researchers to "discretize" time into small chunks. This discretization often leads to a trade-off between accuracy and efficiency: large steps miss critical events, while small steps suffer from prohibitive computational costs. CTPPL addresses this by allowing the duration of sub-processes to be defined by the program's own logic, enabling more expressive and accurate modeling of real-world dynamic processes.

Language Syntax

CTPPL extends a standard functional core with constructs specifically designed for temporal modeling. The base language includes constants, variables, conditionals, and standard operators like application and pair construction.

Core syntax of CTPPL, including standard functional constructs and the 'first' expression.

To handle continuous time and observations, the language introduces specialized temporal constructs that allow programs to interact with a global clock and signal events:

  • delay e1; e2: Evaluates e1 to a duration $v$, waits for that duration, and then executes e2.
  • now: Returns the current execution time.
  • emit e1; e2: Signals an observation at the current time.
  • first [e1, e2]: Runs two processes in parallel; the entire expression completes as soon as the first one finishes, which is useful for modeling competing risks.
Temporal constructs in CTPPL for emission, delay, and time-tracking.

Inference via Regression

The core technical challenge in continuous-time modeling is the "zero probability" problem: the probability of an event happening at an exact time (e.g., exactly 1.000... seconds) is zero. Standard sampling techniques fail because they almost never "hit" the exact time an observation occurs, leading to high rejection rates.

CTPPL introduces a novel particle filtering algorithm that uses Regression to solve this. When the system needs to reach an observation at a specific time $t_i$, it identifies the "key delay" currently executing. Instead of sampling a random duration, the algorithm back-calculates the value that delay would have needed to be to land exactly on $t_i$. It then forces the delay to that value and adjusts the particle's importance weight based on the probability density of that value occurring in the original distribution. This turns a rejection-heavy sampling problem into an efficient importance sampling problem.

Evaluation and Results

The language was evaluated using Continuous Time Bayesian Networks (CTBNs) and a synthetic musical performance model where tempo and pitch are latent variables.

  • Accuracy: In a test case with a known analytical solution (0.8), CTPPL’s particle filter predicted 0.8053 using 10,000 particles, demonstrating high empirical accuracy.
  • Efficiency: The system generated 10,000 particles in 2.5 seconds on a 2GHz single-core machine.
  • Complexity Handling: A polyphonic music model with 4 voices and 20 notes was successfully filtered using only 100 particles in 34 seconds, showing the algorithm can handle interleaved, parallel continuous-time processes that would be very difficult to represent in discrete-time PPLs.

Limitations and Future Work

Current limitations include "incomplete regression," where the algorithm struggles with complex function applications within delay expressions. Additionally, while time is continuous, the values emitted must currently be discrete (e.g., "Note C"). Future work aims to support conditioning on continuous-valued observations (like sensor readings) and exploring non-linear causal models.

Summary updated

BibTeX
@inproceedings{pfeffer2009ctppl,
  author = {Avi Pfeffer},
  title = {{CTPPL: A Continuous Time Probabilistic Programming Language}},
  booktitle = {International Joint Conference on Artificial Intelligence},
  year = {2009},
}
Figure