| batched_log_likelihood |
Ran ran; our contract draft was wrong, not the code |
XunZhiyang/llm-tv-estimation/experiments/tv_estimate.py code served (permissive licence) · get_code("b095fe5945243629") How it ranRan 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 Tensor, ndim 1, dtype family float, shape (2,) 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 torch
import torch.nn as nn
from transformers import AutoModelForCausalLM
torch.manual_seed(0)
class TinyLanguageModel(nn.Module):
"""Minimal causal language model for testing."""
def __init__(self, vocab_size=256, hidden_size=4):
super().__init__()
self.embed = nn.Embedding(vocab_size, hidden_size)
self.lm_head = nn.Linear(hidden_size, vocab_size)
def forward(self, input_ids):
hidden = self.embed(input_ids)
logits = self.lm_head(hidden)
return type('Output', (), {'logits': logits})()
def get_input_embeddings(self):
return self.embed
# Create model on CPU
model = TinyLanguageModel(vocab_size=256, hidden_size=4)
# Create input_ids tensor: batch_size=2, seq_len=7
# Using values in range [0, 255] for vocab_size=256
input_ids = torch.tensor([
[10, 20, 30, 40, 50, 60, 70],
[15, 25, 35, 45, 55, 65, 75]
], dtype=torch.long)
# prompt_len indicates first 3 tokens are prompt, rest are generated
prompt_len = 3
ARGS = {
'model': model,
'input_ids': input_ids,
'prompt_len': prompt_len
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- torch, transformers — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type Tensor, ndim 1, dtype family float, shape (2,) — shape (2,) 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
|
| build_fixed_B |
Ran ran; our contract draft was wrong, not the code |
XunZhiyang/llm-tv-estimation/experiments/inference_engines/phase_score_fixed_B.py code served (permissive licence) · get_code("2caa9d77c083a972") How it ranRan 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
torch.manual_seed(0)
# X: (N, L) tensor of targets
# N=2 targets, L=4 sequence length
X = torch.randn(2, 4)
# B: batch size (fixed)
B = 3
# k: some kind of identifier or index
k = 1
# filler_pool: tensor of filler sequences to sample from
# Should have shape (num_fillers, L) where L matches X's sequence length
filler_pool = torch.randn(5, 4)
# seed: random seed for reproducibility
seed = 42
ARGS = {
'X': X,
'B': B,
'k': k,
'filler_pool': filler_pool,
'seed': seed
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- 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
|
| check_package |
Ran ran, violated the contract we drafted |
XunZhiyang/llm-tv-estimation/experiments/check_env.py code served (permissive licence) · get_code("fdb670c1b48c4ee3") How it ranRan 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 torch
import sys
torch.manual_seed(0)
ARGS = {
'display_name': 'torch',
'import_name': 'torch',
'min_version': '1.0.0',
'install_name': 'torch',
'optional': False
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- packaging, torch — 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
|
| engine_score_path |
Ran ran; our contract draft was wrong, not the code |
XunZhiyang/llm-tv-estimation/experiments/inference_engines/phase_score_sigma.py code served (permissive licence) · get_code("6543f078e7993be9") How it ranRan 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
torch.manual_seed(0)
# The function engine_score_path takes a single parameter 'path'
# which is compared against the string 'decode'
# It returns 'replay' if path == 'decode', else 'seq'
ARGS = {
'path': 'decode'
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- 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
|
| lps_from_topk |
Ran ran; our contract draft was wrong, not the code |
XunZhiyang/llm-tv-estimation/experiments/inference_engines/phase_score.py code served (permissive licence) · get_code("281e79b44a69f948") How it ranRan 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 Tensor, ndim 2, dtype family float, shape (2, 4) 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 torch
torch.manual_seed(0)
# Build tiny tensors for the function
# topk_idx: (B, n, k) - indices of top-k elements
# topk_val: (B, n, k) - values of top-k elements
# targets: (B, n) - target indices to match against
B = 2 # batch size
n = 4 # number of positions
k = 3 # number of top-k candidates
topk_idx = torch.randint(0, 10, (B, n, k))
topk_val = torch.randn(B, n, k)
targets = torch.randint(0, 10, (B, n))
ARGS = {
"topk_idx": topk_idx,
"topk_val": topk_val,
"targets": targets,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type Tensor, ndim 2, dtype family float, shape (2, 4) — shape (2, 4) 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
|
| md5_of |
Ran ran; our contract draft was wrong, not the code |
XunZhiyang/llm-tv-estimation/experiments/inference_engines/phase_score_fixed_B.py code served (permissive licence) · get_code("292eaa7bd7e66589") How it ranRan 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 tempfile
import os
# Create a temporary file with some content to compute MD5 of
temp_fd, temp_path = tempfile.mkstemp()
try:
# Write some test data to the temporary file
os.write(temp_fd, b"Test data for MD5 hashing")
finally:
os.close(temp_fd)
ARGS = {
"path": temp_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 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
|
| method1_fused |
Ran ran; our contract draft was wrong, not the code |
XunZhiyang/llm-tv-estimation/experiments/fig1/methods.py code served (permissive licence) · get_code("539cce93eb835e76") How it ranRan 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 math
torch.manual_seed(0)
# Construct pi_pool dict
# The function accesses:
# - pi_pool['sample_L_pi']: shape (batch, ..., n_samples) → sum(dim=-1) → (batch,)
# - pi_pool['score_L_mu']: shape (batch, 1, n_scores) → [:, 0, :] → (batch, n_scores) → sum(dim=-1) → (batch,)
# - pi_pool['meta']['n']: scalar
batch_size = 2
n_samples = 4
n_scores = 3
n = 5
sample_L_pi = torch.randn(batch_size, n_samples)
score_L_mu = torch.randn(batch_size, 1, n_scores)
pi_pool = {
'sample_L_pi': sample_L_pi,
'score_L_mu': score_L_mu,
'meta': {'n': n}
}
ARGS = {
'pi_pool': pi_pool
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- 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
|
| method5_fused |
Ran ran; our contract draft was wrong, not the code |
XunZhiyang/llm-tv-estimation/experiments/fig1/methods.py code served (permissive licence) · get_code("f8f867817adde23a") How it ranRan 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 math
torch.manual_seed(0)
# Construct pi_pool dict with required keys
pi_pool = {
'sample_L_pi': torch.randn(2, 4), # batch=2, dim=4
'score_L_mu': torch.randn(2, 1, 4), # batch=2, seq=1, dim=4
'meta': {'n': 5}
}
ARGS = {
'pi_pool': pi_pool
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- 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
|
| method5_pi_direct_K |
Ran ran; our contract draft was wrong, not the code |
XunZhiyang/llm-tv-estimation/experiments/fig1/methods.py code served (permissive licence) · get_code("16503f7b8e877160") How it ranRan 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 math
torch.manual_seed(0)
# Build pi_pool dict with required structure
N = 2 # batch size
K_max = 5 # maximum K evaluations
n = 4 # output dimension
# Create score tensors with shape (N, K_max, n)
score_L_pi = torch.randn(N, K_max, n)
score_L_mu = torch.randn(N, K_max, n)
pi_pool = {
'score_L_pi': score_L_pi,
'score_L_mu': score_L_mu,
'meta': {
'n': n
}
}
K = 3 # number of evaluations to use (K <= K_max)
ARGS = {
'pi_pool': pi_pool,
'K': K
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- 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
|
| parse_levels |
Ran ran; our contract draft was wrong, not the code |
XunZhiyang/llm-tv-estimation/experiments/fig1/rerun_estimators.py code served (permissive licence) · get_code("9798487912b66660") How it ranRan 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. 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
def parse_levels(s: str):
return [tuple((int(x) for x in tok.split(':'))) for tok in s.split(',')]
ARGS = {
's': '1:2:3,4:5,6:7:8:9'
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type list — a list output has no array shape of its own; none is 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
|
| per_iter_trunc_prob |
Ran ran; our contract draft was wrong, not the code |
XunZhiyang/llm-tv-estimation/experiments/paper_figs/def3_sigma_multimodel.py code served (permissive licence) · get_code("c192f5f9117bfa49") How it ranRan 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 ndarray, ndim 1, dtype family float, shape (6,) 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 numpy as np
# Construct arguments for per_iter_trunc_prob
# Let's understand what the function needs:
# - idx_i: array of token indices, accessed with [:k]
# - val_i: array of values (log probabilities), accessed with [:k], converted to float64
# - k: integer, number of items to take from idx_i and val_i
# - tok2pos: dict mapping token integers to positions in output array
# - S: integer, size of output array
# Create sample data
np.random.seed(0)
# idx_i: array of token indices (e.g., [5, 3, 7, 1, 2])
idx_i = np.array([5, 3, 7, 1, 2, 0], dtype=np.int32)
# val_i: array of log values (some finite, some potentially infinite for testing)
val_i = np.array([-1.2, -0.5, -2.1, -0.3, -5.0, -1.8], dtype=np.float32)
# k: number of top items to consider
k = 4
# tok2pos: mapping from token id to position in output array
# Maps token ids {5, 3, 7, 1} (first k tokens) to positions {0, 1, 2, 3}
tok2pos = {
5: 0,
3: 1,
7: 2,
1: 3,
2: 4,
0: 5
}
# S: size of output array
S = 6
ARGS = {
"idx_i": idx_i,
"val_i": val_i,
"k": k,
"tok2pos": tok2pos,
"S": S
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- numpy — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type ndarray, ndim 1, dtype family float, shape (6,) — shape (6,) 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
|
| row_completed |
Ran ran, honoured the contract we drafted |
XunZhiyang/llm-tv-estimation/experiments/fig1/rerun_estimators.py code served (permissive licence) · get_code("0b3faf1b85327b20") How it ranRan 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 Tensor, ndim 1, dtype family int, shape (2,) 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 torch
torch.manual_seed(0)
# The function expects a 'pool' dict with specific structure
# It checks for 'row_completed_k' key, and accesses pool['meta']
# pool['meta'] should have 'K_max' and optionally 'completed_k'
# pool['meta'] should also have 'N' for the output tensor size
pool = {
'meta': {
'N': 2, # Number of rows
'K_max': 5, # Maximum K value
'completed_k': 3 # Optionally specify completed_k
}
# Note: 'row_completed_k' is not included, so the function will use meta values
}
ARGS = {
'pool': pool
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type Tensor, ndim 1, dtype family int, shape (2,) — shape (2,) 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
|
| score_once |
Ran ran; the contract check could not run (RAISES, DEP_MISSING or TIMEOUT) |
XunZhiyang/llm-tv-estimation/experiments/inference_engines/phase_score.py code served (permissive licence) · get_code("95df17e99526e613") How it ranRan 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 Tensor, ndim 2, dtype family float, shape (2, 5) 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 torch
import torch.nn as nn
torch.manual_seed(0)
class MockOracle(nn.Module):
def __init__(self):
super().__init__()
self.linear = nn.Linear(4, 8)
def score_kv_batched(self, X, prefix_len, return_topk_logits=False):
# X shape: (B, seq_len, 4)
batch_size = X.shape[0]
scores = torch.randn(batch_size, 5)
if return_topk_logits:
topk_logits = torch.randn(batch_size, 3)
topk_indices = torch.randn(batch_size, 3)
return (scores, topk_logits, topk_indices)
return scores
def score_decode_batched(self, X, prefix_len, chunk=64, return_topk_logits=False):
# X shape: (B, seq_len, 4)
batch_size = X.shape[0]
scores = torch.randn(batch_size, 5)
if return_topk_logits:
topk_logits = torch.randn(batch_size, 3)
topk_indices = torch.randn(batch_size, 3)
return (scores, topk_logits, topk_indices)
return scores
def score_seq_batched(self, X, prefix_len, return_topk_logits=False):
# X shape: (B, seq_len, 4)
batch_size = X.shape[0]
scores = torch.randn(batch_size, 5)
if return_topk_logits:
topk_logits = torch.randn(batch_size, 3)
topk_indices = torch.randn(batch_size, 3)
return (scores, topk_logits, topk_indices)
return scores
def score_replay_batched(self, X, prefix_len, return_topk_logits=False):
# X shape: (B, seq_len, 4)
batch_size = X.shape[0]
scores = torch.randn(batch_size, 5)
if return_topk_logits:
topk_logits = torch.randn(batch_size, 3)
topk_indices = torch.randn(batch_size, 3)
return (scores, topk_logits, topk_indices)
return scores
oracle = MockOracle()
X = torch.randn(2, 6, 4)
prompt_len = 3
score_path = 'prefill'
ARGS = {
'oracle': oracle,
'score_path': score_path,
'X': X,
'prompt_len': prompt_len,
'chunk': 0,
'return_topk_logits': False,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type Tensor, ndim 2, dtype family float, shape (2, 5) — shape (2, 5) 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
|
| score_topk |
Ran ran on a synthesized input |
XunZhiyang/llm-tv-estimation/experiments/inference_engines/phase_score_sigma.py code served (permissive licence) · get_code("76c17b83b8e924e8") How it ranRan 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 tuple, ndim 4, 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 torch.nn as nn
torch.manual_seed(0)
class MockOracle(nn.Module):
def __init__(self):
super().__init__()
self.linear = nn.Linear(4, 4)
def score_kv_batched(self, batch, prefix_len, return_topk_logits=False, k_save=None):
B = 2
n = 5
# Return (scores, topk_indices, topk_values)
scores = torch.randn(B, n)
topk_indices = torch.randint(0, 4, (B, n, k_save))
topk_values = torch.randn(B, n, k_save)
return scores, topk_indices, topk_values
def score_prefill_batched(self, batch, prefix_len, k_save=None, return_topk_logits=False, chunk=None):
B = 2
n = 5
scores = torch.randn(B, n)
topk_indices = torch.randint(0, 4, (B, n, k_save))
topk_values = torch.randn(B, n, k_save)
return scores, topk_indices, topk_values
def score_replay_batched(self, batch, prefix_len, return_topk_logits=False, k_save=None):
B = 2
n = 5
scores = torch.randn(B, n)
topk_indices = torch.randint(0, 4, (B, n, k_save))
topk_values = torch.randn(B, n, k_save)
return scores, topk_indices, topk_values
def score_seq_batched(self, batch, prefix_len, return_topk_logits=False, k_save=None):
B = 2
n = 5
scores = torch.randn(B, n)
topk_indices = torch.randint(0, 4, (B, n, k_save))
topk_values = torch.randn(B, n, k_save)
return scores, topk_indices, topk_values
oracle = MockOracle()
batch = [
torch.randint(0, 256, (10,)),
torch.randint(0, 256, (12,))
]
ARGS = {
'oracle': oracle,
'engine': 'hf',
'path': 'decode',
'batch': batch,
'prompt_len': 5,
'k_save': 3,
'prefill_chunk': 64
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type tuple, ndim 4, dtype family float — a tuple 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
|
| slice_pool |
Ran ran; our contract draft was wrong, not the code |
XunZhiyang/llm-tv-estimation/experiments/fig1/rerun_estimators.py code served (permissive licence) · get_code("023676d48e1bf63f") How it ranRan 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
torch.manual_seed(0)
# Construct a valid pool dict
pool = {
'meta': {
'N': 2, # Number of trajectories
'K_max': 10, # Maximum K value
'completed_k': 8 # Completed K value
},
'trajectory_data': torch.randn(2, 4), # Example tensor with N=2 rows
'scores': torch.randn(2, 3), # Another tensor with N=2 rows
'other_field': torch.randn(5, 6) # Tensor without N dimension (won't be sliced)
}
ARGS = {
'pool': pool,
'n_keep': 1,
'min_K': 5
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- 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
|
| target_logp_from_topk |
Ran ran; our contract draft was wrong, not the code |
XunZhiyang/llm-tv-estimation/experiments/inference_engines/phase_score_sigma.py code served (permissive licence) · get_code("05577fecfb9ccee6") How it ranRan 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 Tensor, ndim 2, dtype family float, shape (2, 3) 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 torch
torch.manual_seed(0)
# Construct arguments for target_logp_from_topk
# ti: (N, n, w) int - top-k indices
# tv: (N, n, w) float - top-k values (logp)
# target: (N, n) long - target token indices
N = 2 # batch size
n = 3 # sequence length
w = 4 # top-k width
# ti: shape (2, 3, 4) - top-k token indices
ti = torch.randint(0, 10, (N, n, w), dtype=torch.long)
# tv: shape (2, 3, 4) - top-k logp values
tv = torch.randn(N, n, w, dtype=torch.float32)
# target: shape (2, 3) - target tokens to look up
# Make sure some targets are in ti and some are not
target = torch.randint(0, 10, (N, n), dtype=torch.long)
# Set one target to match an entry in ti for testing
target[0, 0] = ti[0, 0, 0]
ARGS = {
'ti': ti,
'tv': tv,
'target': target
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type Tensor, ndim 2, dtype family float, shape (2, 3) — shape (2, 3) 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
|
| target_logprob |
Ran ran, honoured the contract we drafted |
XunZhiyang/llm-tv-estimation/experiments/paper_figs/extract_crossmodel_hist.py code served (permissive licence) · get_code("b60b2dcc579d57e0") How it ranRan 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 Tensor, ndim 3, dtype family float, shape (2, 4, 3) 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 torch
torch.manual_seed(0)
# Build the job dict with all required fields
N, K, n, K_save = 2, 4, 3, 5
# Create topk_idx: shape (N, K, n, K_save)
topk_idx = torch.randint(0, 10, (N, K, n, K_save))
# Create topk_val: shape (N, K, n, K_save) with finite values
topk_val = torch.randn(N, K, n, K_save)
# Create X: shape (N, plen + n + extra)
plen = 2
X = torch.randint(0, 10, (N, plen + n + 2)).long()
# Create meta dict
meta = {
'prompt_len': plen,
'logprob_cap': K_save
}
job = {
'topk_idx': topk_idx,
'topk_val': topk_val,
'X': X,
'meta': meta
}
ARGS = {
'job': job
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type Tensor, ndim 3, dtype family float, shape (2, 4, 3) — shape (2, 4, 3) 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
|
| tokenize_prompt |
Ran ran, honoured the contract we drafted |
XunZhiyang/llm-tv-estimation/experiments/fig1/cache_build.py code served (permissive licence) · get_code("8765d8d06d025758") How it ranRan 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 Tensor, ndim 1, dtype family int, shape (8,) 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 torch
torch.manual_seed(0)
class MockTokenizer:
def apply_chat_template(self, messages, add_generation_prompt=False, return_tensors=None):
# Simulate a tokenizer that returns input_ids
# Return a tensor of shape (1, seq_len) when return_tensors='pt'
if return_tensors == 'pt':
return torch.randint(0, 1000, (1, 8))
else:
return {'input_ids': torch.randint(0, 1000, (1, 8))}
tokenizer = MockTokenizer()
system = "You are a helpful assistant."
user = "What is 2+2?"
ARGS = {
'tokenizer': tokenizer,
'system': system,
'user': user,
}
- Setup block drafted by
- a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
- Imports
- torch — import names as written, not package names to install; a name the repository itself provides is not a package
- Returned
- type Tensor, ndim 1, dtype family int, shape (8,) — shape (8,) 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
|
| curve |
Not yet run unverified (harvested, no recorded run) |
XunZhiyang/llm-tv-estimation/experiments/topk_union/plot_union_multimodel.py code served (permissive licence) · get_code("64474581f7241742") How it ran |
| load_model |
Not yet run unverified (harvested, no recorded run) |
XunZhiyang/llm-tv-estimation/experiments/tv_estimate.py code served (permissive licence) · get_code("801eda14b08668a6") How it ran |
| load_tokenizer |
Not yet run unverified (harvested, no recorded run) |
XunZhiyang/llm-tv-estimation/experiments/tv_estimate.py code served (permissive licence) · get_code("6348c83ab01fb9bd") How it ran |
| make_oracle |
Not yet run unverified (harvested, no recorded run) |
XunZhiyang/llm-tv-estimation/experiments/inference_engines/phase_score.py code served (permissive licence) · get_code("98ab868834ff0682") How it ran |
| sigma_for_pool |
Not yet run unverified (harvested, no recorded run) |
XunZhiyang/llm-tv-estimation/experiments/paper_figs/def3_sigma_multimodel.py code served (permissive licence) · get_code("c0aaec05c6177c2c") How it ran |