ARTI

ARTI guides

Programs and tensor resources

Express computation explicitly, then decide who owns its parameters and evolving state.

On this page

Compose the numerical work

FormulaProgram describes a typed computation with named axes, inputs and Bank operands. FormulaFabricV2 executes that declaration. Arithmetic, contraction, reduction, indexing, masks, local windows and Observation can become parts of a larger program, while the operand bindings remain inspectable.

Connect values through resources

A TensorResource declares a value's tensor contract and lifetime. A Connection relates resource ports; numerical nodes read and publish values through those ports. ProgramGraph gives this composition an execution structure instead of leaving every dependency implicit in application code.

  • Stages let ready operations read one snapshot before publishing completed writes.
  • Routes choose declared branches; joins track arrivals at a convergence point.
  • Bounded loops carry declared state and stop according to their execution contract.

Separate declaration, parameters and state

The program specifies what executes. Parameters supply trainable numerical values. Forward state carries values and execution cursors between the calls that retain them. Keeping these objects distinct lets the application choose what learns, what persists and where gradients continue.

  • Persistence alone does not make a resource an optimizer parameter.
  • An optimizer update and a differentiable forward write are different operations.
  • For functional state interfaces, including carry and native JAX APIs, the caller passes returned state into a later invocation when continuation is desired.

Define how the program learns

The application provides the objective. Shared parameter owners and independently declared learning regions can have different credit and optimizer contracts. A branch, routing decision or persistent value does not automatically receive a useful task-learning rule simply because it appears in the graph.

A small Formula example

After the reading starter, use this small CPU program to inspect declared operations, a learnable operand and a returned carry. It is a mechanism example, not a task-effectiveness benchmark.

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.

Choose an execution boundary

A fixed graph and a dynamic search have different admission and compilation requirements. ARTILayer hosts a configured graph or federation; its unconfigured form supplies identity rather than learned adaptation. Component identities, configuration schemas and package versions are recorded separately.