Retrieve a visible source value for a shuffled query sharing an unseen Hash identity.
A query must recover the source value with its matching identity from one shuffled memory branch. Every row has fresh values and identifiers; fixed positions and persistent vocabulary memorization cannot determine the answer.
Seed 17 on gpu: 5 of 5 behavioral checks met. See the measurements below.
Insights
The model recalls values for unseen keys, and breaking the key relationship removes that skill. Fresh values and independently shuffled records prevent fixed positions or remembered answers from reliably solving the task. Hash preserves equality without a learned vocabulary; the Boolean query mask hides only query values, leaving source values visible.
The decoder can use both retained ancestor context and the value field’s own visible source parcel. Aligned identity and role fields condition each repeated query. Rotating query keys while retaining original targets tests whether that relationship matters. This supports learned recall for two pairs, not a deterministic lookup guarantee. Larger memories, absent or duplicate keys, and collisions remain untested.
Setup
Code
"""Retrieve unseen keys from source/query records shuffled into one branch.Only query values are masked. Independent order and unseen identities preventpositional copying and vocabulary memorization. Rotating query keys whileretaining targets tests whether successful recall actually uses identity.Run this file with --help for seed, training-budget, and reporting options."""from __future__ import annotationsfrom collections.abc import Iteratorfrom functools import partialimport lightning.pytorch as litimport numpy as npimport torchfrom reporting import reportimport relflow as rfPROOF_ID ="P025"PAIR_COUNT =2
Queries are interleaved in another order, and source values have changed. The correct hidden targets follow the matching source values, not a remembered number for K1 or K2.
The control keeps the first record’s query targets but swaps the query keys. Those retained targets are deliberately no longer the values of their visible keys. A model using identity should lose accuracy against them.
Synthetic data and controls
Code
def records(*, rows: int, seed: int, namespace: str, broken_identity: bool=False) -> Iterator[dict]:"""Generate unseen, observation-local key/value associations.""" rng = np.random.default_rng(seed)for row inrange(rows): keys = [f"{namespace}-{row:06d}-{pair:02d}"for pair inrange(PAIR_COUNT)] values = rng.uniform(-1.0, 1.0, size=PAIR_COUNT) query_keys =list(keys)if broken_identity: query_keys = query_keys[1:] + query_keys[:1] source_order = rng.permutation(PAIR_COUNT) query_order = rng.permutation(PAIR_COUNT) source = [{"entity_id": keys[index], "value": float(values[index])} for index in source_order] target = [{"entity_id": query_keys[index], "value": float(values[index])} for index in query_order] memory = [{**item, "role": "source", "is_query": False} for item in source] memory.extend(({**item, "role": "query", "is_query": True} for item in target)) rng.shuffle(memory)yield {"memory": memory}def normalized_rmse(model: rf.Model, records: list[dict]) ->float:"""Score only query coordinates; source values remain visible to the model.""" output = model.predict(records).to_pylist() actual, predicted = [], []for row, result inzip(records, output, strict=True):for item, coordinate inzip(row["memory"], result["predictions"]["association/memory/value"], strict=True):if item["is_query"]: actual.append(item["value"]) predicted.append(coordinate["content"]) actual = np.asarray(actual)returnfloat(np.sqrt(np.mean(np.square(np.asarray(predicted) - actual)) / np.mean(np.square(actual))))
Model tree
Figure 1: The root and shuffled memory branch keep all tokens. The Boolean mask hides query values while leaving source values visible.
Both branch and root use reduction=None. The value field uses rf.Mask(query="is_query", dropout=False, reconstruct=True).
How it works
Coordinate-local encoding binds a source identity to its value. Visible fields at each query coordinate condition its decoder query over retained memory. Source and query orders are independently shuffled. Rotating only query keys while retaining target values should destroy the original association. The aligned control shows what happens when position alone supplies an alternative answer path.
Calibrate across three core seeds and ten lightweight seeds. Test complete record permutations, simultaneous key renaming, larger memories, absent or duplicate keys, padding, and Hash collisions. Use an explicit application lookup when the mapping must be exact.
Reproduce
Run by stable ID from the repository root:
uv run python proofs/run.py P025
Or run the self-contained script directly:
PYTHONPATH=proofs uv run python proofs/relational/hash_recall.py
Add --accelerator gpu for CUDA or --seed 42 for another seeded experiment. --steps 2 checks execution with a short training budget; it is recorded as a smoke run.