SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2605.09867 · 2026

Continuous Latent Contexts Enable Efficient Online Learning in Transformers

Max Dabagia, Xinyuan Cao, Emile Anand, Abdullah Ateyeh

arXiv · PDF · Open in the Atlas

Code that ran

10 of 11 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 1 violated it and 0 have no contract verdict; 8 failures of our instrument; 1 no recorded run), measured 2026-11-23; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2605.09867.json · badge: /api/ran/2605.09867.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
emiletimothy/transformer_decisionmaker canonical (classifier label)
classifier basis: census
10 ran · 1 no recorded run
FunctionStatusWhere it lives
build_interactive_prompt Ran
ran; our contract draft was wrong, not the code
emiletimothy/transformer_decisionmaker/llm/core/interactive_api_run.py
code served (permissive licence) · get_code("8a975ac268e61be1")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# Build a case dict that matches what build_interactive_prompt expects
case = {
    'expert_predictions': [
        np.array([[0.1, 0.2, 0.3, 0.4, 0.5],
                  [0.6, 0.7, 0.8, 0.9, 1.0]])
    ],
    'learning_rate': 0.001
}

# Build a template string with placeholders
template = "Number of predictions: {n}, Learning rate: {eta}"

ARGS = {
    'case': case,
    'template': template
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
compute_hard_regret Ran
ran; our contract draft was wrong, not the code
emiletimothy/transformer_decisionmaker/llm/core/plot_regret.py
code served (permissive licence) · get_code("80a604582b34845a")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family int; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# Construct arguments for compute_hard_regret
# The function computes regret of a model against expert predictions

# preds: list/array of model predictions (one per timestep)
# true_labels: list/array of true labels (one per timestep)
# expert_preds: list of lists where expert_preds[t][i] is expert i's prediction at time t

n_timesteps = 5
n_experts = 3

# Model predictions for each timestep (binary classification: 0 or 1)
preds = [0, 1, 0, 1, 1]

# True labels for each timestep
true_labels = [0, 1, 1, 0, 1]

# Expert predictions: for each timestep, each expert makes a prediction
expert_preds = [
    [0, 1, 0],  # t=0: expert 0,1,2 predictions
    [1, 1, 0],  # t=1
    [0, 1, 1],  # t=2
    [0, 0, 1],  # t=3
    [1, 1, 1],  # t=4
]

ARGS = {
    "preds": preds,
    "true_labels": true_labels,
    "expert_preds": expert_preds,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family int — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
generate_case Ran
ran; our contract draft was wrong, not the code
emiletimothy/transformer_decisionmaker/llm/core/generate_dataset.py
code served (permissive licence) · get_code("0a5d599db869d49a")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import random

random.seed(0)

ARGS = {
    'n_steps': 5,
    'regime_name': 'stratified'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
generate_dataset Ran
ran; our contract draft was wrong, not the code
emiletimothy/transformer_decisionmaker/llm/core/generate_dataset.py
code served (permissive licence) · get_code("1c6960c26090959f")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import random

ARGS = {
    'regime_name': 'stratified',
    'n_cases': 5,
    'n_steps': 10,
    'seed': 42
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_case Ran
ran; our contract draft was wrong, not the code
emiletimothy/transformer_decisionmaker/llm/core/mw_lib.py
code served (permissive licence) · get_code("4443f92d992c1304")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# Construct the data structure
# The function expects data[split] to be indexable and have len()
# It accesses cases[idx], so cases should be a list or similar sequence

data = {
    'train': [
        {'input': torch.randn(2, 4), 'label': 0},
        {'input': torch.randn(2, 4), 'label': 1},
        {'input': torch.randn(2, 4), 'label': 0},
    ],
    'val': [
        {'input': torch.randn(2, 4), 'label': 1},
        {'input': torch.randn(2, 4), 'label': 0},
    ],
    'test': [
        {'input': torch.randn(2, 4), 'label': 1},
    ],
}

split = 'train'
idx = 0

ARGS = {
    'data': data,
    'split': split,
    'idx': idx,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
has_existing_run Ran
ran, violated the contract we drafted
emiletimothy/transformer_decisionmaker/llm/core/interactive_api_run.py
code served (permissive licence) · get_code("725549216821836e")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned bool, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import os
from pathlib import Path
import tempfile
import shutil

# Create a temporary directory structure to simulate RESULTS_DIR
temp_dir = tempfile.mkdtemp()
os.environ['RESULTS_DIR'] = temp_dir

# Create the necessary directory structure with a completed run
RESULTS_DIR = Path(temp_dir)

# Create nested directories and result.json to simulate a completed run
short_name = 'explicit_update'
model_key = 'bert-base'
split = 'train'
idx = 42

case_dir = RESULTS_DIR / short_name / model_key / f'{split}_{idx:03d}' / 'run_001'
case_dir.mkdir(parents=True, exist_ok=True)

# Create a result.json file to indicate a completed run
result_file = case_dir / 'result.json'
result_file.write_text('{"status": "completed"}')

# Define the arguments for has_existing_run
ARGS = {
    'split': 'train',
    'idx': 42,
    'model_key': 'bert-base',
    'prompt_name': 'interactive_explicit_update'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type bool, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
load_data Ran
ran; our contract draft was wrong, not the code
emiletimothy/transformer_decisionmaker/llm/core/mw_lib.py
code served (permissive licence) · get_code("515c2293b719ea54")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import json
import tempfile
import os

# Create a temporary JSON file with sample data
temp_dir = tempfile.mkdtemp()
json_path = os.path.join(temp_dir, 'mw_dataset.json')

sample_data = {
    "dataset": [
        {"id": 1, "text": "sample text 1", "label": "A"},
        {"id": 2, "text": "sample text 2", "label": "B"}
    ],
    "metadata": {
        "version": "1.0",
        "size": 2
    }
}

with open(json_path, 'w', encoding='utf-8') as f:
    json.dump(sample_data, f, ensure_ascii=False)

ARGS = {
    'json_path': json_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
mw_predictions Ran
ran, honoured the contract we drafted
emiletimothy/transformer_decisionmaker/llm/core/plot_regret.py
code served (permissive licence) · get_code("bdcaeedc5fb7d27e")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family int; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import math

# Construct a valid case dict for the mw_predictions function
# The function expects:
# - expert_predictions: list of predictions from each expert at each timestep
# - true_labels: list of true labels at each timestep
# - losses: list of loss vectors (one per expert) at each timestep
# - learning_rate: a scalar learning rate

T = 5  # number of timesteps
n_experts = 3  # number of experts

# Create expert predictions: T timesteps, each with n_experts predictions (0 or 1)
expert_predictions = [
    [0.2, 0.8, 0.5],  # timestep 0: 3 expert predictions
    [0.4, 0.7, 0.3],  # timestep 1
    [0.1, 0.9, 0.6],  # timestep 2
    [0.5, 0.6, 0.4],  # timestep 3
    [0.3, 0.8, 0.7],  # timestep 4
]

# Create true labels: T timesteps with binary labels
true_labels = [1, 0, 1, 0, 1]

# Create losses: T timesteps, each with n_experts loss values
losses = [
    [0.5, 0.2, 0.3],   # timestep 0: loss for each expert
    [0.3, 0.4, 0.6],   # timestep 1
    [0.7, 0.1, 0.4],   # timestep 2
    [0.2, 0.5, 0.5],   # timestep 3
    [0.4, 0.2, 0.3],   # timestep 4
]

case = {
    'expert_predictions': expert_predictions,
    'true_labels': true_labels,
    'losses': losses,
    'learning_rate': 0.1,
}

ARGS = {
    'case': case,
    'T': 3,  # Use only first 3 timesteps
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family int — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
normalize Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
emiletimothy/transformer_decisionmaker/llm/core/mw_lib.py
code served (permissive licence) · get_code("689af84f508eb77b")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# The function normalize() takes a 'weights' parameter
# It sums the weights, asserts the sum is positive, and returns normalized weights
# The function expects weights to be iterable and support division

# Valid weights: a list of positive numbers
weights = [1.0, 2.0, 3.0, 4.0]

ARGS = {
    "weights": weights
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
normalize Ran
ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT)
emiletimothy/transformer_decisionmaker/llm/core/plot_regret.py
code served (permissive licence) · get_code("745e4f10377bd3d7")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

torch.manual_seed(0)

# Analyze the function:
# - normalize(w) takes a single parameter 'w'
# - It calls sum(w), so w must be iterable
# - It iterates over w with [x / s for x in w], so elements must be numeric
# - It checks if s > 0
# - Returns a list of normalized values or uniform distribution

# Create a simple numeric list as input
w = [2.0, 4.0, 6.0, 8.0]

ARGS = {
    "w": w
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_run_dir Not yet run
unverified (harvested, no recorded run)
emiletimothy/transformer_decisionmaker/llm/core/interactive_api_run.py
code served (permissive licence) · get_code("e36976fff3060846")
How it ran

no invocation recorded.

Also present in other papers' code

Of 11 samples lifted from this paper's linked repositories, 11 carry a function identity and 0 do not. Of the 11 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 11 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Large language models (LLMs) exhibit a strong capacity for in-context learning: Given labeled examples, they can generate good predictions without parameter updates. However, many interactive settings go beyond static prediction to online decision-making, in which effective behavior demands adaptation over long multiturn horizons in response to feedback, and efficient algorithms in these domains must use compact representations of what they have learned. Recently, continuous transformer architectures with latent chain of thought have shown promise for offline iterative tasks such as directed graph-reachability. Motivated by this, we study whether continuous latent context tokens equip transformers to more effectively realize online learning. We give explicit constructions of constant-depth transformers that implement two foundational online decision-making procedures -the weighted majority algorithm and Q-learning -by storing their algorithmic state as linear combinations of feature embeddings, using a small number of latent context tokens. We further train a small GPT-2-style transformer with latent contexts using a multi-curriculum objective that does not directly supervise the latent states. On long synthetic online prediction sequences, this model outperforms larger and more complex LLMs, including Qwen-3-14B and DeepSeek-V3. Our results suggest that continuous latent contexts provide a simple and effective persistent state for transformers to implement online learning algorithms. * Do not use any external tools. * Do not write or execute code. * Do not provide any explanation or reasoning steps. * Keep the note short and compact. * The note must be at most 500 words long. * The note should contain only the most useful information for future predictions. * Do not repeat the full history. * Output valid JSON only -no explanation, no reasoning steps, no other text. * Do not use any external tools. * Do not write or execute code. * Do not provide any explanation or reasoning steps. * Keep the note short and compact. * The note must be at most 500 words long. * The note should contain only the most useful information for future predictions. * Do not repeat the full history. * Output valid JSON only -no explanation, no reasoning steps, no other text.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2605.09867")
get_code_for_paper("2605.09867")
have("2605.09867")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2605.09867.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2605.09867.svg)](https://syntology.ai/paper/2605.09867)

Connect an agent — have() is free.