lume

24 — Phase 4 Plan & Architecture: AI, Tensors, Autodiff, Prob, Rules, extern llm fn, and Spiking Networks

Phase 4 (Stage 4 of docs/04-roadmap.md and docs/03-specification.md §14) brings first-class AI and differentiable/probabilistic/symbolic constructs into the self-hosted Lume compiler (lumec) and lcaas without compromising Lume’s core invariants (stage2 == stage3 bit-identical bootstrap, Zero-C steady state, and sound QF_LIA verification).


1. Track N1 — Typed Tensors, Symbolic Shapes ([T0300]) & std.tensor

1.1 Syntax & Symbolic Shape Unification

1.2 compiler/stage1/tensor.src (use tensor)


2. Track N2 — model Types, Autodiff (grad/vjp/jvp/vmap/jit) & kernel fn

2.1 model Declarations & Autodiff Transform

2.2 compiler/stage1/nn.src (use nn)


3. Track N3 — prob Effect, Datalog rule, extern llm fn & std.neuro

3.1 Probabilistic Programming (prob Effect)

3.2 Datalog rule Declarations (std.rules)

3.3 Schema-Constrained extern llm fn & Deterministic Replay (std.llm)

3.4 Spiking Neural Networks (std.neuro)


4. Stage 4 Exit-Criterion Capstones (docs/04-roadmap.md §Stage 4.9)

  1. examples/apps/mnist/: End-to-end MLP digit classifier trained in pure Lume with grad + Adam, verified contracts (lume prove), safetensors + onnx export, and 100% test suite pass.
  2. examples/apps/agent/: Autonomous invoice & policy reconciliation agent combining typed tools, table memory, Datalog rule inference, extern llm fn planner with contract-driven repair, supervisor fault tolerance, and deterministic test llm replay evaluation.