Learn

Contents

Why eLucid8

eLucid8 is for computations that produce data over dimensions, such as time, space, samples, steps or entities, where it matters exactly what each result depends on. This page says when it is the right tool, when it is not, and how it fits with the tools you already use.

Writing steps, or saying what each value is

In a general-purpose language such as Python, with NumPy or pandas, you write steps: loop over these, compute that, store it there, and remember to recompute it when an input changes. In eLucid8 you write what each value is, over named dimensions, and the engine works out the steps:

running = x fby.t (running + next.t x)

That difference pays off when the steps are the hard part.

This way of programming is called intensional: "the meaning of an expression depends on the context in which it is being evaluated" (J. Plaice and J. Paquet, "Introduction to Intensional Programming", in M. A. Orgun and E. A. Ashcroft (eds.), Intensional Programming I, World Scientific, 1996, p. 1). Each value is an intension, "an indexed family of data values", one result at each context (W. Wadge and A. Yoder, "The Possible-World Wide Web", in the same book, p. 207).

A picture: the Web

The World Wide Web works the way eLucid8 computes (Plaice and Paquet, p. 3; Wadge and Yoder, pp. 207–208). Each page has a URL, which is its context. A page is fetched only when a link asks for it. And with a cache, a page asked for several times is fetched once. In eLucid8, a question names a point: a value at one context. Only what that answer depends on is computed, each point at most once per question, and with a point cache a value computed for one question is reused by later ones while the data it read is unchanged. This way of computing is called eduction. Why eduction works explains why it works, with the Mandelbrot set as the example.

What you get

  1. Only what is asked for is computed. Ask for one cell of a grid at one time, and eLucid8 computes exactly what that cell depends on and nothing else. In a script you compute everything, or write the logic to avoid it yourself.
  2. Changes recompute exactly what they affect. Correct one input value, and eLucid8 knows which results are now stale. In a training run in our tests, changing one test point recomputed 31 values out of about 330,000. In a script, getting this right means tracking dependencies by hand; the usual answer is to run everything again.
  3. Time is handled correctly. Every value carries a timestamp, the time of the newest data it was computed from, and streams at different rates meet only through an explicit choice by time, such as "the latest value at or before this time". So whether a result used data from its own future is visible in its timestamp, and a program can check it (Values and timestamps). In machine-learning features, that mistake (data leakage) is common, and it silently spoils models.
  4. Every result says what it came from. A result records which version of which data it read, so you can reproduce it or check it later.
  5. Failures are visible. A missing value is an error of kind missing, a failure an error of its own kind, each naming where it started, and eod (end of data) means only that the point is outside the data; never a silent NaN that spreads through everything downstream.
  6. The same answer everywhere, to the last bit, in the browser, on a laptop or as a service, for every program. Caching, memory management and parallelism decide how fast an answer comes, never what it is.
  7. Calls to other services are part of the computation, with deadlines, retries and recorded results, not side effects buried in a loop.

When something else is the better choice

How it fits with the tools you use

Formats such as Apache Arrow and NumPy's arrays are not alternatives to eLucid8. They say how a table or an array of numbers is laid out, so that tools can share it without copying, and they compute nothing. eLucid8 produces them.

The realistic picture is eLucid8 inside your application. eLucid8 defines and maintains the data: features over (entity, time), a simulation over (time, x, y), a training history over steps. Your application asks for what it needs and receives it in a form its own tools read directly. Results come as JSON lines, CSV, whole grids and cubes as one block of JSON (a frame), NumPy .npz files, Apache Arrow tables or Apache Parquet files (from 0.19.0, also Zarr stores and Vega-Lite charts, for xarray and charting tools: Seeing your results), and data is read from CSV, JSON-lines, Parquet and Arrow files, through the elucid8 command or the long-running service. Using eLucid8 from your code shows both, from Python, NumPy, pandas, JavaScript and the shell. The Python package, pip install elucid8, runs programs with DataFrames in and out (eLucid8 from Python), and its connectors read from and write to databases, object stores and streams (Connecting eLucid8 to your data).

To see how the parts fit together, read How eLucid8 fits together.

In brief: what it is, and how fast

A language and runtime for computations over many dimensions: sensor grids, simulations, point-in-time feature tables, training runs.

You write a program as equations over named dimensions, ask for a value at one point, and eLucid8 computes only what that answer depends on, and shows why it came out as it did.

Try it in 30 seconds:

  • In your browser: open the playground, choose an example such as Heat diffusion, ask for a value, and press Why? beside the answer to see every demand behind it.
  • On your computer: pip install elucid8 installs the elucid8 command and the Python package (eLucid8 from Python).

eLucid8 is pronounced elucidate. It is a language of the Lucid family, whose programs are equations evaluated on demand.

An eLucid8 program is a set of equations that define values over named dimensions: time, space, steps of a training run, sensors, customers, or anything you name. You ask for one value at one point, and only what that answer depends on is computed (demand-driven evaluation, or eduction). Every answer is data (a number, a boolean or text), eod (end of data: the point is outside the data) or an error that names where it started, and carries a timestamp: the time of the newest data it was computed from.

The same program runs in the browser playground, as the elucid8 command on your computer, and as a long-running service. Caches, compiled loops, memory management and the number of threads decide how fast an answer comes, never what it is: the engines give the same answers, to the last bit, for every program. Timestamps, deadlines and calls to external services (an AI model, a web API) are explicit in the program, and their outcomes are visible.

Measured at full size against the tool you might use instead, on one machine (an Apple M5 Max, 18 cores; Examples), with elucid8 0.24.0 for the heat plate and the stream and 0.22.0 for the rest, every sum exact:

taskeLucid8at each tool's defaultson one thread
a 512 × 512 heat simulation's whole plate at step 1,0000.35 s3.8× faster than NumPyNumPy 1.35× faster
a 256 × 256 sensor field's 1,000-tick batch from a 1.1 GB CSV1.4 s3.1× faster than NumPylevel with NumPy
the same sensor field, per tick in the streamNumPy 1.8× faster (2.4× with answers as JSON)
a 36.5-million-row point-in-time feature table4.1 slevel with DuckDB; 3.5× faster than pandas2.6× faster than DuckDB
every trade of a day (30 million trades, 120 million quotes) priced against the quote in force at its time, with its freshness6.0 s1.5× faster than DuckDB, 1.7× faster than Polars2.0× faster than DuckDB; Polars 1.5× faster
a small neural network's training step (89 parameters, on the CPU)0.45 ms; 0.38 ms with sums in any orderPyTorch (0.27 ms) 1.7× faster; 1.4× with sums in any orderPyTorch 5.1× faster; 3.2× with sums in any order

A small example

A running sum, and a ratio that fails where its input is 0, in the language's notation v0.2:

x = input("x", t : inf)
running = x fby.t (running + next.t x)
ratio = running / x

input("x", t : inf) is the input x, data from outside the program, over t from 0 for as many rows as its data has (past them it is eod); where it comes from is set when the program is deployed. fby.t ("followed by") gives x at the first t, and the expression on its right at every later one, read one step back; next.t x is x one step ahead. With x = 3, 1, 4, 0, 5, 9 at t = 0 to 5, running at t = 4 is 13 (3 + 1 + 4 + 0 + 5), and ratio at t = 3 is Error: division by zero. Asking for running at t = 4 computes running at t = 0 to 4 and reads x at t = 0 to 4, nothing else.

To run it, open the playground, paste the program, give the input x the table t,value with rows 0,3 · 1,1 · 2,4 · 3,0 · 4,5 · 5,9, and query running at t = 4. Press Why? beside the answer to see every demand behind it.

Where it fits

Computations whose data lies over several dimensions, where it matters exactly what each result depends on:

  • Point-in-time features for machine learning: every value carries the timestamp of the newest data it read, and streams meet only through a choice by time (asof, hold, window), so whether a feature read data from its own future is visible and checkable (the features example builds a 36.5-million-row training table this way).
  • Sensor and IoT streams with missing data: a missing reading is an error of kind missing that names the sensor and the time, aggregates leave it out and say how many, a faulty one is an error that says what went wrong, and elucid8 serve takes new rows as they arrive (the sensor-field example).
  • Simulation on grids when only parts are needed: asking for one cell computes only the values it depends on (the simulation example: 5% of the field for a probe at step 100).
  • Financial feeds combined as of each moment: the same choices by time (asof, hold, window) combine feeds that arrive at different rates (the playground's Market feeds example prices each trade against the quote in force when it happened).
  • Pipelines that call AI models: each call is part of the program, with a deadline and retries; where the program asks for it, a successful result is reused instead of paid for again, and recorded calls replay exactly.
  • Reproducible, auditable computation: a result records which version of which data it read, and the playground's trace shows every demand behind it.
  • Recomputing after late or corrected data: with a point cache, only the values that read the corrected data are recomputed (106 values after one corrected purchase in the features example; the playground's Correcting data example shows it on twelve readings).
  • Weather and climate data: values over time and a spatial grid; the playground's Alps example uses real hourly temperatures from Open-Meteo.
  • Multidimensional planning: values over products, zones and periods, each traceable to what it read (the playground's Sales planning example: revenue, totals by zone and by product, and a plan that grows month by month).