Tensegra

Engineering reliable agents through programmable attention, typed symbolic execution, dependency-aware reuse, and causal evaluation: isolate model–tool failures, quantify useful computation, and test repairs against verified task utility.


I built Tensegra to make agent reliability and compute cost measurable at the level where they arise: attention routing, operand binding, dependency validity, execution, and return consumption. A useful agent must distinguish reusable work from stale work, allocate another inference or tool call only when it can change the decision, and preserve exact intermediate results through a distributed neural state. Tensegra provides the PyTorch modules, protected runtime interfaces, procedural environments, and causal diagnostics needed to engineer that boundary. The application targets are dependency-aware workflow automation, tool orchestration, and adaptive inference; the evaluation substrate is deliberately controlled.

GitHub: source, protocols, and audits · Hugging Face: analyses, checkpoints, and source snapshots

Problem

An agent's cache key is not its validity condition. A retrieved computation may match the current query while depending on an obsolete requirement, a different entity binding, or an invalidated predecessor. Similarly, a correct auxiliary prediction is useful only if the policy reads it, and an exact tool return is useful only if subsequent state updates preserve its decision-relevant information. These are distinct interface failures with different remedies. I make them separately observable through explicit entity identity, typed relations, admissibility checks, state-transition records, and interventions on the values crossing each boundary: debugging mechanisms, not just scores.

Solution

The architecture separates a continuous workspace Ht∈RL×dH_t\in\mathbb{R}^{L\times d} from a symbolic store with stable identities and typed operations. Recurrent microsteps refine the workspace, propose candidate-local operations, estimate readiness, and conditionally commit admissible transitions. A return encoder maps the resulting typed event back into the next recurrent update. Schematically, ct=Cθ(Ht,Gt)c_t=C_\theta(H_t,G_t), (Gt+1,rt)=Exec⁡(Gt,ct)(G_{t+1},r_t)=\operatorname{Exec}(G_t,c_t) when the gate admits the proposal, and Ht+1=Fθ(Ht,Eθ(rt),xt)H_{t+1}=F_\theta(H_t,E_\theta(r_t),x_t). Here xtx_t denotes current public input; the notation summarizes the interface, not a claim that all experiments share one controller.

Tensegra: the interface between a network and an exact executor Tokens attend by content, plus a structural bias built from a declared entity graph through soft token-to-entity bindings, one bias per relation. The attention output updates a recurrent workspace, which re-grounds its bindings, proposes a typed operation with operands and a readiness estimate, and passes it to an admissibility gate. An exact, protected executor runs admitted proposals, advancing the entity graph rather than the weights, and a return encoder feeds the typed result back into the workspace. In later worlds a policy reads the workspace to choose whether to compute, reuse, probe or stop, scored by verified success minus cost. Tokens measurements · text Structural bias one Bᵣ per relation Soft binding token ↔ entity Entity graph identities · typed relations Attention QKᵀ/√d + Σ λᵣ Bᵣ Workspace Hₜ, recurrent microsteps Proposal op · operands · ready? Admissibility gate legal and ready only Exact executor protected, outside the weights Return encoder typed result → workspace Policy compute · reuse · probe · stop Task utility verified success − cost content bias re-ground admit result execution advances the graph, not the weights later worlds
The whole interface in one pass: structure enters attention as a bias, execution happens outside the weights, and every boundary a value crosses can be intervened on.

Execution is a protected boundary: a proposal names its operator and operands, a gate checks that it is legal and ready, and an exact executor advances the symbolic store while the surrounding latent state keeps evolving; the encoded result then returns to the workspace. This separates execution authority from representation learning and makes auditable tool execution an architectural boundary rather than an interpretation of generated prose. (A sibling project, Typed Crystallization Networks, takes the opposite route and commits a learned structure itself to an exact program; Tensegra keeps the network and the executor separate and studies the interface between them.)

How

Programmable attention geometry. A runtime graph carries batched entity identities, immutable identity features, relation tensors A∈RB×R×N×NA\in\mathbb{R}^{B\times R\times N\times N}, and padding masks independently of token order. Separate query/key projections produce soft bindings PqP_q and PkP_k with an edge-free null slot. After excluding that slot, each relation induces a token-space bias Br=PqArPk⊤B_r=P_qA_rP_k^\top. Attention combines content logits with weighted structural biases, S=QK⊤/dk+∑rλrBrS=QK^\top/\sqrt{d_k}+\sum_r\lambda_rB_r, or applies an explicit legal-read mask. Recomputing grounding from the recurrent residual allows the query's evolving identity to select a new symbolic neighborhood. Soft bias, hard locality, graph-as-input controls, and explicit pointer writes are separate experimental arms; they confer different structural information and computational authority.

Typed lowering and protected state. The recurrent execution studies factor candidate construction into operator choice, argument references, type compatibility, and readiness. Identity-only grounding, cosine-normalized projections, attention-weighted immutable-key writes, and append-only exact execution isolate binding stability from content computation. A proposal can therefore be inspected before commitment, and an execution event can be traced to its operands and preconditions. Return-drop, return-shuffle, and wrong-value interventions test whether subsequent decisions depend on the executed result; first-error, persistence, recovery, and reconvergence statistics locate where the state trajectory diverges. This is the machinery for fault isolation across model–tool boundaries.

Dependency-aware reuse and metacontrol. The later environments expose evolving requirement versions, commitments, retrieved records, and applicability relations. Policies choose computation, retrieval, validation, reuse, probing, revision, or stopping under resource charges. Verified success and accumulated cost define task utility; model-selection criteria distinguish a cheaper successful trajectory from an early unsuccessful halt. Strategy-selection worlds expose public information separately from hidden-state oracles, so a learned controller can be compared against an attainable simple-policy baseline before committing more training budget. Measure headroom before scaling is a concrete decision rule here: establish what public information can buy, identify the residual regret, then test the proposed mechanism against that residual.

Tests

The harness couples initial parameters, data schedules, and procedural populations across ablations; separates training, selection, and held-out seeds; freezes source/configuration identities; and retains process-level resource receipts. Relation removal and permutation probe structural dependence, while oracle bindings and exact traces distinguish execution capacity from policy acquisition. Candidate-local/global gates, fixed/recurrent compute, and protected/learned transitions isolate interface choices rather than changing several factors at once. Independent analysis scripts reconstruct reported endpoints directly from raw records.

For the factor-consumption experiments, a genuine shaping × reading design separates auxiliary gradients through the shared trunk from explicit factor inputs to the policy. Exact, zero, mean, and in-support substituted factors test causal consumption; out-of-fold and noise-mixed training contracts control exposure to predictor error. Counterfactual octets vary factor combinations while preserving matched instances. Flip, invariance, and near-miss populations distinguish correct action changes from indiscriminate sensitivity or conservatism. Per-seed contrasts and two-level bootstrap intervals, where specified, separate configuration uncertainty from seed variation. The result is causal evaluation for architecture decisions, with acquisition error, representation use, and interaction discrimination measured independently.

Results

Tensegra (called Topoformer until the rename) ran eleven stages and seven campaigns between 22 and 27 September 2026, 1,862 commits, all on synthetic tasks with no real data or pretrained model. Each step asked one question about one boundary:

stepquestionresult
stage 1–2does a true-graph bias help?yes: 3–12% lower error across 570 runs, transferring from 12 to 128 nodes; a permuted graph removes the gain
stage 3can grounding be learned?0.966 at depth 4, 0.19 at depth 32; a graph supplied as input gets 0.997
stage 4can a pointer survive depth?99.74% at depth 64, but only with a hand-programmed write
stage 5can text be translated into an exact interpreter?96.88% supervised; 1–5% from answer-only reward
stage 6–9can a recurrent workspace execute?no: 0 of 1,111 executions had the right operands; at width 1024 every broad gate failed
stage 10–11which interfaces hold in isolation?beliefs are ID-invariant (90/90); returns are read 50.65% of the time at 32 steps; text-to-graph works on fixed graphs, 0/512 fresh
extended-02do input contracts fix things?yes: provenance 0.35 → 1.00, failures 126 → 0; population training lost to multistart
extended-03is the dependency input used?yes: invalid reuse 0.41–0.46 without it, ≤ 0.014 with it; RL collapsed in 2 of 3 runs
extended-04–06does a learned controller beat simple rules?no: RL never beat imitation (best +0.002), delegation only recovered the teacher, and one world lacked the headroom to try
extended-07do factor channels help?shaping the trunk helps (+0.074); reading the factors didn't replicate

The most consistent finding is the last two rows: wherever a learned policy or meta-controller was compared against imitation or a simple rule with the same information, it did not win.

The 570-run structural-attention study covers efficiency, topology corruption, graph transfer, heterogeneous mechanisms, and learned biases. The recurrent workspace study retains 780 declared evaluation rows, 11,520 training rows, and 225 checkpoints across 45 seed/arm runs. In Campaign03, full-input imitation bootstrap endpoints reached 0.93–0.98 sealed IID success with near-zero invalid reuse; applicability interventions connected behavior to the supplied dependency relations. These are bounded endpoint measurements with explicit supervision and information contracts.

The scope remains research: free recurrent policies did not acquire reliable exact execution and return reintegration, later RL degraded competent bootstrap policies, and the final consumer intervention did not pass its composition gate and replicate. The synthetic tasks supply structural/semantic interfaces; production savings and general autonomous symbolic reasoning are not established. The recurrent execution report and final mechanism audit document those boundaries.

Lessons

My engineering contribution is the decomposition from a broad reliability problem into replaceable, instrumented contracts: perception → binding → admissibility → execution → return encoding → policy consumption. That decomposition turns “the agent got stuck” into a testable distinction between a stale dependency, an incorrect operand, premature readiness, a lost return, and a policy that ignores valid information. Reproducible systems diagnosis is the transferable capability: construct the smallest environment that preserves the failure mechanism, establish strong matched controls, account for compute, and connect a repair to verified task utility.

The research record links implementations to frozen protocols, analyses, and independent audits. The Hugging Face archive holds campaign03–07 analyses and checkpoint artifacts with source snapshots and environment metadata, providing a concrete starting point for reproducing the mechanisms and testing a different controller.