Implicit Higher-Order TPR Memory
Source paper: TPR-Attention for Combinatorial Generalization arXiv:2608.30124 ⓘ · analyzed Sep 2, 2026
AI-generated research hypothesis, automatically tested. Not peer-reviewed.
Idea description
Support conjunction queries over multiple roles without explicitly storing a huge tensor of repeated objects. Represent the required higher-order memory through query-dependent contractions, enabling compositional retrieval with memory that scales linearly in the number of objects.
Formulas
Mathematical statement
For an order-s object \(\bm{\mathsfit O}_t\), the paper constructs a higher-order memory \(\bm{\mathsfit M}=\sum_t\bm{\mathsfit O}_t^{\otimes j}\), where \(\bm{\mathsfit O}_t^{\otimes j}\) is the j-fold outer product and the dimensional condition for contracting an order-m query is \(j\cdot s-m=n\), with m the query order and n the output order. For order-2 objects, \(\bm{\mathsfit O}_t=\sum_i\bm r_i\otimes\bm f_i^t\). A conjunction query containing m role-filler bindings is \(\bm{\mathsfit Q}=\bigotimes_{k=1}^m\bm q_k\), where \(\bm q_k=\bm r_{a_k}\otimes\bm f_{a_k}\). Instead of materializing the explicit higher-order tensor, compute each object's score directly as \(s_t=\prod_{k=1}^m\langle\bm q_k,\bm{\mathsfit O}_t\rangle\). This factorization follows because contraction distributes over outer products. Soft retrieval uses \(a_t=\operatorname{softmax}_t(s_t/\tau)\), after which any target role can be extracted from the selected objects.
Implementation notes
Integrate this at the memory or retrieval layer of a Transformer, relational graph network, or object-centric world model. Input objects are F[B,N,R,D]; a conjunction query contains m pairs of role indices a_k and filler queries q_f[k]. Do not construct the paper's explicit order-j tensor, whose storage grows exponentially with tensor order. Instead compute one scalar contraction per query factor: c[k,n] = dot(normalize(q_f[k]), normalize(F[:,n,a_k])). Form the higher-order score score[n] = product_k c[k,n]. For numerical stability, use log_score[n] = sum_k log(max(c[k,n], epsilon)) when similarities are nonnegative, or retain sign bits and sum log(abs(c[k,n]) + epsilon) when signed fillers are required. Normalize with a = softmax(score / tau) and extract the requested output role using out = einsum('bn,bnd->bd', a, F[:,:,target_role,:]). For multiple heads, assign separate conjunction queries and concatenate outputs. The paper provides the higher-order contraction factorization; empirical choices are filler normalization, epsilon, temperature, and whether to use products or sums of log similarities. First cheap experiment: synthetic set reasoning with 4 roles, 8 fillers per role, 32 to 256 objects, and two- or three-factor conjunction queries. Compare dense flattened high-order attention, ordinary single-factor attention, and this factorized module at equal retrieval FLOPs while recording peak memory. Pre-register that peak memory grows linearly with object count, three-factor held-out conjunction accuracy exceeds single-factor attention by at least 15 points, and the top-1 minus top-2 score margin increases by at least 20 percent from two to three factors. Ablate only the product factorization by replacing it with an MLP over concatenated factor similarities. Falsification is superlinear memory, no conjunction-specific accuracy improvement, or a non-increasing score margin.
Verification
Stage 1 · Toy mechanism gate: Passed ✓
Stage 2 · Mechanism transferred to benchmark: Confirmed ✓
Stage 2 · Practical benchmark result: No measurable effect
Stage 1 — Mechanism check agent confidence 8/10
Built an implicit higher-order TPR retrieval MVP with factorized conjunction scores, soft retrieval, and target-role extraction. Explicit tensor contraction matched the factorized product to 4.44e-16 maximum error. Across 32–256 objects, factorized retrieval achieved 100% accuracy versus 0.7–16.3% for single-factor attention, while the storage proxy scaled linearly in object count and explicit higher-order storage grew much faster.
- Agent confidence
- 8/10
- Baseline
- Single-factor accuracy was 6.3%, 2.0%, and 0.7% for N=32,128,256 at m=2; 16.3%, 5.0%, and 1.3% at m=3.
- Idea
- Factorized accuracy was 100% for all tested N and m. Mean factorized margins were 0.504, 0.374, 0.332 for m=2 and 0.756, 0.694, 0.655 for m=3. Factor memory proxy was 2048, 8192, 16384 versus explicit m=3 proxy 8388608, 33554432, 67108864.
Limitations: This is a NumPy toy benchmark, not a trained Transformer or world model. Explicit memory was estimated by scalar-count proxy rather than measured by materializing tensors; no MLP ablation, signed-filler stability study, or FLOP-matched neural baseline was tested.
How to run: python3 experiment.py
Stage 2 — Benchmark vs. tuned baseline
Ahead of the baseline (−0.7%) but not statistically significant (p=0.3421, wins 5 / 8 paired seeds).
- Benchmark
- Sequence modeling
- Model
- shared_transformer_token_attention
- Paired seeds
- 8
- Baseline mean
- 1.0231
- Idea mean
- 1.0161
- Effect (Δ)
- -0.007 (−0.7%; negative = idea better)
- Wins
- 5 / 8 paired seeds
- p-value
- 0.3421 (permutation test, 20 000 shuffles)
- Smallest detectable effect
- ±1.6%
- Mechanism
- Confirmed ✓
- Practical effect
- No effect
- Baseline tuning
- swept over 6 configs
Only the built-in sequence forecast track was tested with 400 training examples, 100 test examples, 15 epochs, and a compact transformer. No vision, tabular, dynamics, custom-track, explicit materialized tensor memory benchmark, signed-filler ablation, or larger-scale speed study was run.
How to run: python3 run_bench.py
Verdict computed by deterministic test code from paired-seed statistics — not by the language model.
Stage 2 — Benchmark latest Failed ✗
Agent confidence: 9/10
Implemented implicit two-factor higher-order attention as an end-to-end modification on the structurally matched sequence forecast track, with an identical single-factor baseline architecture and paired-seed training. The idea achieved MSE 1.016057 versus baseline 1.023103, a small improvement, but the permutation p-value was 0.34205, so there was no significant benchmark win. The trained-model contraction signature matched the product factorization with maximum error 0.0 and correlation 0.99999994, confirming the mechanism but not a task-performance improvement.
- Baseline
- Full 8-seed test MSE 1.0231029689; best configuration lr=0.003, tau=0.25. Baseline sweep covered lr={0.001,0.003,0.01} and tau={0.25,0.5}.
- Idea
- Full 8-seed test MSE 1.0160572454 at lr=0.003, tau=0.25; paired delta=-0.0070457235, 5/8 wins, permutation p=0.34205.
Benchmark result
Ahead of the baseline (−0.7%) but not statistically significant (p=0.3421, wins 5 / 8 paired seeds).
- Benchmark
- Sequence modeling
- Model
- shared_transformer_token_attention
- Paired seeds
- 8
- Baseline mean
- 1.0231
- Idea mean
- 1.0161
- Effect (Δ)
- -0.007 (−0.7%; negative = idea better)
- Wins
- 5 / 8 paired seeds
- p-value
- 0.3421 (permutation test, 20 000 shuffles)
- Smallest detectable effect
- ±1.6%
- Mechanism
- Confirmed ✓
- Practical effect
- No effect
- Baseline tuning
- swept over 6 configs
Only the built-in sequence forecast track was tested with 400 training examples, 100 test examples, 15 epochs, and a compact transformer. No vision, tabular, dynamics, custom-track, explicit materialized tensor memory benchmark, signed-filler ablation, or larger-scale speed study was run.
How to run: python3 run_bench.py
Artifacts
- bench_report.json 3.0 KB View Raw JSON
- experiment.py 4.7 KB View Raw JSON
- report.md 1.3 KB View
- report_bench_2026-09-02T122656.md 4.4 KB View
- results.json 2.1 KB View Raw JSON
- run_bench.py 5.7 KB View Raw JSON