ARTI

Read it. Try it. Make it yours.

Programs and workloads.

English and Chinese Transformer reading cases, a reproducible comparison, and a first neural program you can understand.

01 / SHARED NEURAL PROGRAM

A Bank-gated recurrence.

The same public FormulaScan runs five steps in PyTorch and native JAX, returning hidden and accumulated carry. Selected Bank values receive finite, nonzero gradients.

Executable declaration

A recurrence composed from typed Add, Scale, sigmoid and tanh, with named carry and Bank operands.

Python source

Observed execution

Inputs, emissions, returned carry, selected gradients and the bounded CPU JAX jit comparison.

Record

Workloads and evaluation

Inspect the workload. Evaluate the profile.

See the comparison

01 / LOCAL PYTHON · CPU

Inspect a small Formula mechanism.

After the reading starter, inspect a trainable numerical operand and returned state in this small CPU program. It demonstrates the mechanism, not task effectiveness.

Program walkthrough
resource-program.py
from json import dumps
from torch import autograd, nn, tensor
from arti import mechanisms as api

pair = api.TensorType(("C",), (2,), dtype="float32")
signal = api.InputBinding("signal", pair)
carry = api.InputBinding("carry", pair)
bank = api.BankBinding("weight", "tutorial/carry-weight@1", "weight", api.TensorType((), (), dtype="float32"))
transition = api.add(carry, api.scale(signal, bank))
summary = api.reduce_tensor(transition, axis="C", mode="sum")
program = api.FormulaProgram.build(outputs=(summary, transition))
parameter = nn.Parameter(tensor(0.75))
provided = dict(signal=tensor([4.0, -2.0]), carry=tensor([1.0, 1.0]))
emitted = api.FormulaFabricV2(program)(inputs=provided, banks=dict(weight=bank.bind(parameter)))
readout, returned_carry = emitted.values
gradient = autograd.grad(readout, parameter)[0]
record = dict(readout=readout.item(), next_carry=returned_carry.detach().tolist(), weight_vjp=gradient.item())
print(dumps(record))

Download Python file ↗python resource-program.py
RECORDED LOCAL CPU OUTPUT

The readout has a weight VJP of 2. The original carry stays unchanged; the program returns a new carry.

{
  "readout": 3.5,
  "next_carry": [
    4.0,
    -0.5
  ],
  "weight_vjp": 2.0
}

This example makes one forward call and a VJP, with no optimizer update. The caller decides whether to adopt the new carry in another call.

02 / PUBLIC SOURCE

Continue in the source.

These links point to the exact public revision used by this website.

Numerical composition

Typed operands, trainable Bank values and gradients.

Source

Explicit recurrence

Follow caller-owned carry through a bounded FormulaScan.

Source

Application task

A project tutorial covering checkpoints, committed output and offline handoff.

Tutorial

Native regression task

An official non-language example with a native resource graph, original labels and task-owned loss. Its scikit-learn data dependency belongs to the example.

Source

Training recovery

Inspect a saved run, resume its original target or deliberately finalize evaluation and export.

Source