diff --git a/crossqkv/lisa_full_answer.py b/crossqkv/lisa_full_answer.py
new file mode 100644
index 0000000..4afadc1
--- /dev/null
+++ b/crossqkv/lisa_full_answer.py
@@ -0,0 +1,209 @@
+"""Freeze numeric tasks and screen the effect of sharing on complete answers."""
+import argparse
+from hashlib import sha256
+import json
+from pathlib import Path
+import random
+import re
+
+import torch
+from tokenizers import Tokenizer
+
+from crossqkv.lisa_effect_screen import WORDS
+from crossqkv.lisa_generate import GenerationDecoder, generate
+from crossqkv.lisa_tail import TorchTail
+from functional.model import StreamingLM
+from functional.run import write_json
+
+
+TASKS = ('lookup', 'latest', 'addition', 'count')
+SEEDS = {'screen': 621001, 'fit': 621002, 'validation': 621003, 'test': 621004}
+COUNTS = {'screen': 8, 'fit': 24, 'validation': 8, 'test': 32}
+SCHEDULES = {'native': (), 'direct_3': (15, 19, 23),
+ 'direct_4': (11, 15, 19, 23), 'direct_5': (7, 11, 15, 19, 23)}
+STOP_TEXT = ('<|im_end|>', '<|endoftext|>')
+MAX_NEW_TOKENS = 24
+PROCESS_SWAP_LIMIT_KIB = 384 * 1024
+
+
+def fixed_problems():
+ output = {}
+ for split, seed in SEEDS.items():
+ rng = random.Random(seed)
+ rows = []
+ for task in TASKS:
+ for i in range(COUNTS[split]):
+ if task in ('lookup', 'latest'):
+ keys = rng.sample(WORDS, 12)
+ values = rng.sample(range(20, 100), 12)
+ pos = rng.randrange(len(keys))
+ key = keys[pos]
+ if task == 'latest':
+ later = rng.randrange(1, len(keys))
+ earlier = rng.randrange(later)
+ keys[earlier] = keys[later]
+ pos, key = later, keys[later]
+ schedule = ', '.join(f'{k}={v}' for k, v in zip(keys, values))
+ descriptor = 'last recorded' if task == 'latest' else 'recorded'
+ question = f'Records in time order: {schedule}.\nWhat is the {descriptor} number for {key}?'
+ answer = values[pos]
+ elif task == 'addition':
+ a, b = sorted((rng.randint(20, 89), rng.randint(20, 89)))
+ question = f'What is {a} plus {b}?'
+ answer = a + b
+ else:
+ first, second = rng.sample(WORDS, 2)
+ answer = rng.randint(10, 15)
+ values = [first] * answer + [second] * rng.randint(3, 9)
+ rng.shuffle(values)
+ question = f"Items: {', '.join(values)}.\nHow many items are exactly '{first}'?"
+ rows.append({'id': f'{split}-{task}-{i:03}', 'task': task,
+ 'question': question, 'answer': answer})
+ output[split] = rows
+ # Arithmetic questions can repeat across independently seeded splits.
+ # Keep the first generated occurrence and fill duplicates with new disjoint sums.
+ used = set()
+ replacement = random.Random(621005)
+ for rows in output.values():
+ for row in rows:
+ while row['task'] == 'addition' and row['question'] in used:
+ a, b = sorted((replacement.randint(20, 89), replacement.randint(20, 89)))
+ row.update(question=f'What is {a} plus {b}?', answer=a+b)
+ if row['question'] in used:
+ raise ValueError('Prompt repeated across the frozen set')
+ used.add(row['question'])
+ return output
+
+
+def prompt(question):
+ return ('<|im_start|>user\n' + question + '\nReply with the integer and no other text.'
+ '<|im_end|>\n<|im_start|>assistant\n\n\n\n\n')
+
+
+def final_integer(text):
+ # Only completed reasoning prefixes precede an answer.
+ text = re.sub(r'\A\s*(?:.*?\s*)+', '', text, flags=re.S).strip()
+ if '' in text or '' in text:
+ return None
+ match = re.fullmatch(r'(?:[Ff]inal answer:\s*|[Aa]nswer:\s*)?([+-]?\d+)\.?', text)
+ if not match:
+ match = re.search(r'(?:^|\n)\s*(?:[Ff]inal answer|[Aa]nswer):\s*([+-]?\d+)\.?\s*\Z', text)
+ return int(match[1]) if match else None
+
+
+def grade(tokenizer, tokens, stop, expected):
+ whole = tokenizer.decode(tokens, skip_special_tokens=False)
+ body = tokenizer.decode(tokens[:-1] if stop == 'eos' else tokens,
+ skip_special_tokens=False)
+ value = final_integer(body) if stop == 'eos' else None
+ return {'tokens': tokens, 'response': whole, 'stop': stop, 'answer': value,
+ 'correct': value == expected}
+
+
+def evaluate(model, tokenizer, examples, arms, adapters=None):
+ stop_ids = {tokenizer.token_to_id(text) for text in STOP_TEXT}
+ if None in stop_ids or len(stop_ids) != len(STOP_TEXT):
+ raise ValueError('Unexpected tokenizer stop tokens')
+ ids = [tokenizer.encode(prompt(x['question']), add_special_tokens=False).ids for x in examples]
+ expanded = [x for x in ids for _ in arms]
+ schedules = list(arms.values()) * len(examples)
+ predictions = iter(generate(model, expanded, schedules, stop_ids, MAX_NEW_TOKENS, adapters))
+ return [{'id': x['id'], 'task': x['task'], 'gold': x['answer'],
+ 'arms': {mode: grade(tokenizer, *next(predictions), x['answer']) for mode in arms}}
+ for x in examples]
+
+
+def summarize(rows):
+ results = {}
+ for task in TASKS:
+ group = [row for row in rows if row['task'] == task]
+ results[task] = {}
+ for name in SCHEDULES:
+ original_correct = lambda row: row['arms']['native']['correct']
+ produced_wrong = lambda row: row['arms'][name]['answer'] is not None and not row['arms'][name]['correct']
+ results[task][name] = {
+ 'n': len(group),
+ 'correct': sum(row['arms'][name]['correct'] for row in group),
+ 'unscored': sum(row['arms'][name]['answer'] is None for row in group),
+ 'native_correct_to_wrong_integer': [
+ row['id'] for row in group if original_correct(row) and produced_wrong(row)],
+ }
+ return results
+
+
+def choose(summary):
+ options = []
+ for task, arms in summary.items():
+ if arms['native']['correct'] >= 6:
+ for arm in ('direct_3', 'direct_4', 'direct_5'):
+ losses = arms[arm]['native_correct_to_wrong_integer']
+ if len(losses) >= 2:
+ options.append((len(losses), arms['native']['correct'],
+ len(SCHEDULES[arm]), task, arm))
+ if not options:
+ return None
+ _, _, _, task, arm = max(options)
+ return {'task': task, 'arm': arm, 'recipients': list(SCHEDULES[arm])}
+
+
+def fingerprint(path):
+ return sha256(path.read_bytes()).hexdigest()
+
+
+def main():
+ parser = argparse.ArgumentParser(description=__doc__)
+ parser.add_argument('--source', required=True, type=Path)
+ parser.add_argument('--out', required=True, type=Path)
+ parser.add_argument('--seconds', default=21600, type=int)
+ parser.add_argument('--batch-prompts', default=2, type=int, choices=(1, 2))
+ parser.add_argument('--preflight', action='store_true')
+ args = parser.parse_args()
+ torch.set_num_threads(1)
+ args.out.mkdir(exist_ok=True)
+ files = {name: fingerprint(args.source/name) for name in
+ ('manifest.json', 'model_config.json', 'tokenizer.json')}
+ protocol = {'weights': files, 'schedules': SCHEDULES, 'cap': MAX_NEW_TOKENS,
+ 'stops': STOP_TEXT, 'batch_prompts': args.batch_prompts,
+ 'decode': 'full vocabulary greedy, closed thinking prefix'}
+ manifest = args.out/'frozen.json'
+ frozen = {'protocol': protocol, 'problems': fixed_problems()}
+ frozen = json.loads(json.dumps(frozen))
+ if manifest.exists() and json.loads(manifest.read_text()) != frozen:
+ raise ValueError('Frozen protocol or prompts changed')
+ write_json(manifest, frozen)
+ model = StreamingLM(args.source/'weights', json.loads((args.source/'model_config.json').read_text()),
+ seconds=args.seconds, process_swap_limit_kib=PROCESS_SWAP_LIMIT_KIB)
+ tokenizer = Tokenizer.from_file(str(args.source/'tokenizer.json'))
+ examples = frozen['problems']['screen']
+ if args.preflight:
+ ids = torch.tensor([tokenizer.encode(prompt(examples[0]['question']),
+ add_special_tokens=False).ids])
+ hidden = torch.from_numpy(model.embedding(ids.numpy()))
+ with torch.no_grad():
+ expected, _ = TorchTail(model, 0)(hidden, None, torch.tensor([ids.shape[1]]),
+ 'native', ())
+ decoder = GenerationDecoder(model, [()], [0])
+ decoder.advance(ids[:, :-2])
+ actual = decoder.advance(ids[:, -2:])
+ ref = expected[:, -2:]
+ torch.testing.assert_close(actual, ref, atol=8e-5, rtol=7e-5)
+ write_json(args.out/'preflight.json', {'prompt_id': examples[0]['id'],
+ 'prompt_tokens': ids.shape[1], 'tail_hidden_max_abs': float((actual-ref).abs().max())})
+ return
+ path = args.out/'screen-rows.json'
+ rows = json.loads(path.read_text()) if path.exists() else []
+ if [r['id'] for r in rows] != [x['id'] for x in examples[:len(rows)]]:
+ raise ValueError('Existing screen results do not match frozen prompts')
+ for start in range(len(rows), len(examples), args.batch_prompts):
+ rows.extend(evaluate(model, tokenizer, examples[start:start+args.batch_prompts], SCHEDULES))
+ write_json(path, rows)
+ print('screen complete', len(rows), '/', len(examples), flush=True)
+ summary = summarize(rows)
+ write_json(args.out/'screen-summary.json', summary)
+ write_json(args.out/'selection.json', {'frozen_sha256': fingerprint(manifest),
+ 'screen_sha256': fingerprint(path),
+ 'chosen': choose(summary)})
+
+
+if __name__ == '__main__':
+ main()
diff --git a/crossqkv/lisa_full_answer_train.py b/crossqkv/lisa_full_answer_train.py
new file mode 100644
index 0000000..4053d40
--- /dev/null
+++ b/crossqkv/lisa_full_answer_train.py
@@ -0,0 +1,206 @@
+"""Fit LiSA on a development-selected schedule, then evaluate fresh continuations."""
+import argparse
+import json
+from pathlib import Path
+
+import numpy as np
+import torch
+from tokenizers import Tokenizer
+
+from crossqkv.lisa_effect_audit import paired
+from crossqkv.lisa_full_answer import (PROCESS_SWAP_LIMIT_KIB, SCHEDULES, STOP_TEXT, choose, evaluate, fingerprint,
+ prompt, summarize)
+from crossqkv.lisa_tail import TorchTail, weight_chunks
+from crossqkv.lisa_train import LearnableSharingAttention, huber_distillation, language_model_loss
+from functional.model import PREFIX, StreamingLM
+from functional.run import write_json
+
+
+class FitCapture(TorchTail):
+ def norm(self, x, name, centered=True):
+ if name == f'layers.{self.sites[0]}.input_layernorm':
+ self.residual = x
+ return super().norm(x, name, centered)
+
+
+def load_locked(source, screen):
+ fixed = screen/'frozen.json'
+ rows = screen/'screen-rows.json'
+ chosen = json.loads((screen/'selection.json').read_text())
+ if (chosen['frozen_sha256'] != fingerprint(fixed)
+ or chosen['screen_sha256'] != fingerprint(rows)):
+ raise ValueError('Locked screening hashes do not match')
+ manifest = json.loads(fixed.read_text())
+ screen_rows = json.loads(rows.read_text())
+ expected = [(x['id'], x['task'], x['answer']) for x in manifest['problems']['screen']]
+ if [(x['id'], x['task'], x['gold']) for x in screen_rows] != expected:
+ raise ValueError('Screening did not evaluate the frozen development set')
+ expected_selection = choose(summarize(screen_rows))
+ if expected_selection is None or chosen['chosen'] != expected_selection:
+ raise ValueError('Development screen did not produce a qualifying schedule')
+ for name, digest in manifest['protocol']['weights'].items():
+ if fingerprint(source/name) != digest:
+ raise ValueError(f'Model input {name} changed')
+ return chosen, manifest
+
+
+@torch.no_grad()
+def capture(model, tokenizer, fit_examples, directory):
+ directory.mkdir(exist_ok=True)
+ teacher = FitCapture(model, 0)
+ teacher.sites = model.sites
+ for i, row in enumerate(fit_examples):
+ path = directory/f'{i:03}.npz'
+ if path.exists():
+ continue
+ text = prompt(row['question'])
+ base = tokenizer.encode(text, add_special_tokens=False).ids
+ complete = tokenizer.encode(text + str(row['answer']) + STOP_TEXT[0],
+ add_special_tokens=False).ids
+ if complete[:len(base)] != base or len(complete) <= len(base):
+ raise ValueError('Answer did not tokenize as an extension of the frozen prompt')
+ ids = np.array([complete])
+ model.guard()
+ hidden = torch.from_numpy(model.embedding(ids))
+ _, side = teacher(hidden, None, torch.tensor([len(complete)]), 'native', ())
+ pending = path.with_suffix('.tmp.npz')
+ np.savez(pending, ids=ids, start=[len(base)], residual=teacher.residual.numpy(),
+ donor=side[model.sites[0]-4][0].numpy(),
+ teacher=np.stack([side[i][0].numpy() for i in model.sites]))
+ pending.replace(path)
+ print('fit capture', i+1, '/', len(fit_examples), flush=True)
+
+
+def checkpoint(path, obj):
+ pending = path.with_suffix('.tmp')
+ torch.save(obj, pending)
+ pending.replace(path)
+
+
+def train(model, tokenizer, out, split, epochs, rank):
+ c = model.config
+ rope = c['rope_parameters']
+ adapters = {i: LearnableSharingAttention(c['hidden_size'], c['num_attention_heads'],
+ c['num_key_value_heads'], rank, rope['rope_theta'], rope['partial_rotary_factor'],
+ bias=c.get('attention_bias', False)) for i in model.sites}
+ tail = TorchTail(model, model.sites[0], adapters)
+ optim = torch.optim.AdamW(tail.parameters(), lr=.0003, weight_decay=.1)
+ last = out/'resume.pt'
+ selected = out/'lisa.pt'
+ state = {'epoch': 0, 'steps': [], 'trace': [], 'best_correct': -1}
+ if last.exists():
+ state = torch.load(last, weights_only=True, map_location='cpu')
+ tail.adapters.load_state_dict(state['parameters'])
+ optim.load_state_dict(state['optimizer'])
+
+ embedding = model.tensors[PREFIX+'embed_tokens.weight']
+
+ def vocab():
+ start = 0
+ for w in weight_chunks(embedding, 0, embedding.shape[0], rows=1024):
+ yield start, w
+ start += len(w)
+
+ paths = sorted((out/'fit-capture').glob('*.npz'))
+ for epoch in range(state['epoch'], epochs):
+ for path in paths[len(state['steps']):]:
+ with np.load(path, allow_pickle=False) as entry:
+ b = {key: torch.from_numpy(entry[key]) for key in entry.files}
+ lengths = torch.tensor([b['ids'].shape[1]])
+ optim.zero_grad(set_to_none=True)
+ h, side = tail(b['residual'], b['donor'], lengths, 'lisa', model.sites)
+ kd = torch.stack([huber_distillation(side[i][0], t, lengths)
+ for i, t in zip(model.sites, b['teacher'])]).mean()
+ ce = language_model_loss(h, b['ids'], lengths, vocab, completion_starts=b['start'])
+ loss = .25*kd + .75*ce
+ loss.backward()
+ if any(p.grad is None or not torch.isfinite(p.grad).all() for p in tail.parameters()):
+ raise FloatingPointError('Nonfinite LiSA gradient')
+ optim.step()
+ state['steps'].append({'capture': path.name, 'huber': float(kd.detach()),
+ 'completion_ce': float(ce.detach())})
+ checkpoint(last, {**state, 'parameters': tail.adapters.state_dict(),
+ 'optimizer': optim.state_dict()})
+ print('fit epoch', epoch+1, 'step', len(state['steps']), '/', len(paths), flush=True)
+ val = []
+ for start in range(0, len(split['validation']), 2):
+ val.extend(evaluate(model, tokenizer, split['validation'][start:start+2],
+ {'lisa': model.sites}, adapters))
+ correct = sum(x['arms']['lisa']['correct'] for x in val)
+ if correct > state['best_correct']:
+ state['best_correct'] = correct
+ state['best_epoch'] = epoch+1
+ state['best_parameters'] = {
+ name: param.detach().clone() for name, param in tail.adapters.state_dict().items()
+ }
+ state['trace'].append({'epoch': epoch+1, 'steps': state['steps'], 'validation': val})
+ state['steps'] = []
+ state['epoch'] = epoch+1
+ checkpoint(last, {**state, 'parameters': tail.adapters.state_dict(),
+ 'optimizer': optim.state_dict()})
+ write_json(out/'trace.json', {'selected_epoch': state['best_epoch'], 'epochs': state['trace']})
+ checkpoint(selected, state['best_parameters'])
+ tail.adapters.load_state_dict(state['best_parameters'])
+ return adapters
+
+
+def audit(rows):
+ correct = {name: np.array([r['arms'][name]['correct'] for r in rows])
+ for name in ('native', 'direct', 'lisa')}
+ bad_value = [r for r in rows if r['arms']['native']['correct']
+ and r['arms']['direct']['answer'] is not None and not r['arms']['direct']['correct']]
+ return {'n': len(rows), 'correct': {name: int(x.sum()) for name, x in correct.items()},
+ 'substantive_loss_ids': [r['id'] for r in bad_value],
+ 'substantive_rescued_ids': [r['id'] for r in bad_value if r['arms']['lisa']['correct']],
+ 'unscored': {name: sum(r['arms'][name]['answer'] is None for r in rows) for name in correct},
+ **paired(correct['native'], correct['direct'], correct['lisa'])}
+
+
+def main():
+ p = argparse.ArgumentParser(description=__doc__)
+ for path in ('source', 'screen', 'out'):
+ p.add_argument('--'+path, type=Path, required=True)
+ p.add_argument('--epochs', type=int, default=2)
+ args = p.parse_args()
+ if args.epochs < 1:
+ p.error('--epochs must be positive')
+ torch.set_num_threads(1)
+ torch.manual_seed(621011)
+ locked, manifest = load_locked(args.source, args.screen)
+ selection = locked['chosen']
+ sites = tuple(selection['recipients'])
+ if sites != SCHEDULES[selection['arm']]:
+ raise ValueError('Unexpected selected schedule')
+ spec = {'screen': locked, 'epochs': args.epochs, 'rank': 40, 'seed': 621011,
+ 'objective': '0.25 teacher attention Huber + 0.75 full-vocabulary completion CE'}
+ args.out.mkdir(exist_ok=True)
+ run = args.out/'train-spec.json'
+ if run.exists() and json.loads(run.read_text()) != spec:
+ raise ValueError('Cannot resume with a different experiment definition')
+ write_json(run, spec)
+ tasks = {name: [r for r in rows if r['task'] == selection['task']]
+ for name, rows in manifest['problems'].items()}
+ model = StreamingLM(args.source/'weights', json.loads((args.source/'model_config.json').read_text()),
+ seconds=86400, process_swap_limit_kib=PROCESS_SWAP_LIMIT_KIB)
+ model.sites = sites
+ tokenizer = Tokenizer.from_file(str(args.source/'tokenizer.json'))
+ capture(model, tokenizer, tasks['fit'], args.out/'fit-capture')
+ adapters = train(model, tokenizer, args.out, tasks, args.epochs, spec['rank'])
+ output = args.out/'test-items.json'
+ rows = json.loads(output.read_text()) if output.exists() else []
+ if [r['id'] for r in rows] != [x['id'] for x in tasks['test'][:len(rows)]]:
+ raise ValueError('Test continuation does not match the frozen rows')
+ for start in range(len(rows), len(tasks['test']), 2):
+ batch = tasks['test'][start:start+2]
+ base = evaluate(model, tokenizer, batch, {'native': (), 'direct': sites})
+ lisa = evaluate(model, tokenizer, batch, {'lisa': sites}, adapters)
+ for x, y in zip(base, lisa):
+ x['arms'].update(y['arms'])
+ rows.extend(base)
+ write_json(output, rows)
+ print('test complete', len(rows), '/', len(tasks['test']), flush=True)
+ write_json(args.out/'test-audit.json', audit(rows))
+
+
+if __name__ == '__main__':
+ main()
diff --git a/crossqkv/lisa_generate.py b/crossqkv/lisa_generate.py
new file mode 100644
index 0000000..af1d634
--- /dev/null
+++ b/crossqkv/lisa_generate.py
@@ -0,0 +1,127 @@
+"""Cached autoregressive Qwen text generation for the LiSA comparisons."""
+import math
+
+import torch
+from torch.nn import functional as F
+
+from crossqkv.lisa_tail import TorchTail, rotate, weight_chunks
+from functional.model import PREFIX
+
+
+class GenerationDecoder(TorchTail):
+ """Share the previous full-attention layer's actual scores per batch lane."""
+
+ def __init__(self, source, schedules, padding, adapters=None):
+ super().__init__(source, 0, adapters)
+ full = [i for i, kind in enumerate(self.c['layer_types']) if kind == 'full_attention']
+ if (len(schedules) != len(padding) or not schedules
+ or any(set(sites) - set(full[1:]) for sites in schedules)):
+ raise ValueError('Recipients need an earlier full-attention layer')
+ if self.adapters and any(tuple(sites) != tuple(map(int, self.adapters)) for sites in schedules):
+ raise ValueError('LiSA decoding requires one shared schedule for the batch')
+ self.padding = torch.tensor(padding)
+ self.share = {i: torch.tensor([i in sites for sites in schedules])[:, None, None, None]
+ for i in set().union(*schedules)}
+ self.position = 0
+ self.states = {}
+
+ def attention_chunk(self, h, layer, positions, allowed, donor):
+ heads, kv, dim = (self.c[k] for k in
+ ('num_attention_heads', 'num_key_value_heads', 'head_dim'))
+ p = f'layers.{layer}.self_attn.'
+ adapter = self.adapters[str(layer)] if str(layer) in self.adapters else None
+ if adapter is None:
+ q, gate = self.linear(h, p+'q_proj').unflatten(-1, (heads, 2*dim)).chunk(2, -1)
+ k = self.linear(h, p+'k_proj').unflatten(-1, (kv, dim))
+ rope = self.c['rope_parameters']
+ q = rotate(self.norm(q, p+'q_norm'), rope['rope_theta'],
+ rope['partial_rotary_factor'], positions)
+ k = rotate(self.norm(k, p+'k_norm'), rope['rope_theta'],
+ rope['partial_rotary_factor'], positions)
+ else:
+ gate = self.gate_only(h, p)
+ q = adapter.rotate(adapter.q_proj(h).unflatten(-1, (heads, adapter.rank)), positions)
+ k = adapter.rotate(adapter.k_proj(h).unflatten(-1, (kv, adapter.rank)), positions)
+ v = self.linear(h, p+'v_proj').unflatten(-1, (kv, dim))
+ if layer in self.states:
+ prior_k, prior_v = self.states[layer]
+ k = torch.cat((prior_k, k), dim=1)
+ v = torch.cat((prior_v, v), dim=1)
+ self.states[layer] = k, v
+ repeats = heads // kv
+ scores = torch.einsum('bthd,bshd->bhts', q, k.repeat_interleave(repeats, 2))
+ scores = scores / math.sqrt(q.shape[-1])
+ if adapter is not None:
+ both = torch.cat((scores, donor), dim=1).permute(0, 2, 3, 1)
+ scores = adapter.fuse(both).permute(0, 3, 1, 2)
+ elif layer in self.share:
+ scores = torch.where(self.share[layer], donor, scores)
+ weights = scores.masked_fill(~allowed, -torch.inf).softmax(dim=-1)
+ context = torch.einsum('bhts,bshd->bthd', weights, v.repeat_interleave(repeats, 2))
+ return self.linear((context * gate.sigmoid()).flatten(-2), p+'o_proj'), scores
+
+ @torch.no_grad()
+ def advance(self, ids):
+ """Consume a prompt or continuation and return the final-normalized states."""
+ stop = self.position + ids.shape[1]
+ queries = torch.arange(self.position, stop)
+ keys = torch.arange(stop)
+ positions = (queries[None, :] - self.padding[:, None]).clamp_min(0)
+ q_valid = queries[None, :] >= self.padding[:, None]
+ k_valid = keys[None, :] >= self.padding[:, None]
+ allowed = (queries[:, None] >= keys)[None, None] & (
+ k_valid[:, None, None, :] | ~q_valid[:, None, :, None])
+ h = torch.from_numpy(self.source.embedding(ids.numpy())) * q_valid[..., None]
+ donor = None
+ for layer, kind in enumerate(self.c['layer_types']):
+ if hasattr(self.source, 'guard'):
+ self.source.guard()
+ p = f'layers.{layer}.'
+ n = self.norm(h, p+'input_layernorm')
+ if kind == 'full_attention':
+ out, donor = self.attention_chunk(n, layer, positions, allowed, donor)
+ else:
+ out, self.states[layer] = self.linear_attention_chunk(n, layer, self.states.get(layer))
+ h = h + out
+ n = self.norm(h, p+'post_attention_layernorm')
+ activation = F.silu(self.linear(n, p+'mlp.gate_proj')) * self.linear(n, p+'mlp.up_proj')
+ h = h + self.linear(activation, p+'mlp.down_proj')
+ self.position = stop
+ return self.norm(h, 'norm')
+
+
+def greedy_tokens(hidden, embedding):
+ """Take the argmax over the complete tied vocabulary in bounded blocks."""
+ peak = hidden.new_full((len(hidden),), -torch.inf)
+ ids = torch.zeros(len(hidden), dtype=torch.long)
+ start = 0
+ for weight in weight_chunks(embedding, 0, embedding.shape[0], rows=1024):
+ score, arg = F.linear(hidden, weight).max(dim=-1)
+ ids = torch.where(score > peak, arg + start, ids)
+ peak = torch.maximum(peak, score)
+ start += len(weight)
+ if not torch.isfinite(peak).all():
+ raise FloatingPointError('Non-finite next-token score')
+ return ids
+
+
+@torch.no_grad()
+def generate(source, prompts, schedules, stop_tokens, max_new_tokens, adapters=None):
+ width = max(map(len, prompts))
+ padding = [width - len(prompt) for prompt in prompts]
+ seed = torch.tensor([[0] * n + prompt for prompt, n in zip(prompts, padding)])
+ decoder = GenerationDecoder(source, schedules, padding, adapters)
+ head = source.tensors[PREFIX+'embed_tokens.weight']
+ state = decoder.advance(seed)[:, -1]
+ output = [[] for _ in prompts]
+ finished = [False] * len(prompts)
+ for step in range(max_new_tokens):
+ ids = greedy_tokens(state, head)
+ for row, token in enumerate(ids.tolist()):
+ if not finished[row]:
+ output[row].append(token)
+ finished[row] = token in stop_tokens
+ if all(finished) or step + 1 == max_new_tokens:
+ break
+ state = decoder.advance(ids[:, None])[:, -1]
+ return [(tokens, 'eos' if done else 'max_new_tokens') for tokens, done in zip(output, finished)]
diff --git a/crossqkv/lisa_tail.py b/crossqkv/lisa_tail.py
index 3b097d5..da17159 100644
--- a/crossqkv/lisa_tail.py
+++ b/crossqkv/lisa_tail.py
@@ -37,20 +37,23 @@ class FrozenLinear(torch.autograd.Function):
return out, None, None, None
-def rotate(x, theta, fraction):
+def rotate(x, theta, fraction, positions=None):
d = int(x.shape[-1] * fraction)
inv = theta ** (-torch.arange(0, d, 2, dtype=x.dtype, device=x.device) / d)
- phase = torch.arange(x.shape[1], dtype=x.dtype, device=x.device)[:, None] * inv
- angle = torch.cat((phase, phase), dim=-1)[None, :, None, :]
+ if positions is None:
+ positions = torch.arange(x.shape[1], dtype=x.dtype, device=x.device)[None, :]
+ phase = positions[..., None] * inv
+ angle = torch.cat((phase, phase), dim=-1).unsqueeze(-2)
a, b = x[..., :d].chunk(2, dim=-1)
return torch.cat((x[..., :d] * angle.cos() + torch.cat((-b, a), -1) * angle.sin(),
x[..., d:]), dim=-1)
-def gated_delta(q, k, v, g, beta):
+def gated_delta_chunk(q, k, v, g, beta, state=None):
q = q * (q.square().sum(-1, keepdim=True) + 1e-6).rsqrt() / math.sqrt(q.shape[-1])
k = k * (k.square().sum(-1, keepdim=True) + 1e-6).rsqrt()
- state = v.new_zeros(v.shape[0], v.shape[2], k.shape[-1], v.shape[-1])
+ if state is None:
+ state = v.new_zeros(v.shape[0], v.shape[2], k.shape[-1], v.shape[-1])
rows = []
for i in range(v.shape[1]):
qt, kt, vt = q[:, i], k[:, i], v[:, i]
@@ -58,7 +61,11 @@ def gated_delta(q, k, v, g, beta):
delta = (vt - (state * kt.unsqueeze(-1)).sum(-2)) * beta[:, i, :, None]
state = state + kt.unsqueeze(-1) * delta.unsqueeze(-2)
rows.append((state * qt.unsqueeze(-1)).sum(-2))
- return torch.stack(rows, dim=1)
+ return torch.stack(rows, dim=1), state
+
+
+def gated_delta(q, k, v, g, beta):
+ return gated_delta_chunk(q, k, v, g, beta)[0]
class TorchTail(nn.Module):
@@ -133,14 +140,23 @@ class TorchTail(nn.Module):
return self.linear(out.flatten(-2), name+'o_proj'), scores, native
def linear_attention(self, x, layer):
+ return self.linear_attention_chunk(x, layer)[0]
+
+ def linear_attention_chunk(self, x, layer, previous=None):
p = f'layers.{layer}.linear_attn.'
c = self.c
kh, vh = c['linear_num_key_heads'], c['linear_num_value_heads']
kd, vd = c['linear_key_head_dim'], c['linear_value_head_dim']
projected = self.linear(x, p+'in_proj_qkv').transpose(1, 2)
kernel = self.small(p+'conv1d.weight')
- convolved = F.conv1d(projected, kernel, padding=kernel.shape[-1]-1,
- groups=projected.shape[1])[..., :x.shape[1]]
+ history = kernel.shape[-1] - 1
+ if previous is None:
+ projected = F.pad(projected, (history, 0))
+ state = None
+ else:
+ prefix, state = previous
+ projected = torch.cat((prefix, projected), dim=-1)
+ convolved = F.conv1d(projected, kernel, groups=projected.shape[1])
q, k, v = F.silu(convolved.transpose(1, 2)).split((kh*kd, kh*kd, vh*vd), dim=-1)
q = q.unflatten(-1, (kh, kd)).repeat_interleave(vh//kh, dim=2)
k = k.unflatten(-1, (kh, kd)).repeat_interleave(vh//kh, dim=2)
@@ -149,9 +165,10 @@ class TorchTail(nn.Module):
beta = self.linear(x, p+'in_proj_b').sigmoid()
a = self.linear(x, p+'in_proj_a')
g = -self.small(p+'A_log').exp() * F.softplus(a + self.small(p+'dt_bias'))
- out = gated_delta(q, k, v, g, beta)
- return self.linear((self.norm(out, p+'norm', centered=False)*F.silu(gate)).flatten(-2),
- p+'out_proj')
+ out, state = gated_delta_chunk(q, k, v, g, beta, state)
+ output = self.linear((self.norm(out, p+'norm', centered=False)*F.silu(gate)).flatten(-2),
+ p+'out_proj')
+ return output, (projected[..., projected.shape[-1]-history:].clone(), state)
def forward(self, h, donor, lengths, mode, recipients, keep_teacher=False):
side = {}
diff --git a/crossqkv/lisa_train.py b/crossqkv/lisa_train.py
index 2b0ff3b..3a63802 100644
--- a/crossqkv/lisa_train.py
+++ b/crossqkv/lisa_train.py
@@ -114,10 +114,13 @@ class _FrozenVocabularyCE(torch.autograd.Function):
return grad_hidden * (gradient * weights[:, None] / weights.sum()), None, None, None
-def language_model_loss(hidden, ids, lengths, vocabulary, answer_weight=1.0):
+def language_model_loss(hidden, ids, lengths, vocabulary, answer_weight=1.0,
+ completion_starts=None):
"""Train on all valid next-token targets, avoiding padding and final positions."""
positions = torch.arange(ids.shape[1] - 1, device=ids.device)
valid = positions[None, :] + 1 < lengths[:, None]
+ if completion_starts is not None:
+ valid = valid & (positions[None, :] + 1 >= completion_starts[:, None])
weights = torch.where(positions[None, :] + 2 == lengths[:, None], answer_weight, 1.0)
return _FrozenVocabularyCE.apply(hidden[:, :-1][valid], ids[:, 1:][valid],
weights[valid].to(dtype=hidden.dtype), vocabulary)
diff --git a/docs/LISA_FULL_ANSWER_PROTOCOL.md b/docs/LISA_FULL_ANSWER_PROTOCOL.md
new file mode 100644
index 0000000..173c620
--- /dev/null
+++ b/docs/LISA_FULL_ANSWER_PROTOCOL.md
@@ -0,0 +1,37 @@
+# 完整答案评估下的 LiSA 共享实验
+
+本轮在同一 Qwen3.5-2B 检查点上比较 3、4、5 个全注意力层接收共享分数的效果。上一轮发现首 token 命中的变化集中在 `` 和同一个选项。本轮要求模型从全词表生成完整的多 token 数值答案,逐题复核答案的数值。
+
+## 开发筛选与冻结
+
+从 0 开始编号。接收层分别为 `[15, 19, 23]`、`[11, 15, 19, 23]` 和 `[7, 11, 15, 19, 23]`。每个接收层使用本次前向中前一全注意力层实际输出的分数。接收端保留自身的 V、门控和输出投影。原模型与三个直接共享配置配对生成。
+
+候选任务为表中数值查找、重复键最后值查找、两位数加法、重复项计数。固定生成器在运行筛选之前写出每类任务 8 道开发题、24 道训练题、8 道验证题和 32 道留出测试题。同一数值题跨数据划分去重,加法按交换律规范操作数。每个候选都要满足原模型至少答对 6/8 且至少 2 道原模型答对的题在直接共享下生成了错误整数。选择时依次比较数字错误数、原模型正确数和接收层数。完成了生成却没有可提取答案的情况单独记数。
+
+使用检查点发布的单轮聊天模板和关闭 thinking 的生成前缀。所有配置从全词表逐 token 贪心生成,遇到回合结束或文本结束 token 停止,最多生成 24 tokens。主要指标要求已生成停止 token,并从整条答复提取完整整数。接受纯整数或明确的最终答案行,可去掉开头完整的 thinking 区块。原始 token、文本、停止原因和提取值都随结果存档。 [检查点聊天模板](https://huggingface.co/Qwen/Qwen3.5-2B/blob/15852e8c16360a2fea060d615a32b45270f8a8fc/chat_template.jinja)
+
+## LiSA 训练与测试
+
+开发筛选完成后用固定哈希验证题集、共享配置、原模型和筛选数据。仅在存在达标配置时启动训练。冻结原模型,只训练两个线性层组成的注意力头融合和 rank 40 的低秩 Q/K。用原模型在同一训练序列上的因果注意力分数作为教师。损失为 0.25 倍 Huber 距离加 0.75 倍全词表交叉熵,交叉熵覆盖参考答案的所有 token 和结束 token。每个训练样本更新后保存优化器和模型状态。验证集上生成完整答案,按正确数选择两轮中的最佳检查点,同分选较早者。
+
+最终对同一批留出题的原模型、直接共享、训练后的 LiSA 分别生成并保存完整回答。报告准确率、直接共享造成的数值错误、其中被 LiSA 恢复的题、新增错误和缺少可提取答案的情况。准确率差按题配对估计,另报告 McNemar 精确双侧检验。
+
+## 运行命令
+
+在已确认的远程 CPU 环境中,从源代码目录运行,使用独立输出目录。模型源目录需要包含上一轮实验使用的权重、配置、下载清单和 tokenizer。
+
+```sh
+export OPENBLAS_NUM_THREADS=1 OMP_NUM_THREADS=1
+PYTHON=venv/bin/python
+SOURCE=runs/cpu-qwen35-2b
+SCREEN=runs/NEW_FULL_ANSWER_SCREEN
+RESULT=runs/NEW_FULL_ANSWER_RESULT
+
+"$PYTHON" -B -m crossqkv.lisa_full_answer --source "$SOURCE" --out "$SCREEN" --batch-prompts 1 --preflight
+"$PYTHON" -B -m crossqkv.lisa_full_answer --source "$SOURCE" --out "$SCREEN" --batch-prompts 1
+"$PYTHON" -B -m crossqkv.lisa_full_answer_train --source "$SOURCE" --screen "$SCREEN" --out "$RESULT"
+```
+
+使用原目录运行相同命令即可续跑。筛选和测试将按已保存的题号继续。训练使用已保存的优化器和训练步。
+
+服务器约有 1.7 GiB 内存。本轮每次筛选只输入一道题,四个配置共享一次权重读取。PyTorch 进程在前两次预检中累计换页约 230 MiB,在服务器仍有约 1 GiB 可用内存时被退出。第三次预检沿用同一批冻结题,换页上限设为 384 MiB,保留服务器可用内存、进程 RSS 及运行时间检查。
diff --git a/functional/model.py b/functional/model.py
index 5942217..3f1a32a 100644
--- a/functional/model.py
+++ b/functional/model.py
@@ -77,11 +77,13 @@ def attention(q, k, v):
class StreamingLM:
- def __init__(self, weights, config, seconds=7200, enforce_memory=True):
+ def __init__(self, weights, config, seconds=7200, enforce_memory=True,
+ process_swap_limit_kib=128*1024):
self.tensors = load_tensors(Path(weights))
self.config = config.get('text_config', config)
self.deadline = time.monotonic() + seconds
self.enforce_memory = enforce_memory
+ self.process_swap_limit_kib = process_swap_limit_kib
self.eps = self.config['rms_norm_eps']
self.norm_replacement = None
self.capture_qk = False
@@ -107,7 +109,8 @@ class StreamingLM:
rate = (count-self.swap_observation[1])*4096/elapsed
self.swap_pressure_windows = self.swap_pressure_windows+1 if rate > 4*1024**2 else 0
own_swap_kib = int(status.get('VmSwap', '0 kB').split()[0])
- if self.swap_pressure_windows >= 3 and (available < 384*1024 or own_swap_kib > 128*1024):
+ if self.swap_pressure_windows >= 3 and (
+ available < 384*1024 or own_swap_kib > self.process_swap_limit_kib):
raise MemoryError(f'Sustained host swap pressure plus constrained memory: available={available} KiB, process_swap={own_swap_kib} KiB')
self.swap_observation = (now,count)
if rss_kib > 512*1024 or available < 256*1024:
diff --git a/results/lisa-full-answer-reproduction/code.sha256 b/results/lisa-full-answer-reproduction/code.sha256
new file mode 100644
index 0000000..57fb75b
--- /dev/null
+++ b/results/lisa-full-answer-reproduction/code.sha256
@@ -0,0 +1,9 @@
+a8ad25f70b2ccabfb92b82f7288e02738361d31c010e0fc83a02b5f5ecaff76b functional/model.py
+987420dbdd8b885821e7e7c09c38f0b34bf3651160857941554433adec645cc0 crossqkv/lisa_generate.py
+890654f75ea0ccf3cb83e221d2cc99f4873dd8a6fc016ed43fde490c9f2621ba crossqkv/lisa_full_answer.py
+97bb4882ec6949c2cf2528b97f2a6f00bc0c24194f72ebdc57bc1d3c810cd185 crossqkv/lisa_full_answer_train.py
+d47b4c9cc34082e9b356e745821298a43981e4cd18ed55a3f59b4b6fe7cc46e3 crossqkv/lisa_tail.py
+9f0b6a53f107950661e91c16f03b49440708b3936120e2f84ef1d66f185257b6 crossqkv/lisa_train.py
+96d12fdfa266ca02ac50330971ff403e04b977358f479d63c8d6276a514fe025 tests/test_lisa_full_answer.py
+d1f3b3b2b92005c47f7fbc4f558407749b7059592c3b54d8b784da58ea12b3ef tests/test_lisa_tail.py
+d249035103ed7f43978c0d6452bf70ec9a345777289cb92c0b6a2a181e6d4380 tests/test_lisa_train.py
diff --git a/results/lisa-full-answer-reproduction/frozen.json b/results/lisa-full-answer-reproduction/frozen.json
new file mode 100644
index 0000000..c437bf3
--- /dev/null
+++ b/results/lisa-full-answer-reproduction/frozen.json
@@ -0,0 +1,1775 @@
+{
+ "protocol": {
+ "weights": {
+ "manifest.json": "28efbaf94a5034333339a35f08ead151459a7d20c6c2d2f07a451e7f3bf154de",
+ "model_config.json": "ed1c1723241f23f7f4e23430759cbd7dcfb4103cbdfe052bfe7626b57c2615b4",
+ "tokenizer.json": "5f9e4d4901a92b997e463c1f46055088b6cca5ca61a6522d1b9f64c4bb81cb42"
+ },
+ "schedules": {
+ "native": [],
+ "direct_3": [
+ 15,
+ 19,
+ 23
+ ],
+ "direct_4": [
+ 11,
+ 15,
+ 19,
+ 23
+ ],
+ "direct_5": [
+ 7,
+ 11,
+ 15,
+ 19,
+ 23
+ ]
+ },
+ "cap": 24,
+ "stops": [
+ "<|im_end|>",
+ "<|endoftext|>"
+ ],
+ "batch_prompts": 1,
+ "decode": "full vocabulary greedy, closed thinking prefix"
+ },
+ "problems": {
+ "screen": [
+ {
+ "id": "screen-lookup-000",
+ "task": "lookup",
+ "question": "Records in time order: maple=56, pine=95, reed=62, vine=98, kelp=86, grove=92, heath=67, cedar=23, olive=61, amber=42, larch=39, umber=82.\nWhat is the recorded number for umber?",
+ "answer": 82
+ },
+ {
+ "id": "screen-lookup-001",
+ "task": "lookup",
+ "question": "Records in time order: olive=25, pine=92, umber=32, heath=93, vine=47, thyme=39, kelp=43, dune=57, elm=69, iris=31, birch=23, nettle=35.\nWhat is the recorded number for vine?",
+ "answer": 47
+ },
+ {
+ "id": "screen-lookup-002",
+ "task": "lookup",
+ "question": "Records in time order: pine=66, fern=87, amber=74, thyme=71, dune=52, maple=51, olive=31, nettle=73, quartz=29, umber=69, iris=62, jade=26.\nWhat is the recorded number for olive?",
+ "answer": 31
+ },
+ {
+ "id": "screen-lookup-003",
+ "task": "lookup",
+ "question": "Records in time order: jade=58, birch=94, grove=59, umber=69, thyme=44, nettle=79, heath=78, elm=99, pine=51, yew=89, larch=47, quartz=73.\nWhat is the recorded number for pine?",
+ "answer": 51
+ },
+ {
+ "id": "screen-lookup-004",
+ "task": "lookup",
+ "question": "Records in time order: fern=45, larch=42, olive=92, willow=81, thyme=34, jade=49, slate=22, vine=86, umber=47, nettle=44, cedar=99, pine=66.\nWhat is the recorded number for nettle?",
+ "answer": 44
+ },
+ {
+ "id": "screen-lookup-005",
+ "task": "lookup",
+ "question": "Records in time order: willow=58, slate=70, kelp=22, yew=20, vine=64, iris=23, reed=98, quartz=71, dune=62, heath=81, jade=56, pine=88.\nWhat is the recorded number for kelp?",
+ "answer": 22
+ },
+ {
+ "id": "screen-lookup-006",
+ "task": "lookup",
+ "question": "Records in time order: maple=56, larch=90, jade=67, umber=33, birch=89, thyme=52, nettle=76, reed=59, quartz=23, grove=73, iris=72, yew=61.\nWhat is the recorded number for larch?",
+ "answer": 90
+ },
+ {
+ "id": "screen-lookup-007",
+ "task": "lookup",
+ "question": "Records in time order: quartz=89, pine=50, grove=64, vine=95, kelp=88, slate=79, iris=68, yew=25, larch=70, maple=78, willow=83, olive=87.\nWhat is the recorded number for olive?",
+ "answer": 87
+ },
+ {
+ "id": "screen-latest-000",
+ "task": "latest",
+ "question": "Records in time order: maple=88, birch=63, pine=85, birch=40, willow=95, dune=72, quartz=79, umber=46, nettle=99, vine=34, cedar=58, jade=82.\nWhat is the last recorded number for birch?",
+ "answer": 40
+ },
+ {
+ "id": "screen-latest-001",
+ "task": "latest",
+ "question": "Records in time order: larch=30, amber=69, fern=27, maple=37, cedar=33, reed=74, fern=53, nettle=95, dune=94, kelp=43, grove=42, umber=65.\nWhat is the last recorded number for fern?",
+ "answer": 53
+ },
+ {
+ "id": "screen-latest-002",
+ "task": "latest",
+ "question": "Records in time order: birch=62, jade=71, elm=78, amber=97, slate=98, jade=87, vine=50, thyme=94, pine=32, larch=96, dune=83, umber=93.\nWhat is the last recorded number for jade?",
+ "answer": 87
+ },
+ {
+ "id": "screen-latest-003",
+ "task": "latest",
+ "question": "Records in time order: quartz=84, quartz=78, yew=51, larch=64, maple=44, kelp=69, jade=86, willow=24, thyme=65, amber=98, pine=28, nettle=68.\nWhat is the last recorded number for quartz?",
+ "answer": 78
+ },
+ {
+ "id": "screen-latest-004",
+ "task": "latest",
+ "question": "Records in time order: umber=39, amber=59, maple=79, kelp=28, slate=82, grove=92, amber=44, vine=93, cedar=91, yew=64, iris=98, birch=20.\nWhat is the last recorded number for amber?",
+ "answer": 44
+ },
+ {
+ "id": "screen-latest-005",
+ "task": "latest",
+ "question": "Records in time order: iris=92, pine=62, vine=94, pine=37, umber=53, quartz=83, dune=39, yew=22, amber=99, heath=25, fern=71, slate=93.\nWhat is the last recorded number for pine?",
+ "answer": 37
+ },
+ {
+ "id": "screen-latest-006",
+ "task": "latest",
+ "question": "Records in time order: nettle=93, thyme=51, nettle=78, grove=46, cedar=98, slate=30, birch=83, larch=32, vine=74, willow=89, iris=23, elm=75.\nWhat is the last recorded number for nettle?",
+ "answer": 78
+ },
+ {
+ "id": "screen-latest-007",
+ "task": "latest",
+ "question": "Records in time order: kelp=32, cedar=62, pine=57, jade=93, quartz=25, vine=20, elm=73, willow=44, thyme=40, dune=24, birch=38, jade=64.\nWhat is the last recorded number for jade?",
+ "answer": 64
+ },
+ {
+ "id": "screen-addition-000",
+ "task": "addition",
+ "question": "What is 20 plus 63?",
+ "answer": 83
+ },
+ {
+ "id": "screen-addition-001",
+ "task": "addition",
+ "question": "What is 43 plus 72?",
+ "answer": 115
+ },
+ {
+ "id": "screen-addition-002",
+ "task": "addition",
+ "question": "What is 63 plus 86?",
+ "answer": 149
+ },
+ {
+ "id": "screen-addition-003",
+ "task": "addition",
+ "question": "What is 30 plus 35?",
+ "answer": 65
+ },
+ {
+ "id": "screen-addition-004",
+ "task": "addition",
+ "question": "What is 53 plus 55?",
+ "answer": 108
+ },
+ {
+ "id": "screen-addition-005",
+ "task": "addition",
+ "question": "What is 42 plus 60?",
+ "answer": 102
+ },
+ {
+ "id": "screen-addition-006",
+ "task": "addition",
+ "question": "What is 21 plus 79?",
+ "answer": 100
+ },
+ {
+ "id": "screen-addition-007",
+ "task": "addition",
+ "question": "What is 31 plus 83?",
+ "answer": 114
+ },
+ {
+ "id": "screen-count-000",
+ "task": "count",
+ "question": "Items: fern, fern, fern, fern, fern, fern, fern, larch, fern, larch, larch, larch, fern, larch, fern, larch, fern, fern, fern, fern.\nHow many items are exactly 'fern'?",
+ "answer": 14
+ },
+ {
+ "id": "screen-count-001",
+ "task": "count",
+ "question": "Items: dune, dune, fern, dune, fern, dune, dune, dune, dune, fern, fern, dune, dune, dune, dune, dune, dune.\nHow many items are exactly 'dune'?",
+ "answer": 13
+ },
+ {
+ "id": "screen-count-002",
+ "task": "count",
+ "question": "Items: elm, elm, elm, elm, elm, elm, elm, kelp, elm, elm, kelp, elm, elm, elm, elm, elm, kelp, elm.\nHow many items are exactly 'elm'?",
+ "answer": 15
+ },
+ {
+ "id": "screen-count-003",
+ "task": "count",
+ "question": "Items: dune, dune, thyme, dune, dune, dune, dune, dune, thyme, thyme, dune, dune, dune, dune, thyme, dune.\nHow many items are exactly 'dune'?",
+ "answer": 12
+ },
+ {
+ "id": "screen-count-004",
+ "task": "count",
+ "question": "Items: fern, dune, fern, dune, dune, dune, dune, dune, dune, fern, dune, fern, fern, fern, dune, fern, dune, dune, dune, fern, fern, dune, dune, dune.\nHow many items are exactly 'dune'?",
+ "answer": 15
+ },
+ {
+ "id": "screen-count-005",
+ "task": "count",
+ "question": "Items: nettle, maple, maple, maple, nettle, maple, maple, nettle, nettle, maple, maple, maple, nettle, maple, nettle, maple, nettle, maple, nettle, maple, nettle, maple.\nHow many items are exactly 'maple'?",
+ "answer": 13
+ },
+ {
+ "id": "screen-count-006",
+ "task": "count",
+ "question": "Items: maple, maple, maple, umber, maple, maple, maple, maple, maple, umber, maple, umber, maple, maple, maple, maple.\nHow many items are exactly 'maple'?",
+ "answer": 13
+ },
+ {
+ "id": "screen-count-007",
+ "task": "count",
+ "question": "Items: quartz, birch, birch, birch, quartz, birch, birch, quartz, birch, quartz, birch, quartz, quartz, birch, quartz, quartz, quartz, quartz.\nHow many items are exactly 'quartz'?",
+ "answer": 10
+ }
+ ],
+ "fit": [
+ {
+ "id": "fit-lookup-000",
+ "task": "lookup",
+ "question": "Records in time order: quartz=95, iris=69, dune=67, slate=61, yew=79, thyme=80, cedar=65, olive=55, amber=87, umber=28, nettle=83, maple=91.\nWhat is the recorded number for nettle?",
+ "answer": 83
+ },
+ {
+ "id": "fit-lookup-001",
+ "task": "lookup",
+ "question": "Records in time order: jade=52, heath=85, larch=36, olive=27, umber=98, pine=64, quartz=86, slate=55, dune=97, iris=59, birch=54, grove=87.\nWhat is the recorded number for birch?",
+ "answer": 54
+ },
+ {
+ "id": "fit-lookup-002",
+ "task": "lookup",
+ "question": "Records in time order: amber=52, pine=64, umber=88, vine=73, olive=61, slate=47, cedar=67, kelp=97, iris=78, elm=56, thyme=58, yew=59.\nWhat is the recorded number for vine?",
+ "answer": 73
+ },
+ {
+ "id": "fit-lookup-003",
+ "task": "lookup",
+ "question": "Records in time order: dune=82, kelp=25, reed=80, thyme=30, willow=96, heath=71, maple=77, umber=69, pine=52, elm=85, olive=61, quartz=56.\nWhat is the recorded number for olive?",
+ "answer": 61
+ },
+ {
+ "id": "fit-lookup-004",
+ "task": "lookup",
+ "question": "Records in time order: yew=65, nettle=96, iris=82, elm=92, thyme=97, cedar=44, jade=72, dune=35, quartz=89, vine=32, grove=54, willow=41.\nWhat is the recorded number for nettle?",
+ "answer": 96
+ },
+ {
+ "id": "fit-lookup-005",
+ "task": "lookup",
+ "question": "Records in time order: iris=82, reed=21, heath=22, pine=85, kelp=57, yew=49, thyme=66, fern=38, amber=74, umber=34, slate=50, nettle=87.\nWhat is the recorded number for slate?",
+ "answer": 50
+ },
+ {
+ "id": "fit-lookup-006",
+ "task": "lookup",
+ "question": "Records in time order: cedar=52, amber=86, quartz=92, dune=94, birch=24, larch=21, heath=67, olive=79, vine=42, umber=71, kelp=33, willow=98.\nWhat is the recorded number for olive?",
+ "answer": 79
+ },
+ {
+ "id": "fit-lookup-007",
+ "task": "lookup",
+ "question": "Records in time order: nettle=29, larch=21, thyme=84, amber=78, fern=24, heath=60, iris=26, olive=82, reed=96, grove=71, vine=30, dune=77.\nWhat is the recorded number for fern?",
+ "answer": 24
+ },
+ {
+ "id": "fit-lookup-008",
+ "task": "lookup",
+ "question": "Records in time order: nettle=30, birch=54, vine=58, amber=33, kelp=81, pine=39, yew=46, dune=92, quartz=34, reed=32, iris=93, jade=82.\nWhat is the recorded number for yew?",
+ "answer": 46
+ },
+ {
+ "id": "fit-lookup-009",
+ "task": "lookup",
+ "question": "Records in time order: larch=79, nettle=20, pine=72, iris=53, vine=56, grove=48, thyme=22, maple=40, jade=34, birch=27, quartz=63, reed=64.\nWhat is the recorded number for jade?",
+ "answer": 34
+ },
+ {
+ "id": "fit-lookup-010",
+ "task": "lookup",
+ "question": "Records in time order: maple=96, thyme=37, fern=24, grove=60, amber=44, umber=45, yew=35, larch=52, pine=22, nettle=28, birch=91, iris=87.\nWhat is the recorded number for umber?",
+ "answer": 45
+ },
+ {
+ "id": "fit-lookup-011",
+ "task": "lookup",
+ "question": "Records in time order: elm=52, heath=78, cedar=33, nettle=65, reed=41, slate=28, birch=95, olive=68, grove=38, larch=54, amber=39, thyme=80.\nWhat is the recorded number for slate?",
+ "answer": 28
+ },
+ {
+ "id": "fit-lookup-012",
+ "task": "lookup",
+ "question": "Records in time order: cedar=34, olive=75, willow=72, larch=85, grove=51, vine=28, heath=91, reed=89, iris=38, kelp=88, jade=25, yew=27.\nWhat is the recorded number for grove?",
+ "answer": 51
+ },
+ {
+ "id": "fit-lookup-013",
+ "task": "lookup",
+ "question": "Records in time order: pine=25, nettle=53, reed=85, cedar=82, vine=77, grove=64, kelp=61, birch=36, amber=30, yew=49, fern=83, slate=44.\nWhat is the recorded number for slate?",
+ "answer": 44
+ },
+ {
+ "id": "fit-lookup-014",
+ "task": "lookup",
+ "question": "Records in time order: willow=40, dune=71, reed=30, jade=84, quartz=86, olive=81, fern=26, grove=33, maple=63, iris=82, cedar=52, yew=42.\nWhat is the recorded number for yew?",
+ "answer": 42
+ },
+ {
+ "id": "fit-lookup-015",
+ "task": "lookup",
+ "question": "Records in time order: grove=55, slate=96, reed=81, birch=26, olive=57, maple=22, dune=98, pine=84, yew=94, iris=97, quartz=38, elm=51.\nWhat is the recorded number for iris?",
+ "answer": 97
+ },
+ {
+ "id": "fit-lookup-016",
+ "task": "lookup",
+ "question": "Records in time order: cedar=37, heath=61, kelp=83, quartz=24, iris=55, amber=20, thyme=57, dune=51, fern=79, pine=45, yew=89, reed=69.\nWhat is the recorded number for dune?",
+ "answer": 51
+ },
+ {
+ "id": "fit-lookup-017",
+ "task": "lookup",
+ "question": "Records in time order: kelp=33, vine=94, pine=75, elm=84, olive=43, quartz=70, birch=80, maple=66, grove=74, fern=69, cedar=57, nettle=26.\nWhat is the recorded number for birch?",
+ "answer": 80
+ },
+ {
+ "id": "fit-lookup-018",
+ "task": "lookup",
+ "question": "Records in time order: maple=84, thyme=91, nettle=69, heath=33, kelp=47, jade=36, umber=76, cedar=97, reed=79, fern=28, birch=25, yew=52.\nWhat is the recorded number for thyme?",
+ "answer": 91
+ },
+ {
+ "id": "fit-lookup-019",
+ "task": "lookup",
+ "question": "Records in time order: iris=82, grove=59, vine=96, elm=31, yew=89, pine=86, olive=76, cedar=21, maple=50, birch=77, umber=20, fern=46.\nWhat is the recorded number for vine?",
+ "answer": 96
+ },
+ {
+ "id": "fit-lookup-020",
+ "task": "lookup",
+ "question": "Records in time order: nettle=69, maple=61, fern=95, willow=49, cedar=45, pine=31, iris=44, thyme=73, grove=99, quartz=91, umber=75, reed=38.\nWhat is the recorded number for grove?",
+ "answer": 99
+ },
+ {
+ "id": "fit-lookup-021",
+ "task": "lookup",
+ "question": "Records in time order: dune=43, jade=99, reed=83, slate=64, elm=23, kelp=21, amber=40, grove=30, olive=50, heath=33, maple=92, larch=41.\nWhat is the recorded number for maple?",
+ "answer": 92
+ },
+ {
+ "id": "fit-lookup-022",
+ "task": "lookup",
+ "question": "Records in time order: iris=23, pine=54, cedar=97, quartz=42, willow=35, nettle=72, maple=73, slate=88, reed=39, yew=93, vine=41, amber=26.\nWhat is the recorded number for iris?",
+ "answer": 23
+ },
+ {
+ "id": "fit-lookup-023",
+ "task": "lookup",
+ "question": "Records in time order: pine=48, thyme=52, elm=54, cedar=42, umber=90, vine=65, grove=44, willow=47, amber=33, reed=55, olive=46, heath=82.\nWhat is the recorded number for olive?",
+ "answer": 46
+ },
+ {
+ "id": "fit-latest-000",
+ "task": "latest",
+ "question": "Records in time order: dune=21, iris=62, amber=55, umber=57, fern=60, yew=74, jade=50, reed=37, quartz=73, heath=89, kelp=98, reed=85.\nWhat is the last recorded number for reed?",
+ "answer": 85
+ },
+ {
+ "id": "fit-latest-001",
+ "task": "latest",
+ "question": "Records in time order: fern=98, fern=81, jade=92, yew=42, iris=23, heath=48, amber=79, dune=61, willow=85, nettle=33, birch=28, larch=46.\nWhat is the last recorded number for fern?",
+ "answer": 81
+ },
+ {
+ "id": "fit-latest-002",
+ "task": "latest",
+ "question": "Records in time order: maple=45, cedar=37, pine=78, elm=94, fern=21, olive=89, quartz=90, slate=48, kelp=30, olive=57, amber=35, iris=97.\nWhat is the last recorded number for olive?",
+ "answer": 57
+ },
+ {
+ "id": "fit-latest-003",
+ "task": "latest",
+ "question": "Records in time order: larch=79, iris=34, cedar=78, elm=27, quartz=42, thyme=62, heath=87, pine=95, pine=91, slate=20, umber=82, maple=50.\nWhat is the last recorded number for pine?",
+ "answer": 91
+ },
+ {
+ "id": "fit-latest-004",
+ "task": "latest",
+ "question": "Records in time order: yew=77, larch=54, grove=99, quartz=39, jade=92, heath=30, heath=82, reed=24, cedar=85, nettle=49, fern=69, iris=95.\nWhat is the last recorded number for heath?",
+ "answer": 82
+ },
+ {
+ "id": "fit-latest-005",
+ "task": "latest",
+ "question": "Records in time order: dune=95, dune=46, reed=21, umber=49, heath=55, jade=69, thyme=75, cedar=32, willow=40, yew=53, elm=33, quartz=26.\nWhat is the last recorded number for dune?",
+ "answer": 46
+ },
+ {
+ "id": "fit-latest-006",
+ "task": "latest",
+ "question": "Records in time order: pine=60, dune=85, fern=71, cedar=43, larch=80, jade=26, reed=76, kelp=30, fern=72, willow=95, olive=78, grove=39.\nWhat is the last recorded number for fern?",
+ "answer": 72
+ },
+ {
+ "id": "fit-latest-007",
+ "task": "latest",
+ "question": "Records in time order: birch=98, grove=53, willow=28, dune=71, amber=70, reed=72, yew=86, amber=79, vine=47, fern=20, heath=66, cedar=99.\nWhat is the last recorded number for amber?",
+ "answer": 79
+ },
+ {
+ "id": "fit-latest-008",
+ "task": "latest",
+ "question": "Records in time order: larch=32, vine=21, elm=55, amber=48, birch=98, pine=76, maple=65, dune=93, cedar=70, iris=68, heath=44, dune=99.\nWhat is the last recorded number for dune?",
+ "answer": 99
+ },
+ {
+ "id": "fit-latest-009",
+ "task": "latest",
+ "question": "Records in time order: pine=53, birch=67, vine=29, yew=31, birch=61, elm=45, grove=76, quartz=62, slate=41, amber=27, cedar=49, kelp=37.\nWhat is the last recorded number for birch?",
+ "answer": 61
+ },
+ {
+ "id": "fit-latest-010",
+ "task": "latest",
+ "question": "Records in time order: larch=89, larch=87, heath=53, iris=37, slate=36, birch=39, nettle=74, elm=61, willow=65, umber=31, maple=75, amber=85.\nWhat is the last recorded number for larch?",
+ "answer": 87
+ },
+ {
+ "id": "fit-latest-011",
+ "task": "latest",
+ "question": "Records in time order: elm=43, pine=48, amber=90, cedar=23, pine=30, fern=38, vine=81, thyme=75, kelp=22, grove=34, quartz=73, dune=95.\nWhat is the last recorded number for pine?",
+ "answer": 30
+ },
+ {
+ "id": "fit-latest-012",
+ "task": "latest",
+ "question": "Records in time order: fern=55, fern=51, yew=98, maple=72, elm=66, nettle=26, heath=25, pine=81, reed=84, birch=74, jade=88, vine=56.\nWhat is the last recorded number for fern?",
+ "answer": 51
+ },
+ {
+ "id": "fit-latest-013",
+ "task": "latest",
+ "question": "Records in time order: larch=88, quartz=91, reed=89, thyme=61, kelp=73, grove=27, fern=39, reed=23, heath=38, pine=72, nettle=76, dune=80.\nWhat is the last recorded number for reed?",
+ "answer": 23
+ },
+ {
+ "id": "fit-latest-014",
+ "task": "latest",
+ "question": "Records in time order: quartz=42, iris=53, iris=25, maple=43, elm=65, heath=82, jade=62, larch=92, olive=29, umber=49, dune=81, reed=89.\nWhat is the last recorded number for iris?",
+ "answer": 25
+ },
+ {
+ "id": "fit-latest-015",
+ "task": "latest",
+ "question": "Records in time order: thyme=73, willow=84, iris=48, yew=38, jade=93, nettle=44, maple=24, dune=54, maple=30, cedar=59, vine=81, reed=37.\nWhat is the last recorded number for maple?",
+ "answer": 30
+ },
+ {
+ "id": "fit-latest-016",
+ "task": "latest",
+ "question": "Records in time order: umber=67, maple=75, slate=60, iris=51, reed=88, cedar=21, vine=38, grove=99, olive=93, reed=91, elm=36, amber=40.\nWhat is the last recorded number for reed?",
+ "answer": 91
+ },
+ {
+ "id": "fit-latest-017",
+ "task": "latest",
+ "question": "Records in time order: pine=63, larch=62, vine=69, amber=67, iris=83, quartz=64, jade=81, umber=93, dune=66, dune=25, slate=39, thyme=23.\nWhat is the last recorded number for dune?",
+ "answer": 25
+ },
+ {
+ "id": "fit-latest-018",
+ "task": "latest",
+ "question": "Records in time order: amber=80, elm=44, nettle=98, fern=76, slate=70, vine=94, thyme=49, birch=68, yew=61, cedar=41, dune=24, dune=38.\nWhat is the last recorded number for dune?",
+ "answer": 38
+ },
+ {
+ "id": "fit-latest-019",
+ "task": "latest",
+ "question": "Records in time order: vine=52, thyme=80, vine=78, pine=22, larch=66, willow=77, maple=42, iris=25, olive=75, dune=62, umber=64, quartz=90.\nWhat is the last recorded number for vine?",
+ "answer": 78
+ },
+ {
+ "id": "fit-latest-020",
+ "task": "latest",
+ "question": "Records in time order: dune=48, reed=31, jade=43, thyme=90, larch=52, vine=20, yew=99, elm=75, grove=77, quartz=65, iris=28, yew=74.\nWhat is the last recorded number for yew?",
+ "answer": 74
+ },
+ {
+ "id": "fit-latest-021",
+ "task": "latest",
+ "question": "Records in time order: slate=76, reed=40, nettle=38, elm=58, kelp=62, larch=23, umber=27, pine=68, fern=97, iris=98, cedar=75, elm=54.\nWhat is the last recorded number for elm?",
+ "answer": 54
+ },
+ {
+ "id": "fit-latest-022",
+ "task": "latest",
+ "question": "Records in time order: pine=81, olive=91, jade=43, pine=84, iris=24, fern=22, elm=57, heath=58, cedar=80, dune=33, willow=98, amber=31.\nWhat is the last recorded number for pine?",
+ "answer": 84
+ },
+ {
+ "id": "fit-latest-023",
+ "task": "latest",
+ "question": "Records in time order: grove=25, iris=39, amber=46, umber=32, olive=64, jade=43, birch=61, heath=76, pine=54, elm=62, jade=36, thyme=93.\nWhat is the last recorded number for jade?",
+ "answer": 36
+ },
+ {
+ "id": "fit-addition-000",
+ "task": "addition",
+ "question": "What is 44 plus 51?",
+ "answer": 95
+ },
+ {
+ "id": "fit-addition-001",
+ "task": "addition",
+ "question": "What is 22 plus 55?",
+ "answer": 77
+ },
+ {
+ "id": "fit-addition-002",
+ "task": "addition",
+ "question": "What is 68 plus 87?",
+ "answer": 155
+ },
+ {
+ "id": "fit-addition-003",
+ "task": "addition",
+ "question": "What is 43 plus 88?",
+ "answer": 131
+ },
+ {
+ "id": "fit-addition-004",
+ "task": "addition",
+ "question": "What is 49 plus 63?",
+ "answer": 112
+ },
+ {
+ "id": "fit-addition-005",
+ "task": "addition",
+ "question": "What is 49 plus 83?",
+ "answer": 132
+ },
+ {
+ "id": "fit-addition-006",
+ "task": "addition",
+ "question": "What is 21 plus 88?",
+ "answer": 109
+ },
+ {
+ "id": "fit-addition-007",
+ "task": "addition",
+ "question": "What is 60 plus 61?",
+ "answer": 121
+ },
+ {
+ "id": "fit-addition-008",
+ "task": "addition",
+ "question": "What is 22 plus 64?",
+ "answer": 86
+ },
+ {
+ "id": "fit-addition-009",
+ "task": "addition",
+ "question": "What is 41 plus 87?",
+ "answer": 128
+ },
+ {
+ "id": "fit-addition-010",
+ "task": "addition",
+ "question": "What is 34 plus 42?",
+ "answer": 76
+ },
+ {
+ "id": "fit-addition-011",
+ "task": "addition",
+ "question": "What is 28 plus 72?",
+ "answer": 100
+ },
+ {
+ "id": "fit-addition-012",
+ "task": "addition",
+ "question": "What is 65 plus 71?",
+ "answer": 136
+ },
+ {
+ "id": "fit-addition-013",
+ "task": "addition",
+ "question": "What is 43 plus 56?",
+ "answer": 99
+ },
+ {
+ "id": "fit-addition-014",
+ "task": "addition",
+ "question": "What is 69 plus 71?",
+ "answer": 140
+ },
+ {
+ "id": "fit-addition-015",
+ "task": "addition",
+ "question": "What is 52 plus 71?",
+ "answer": 123
+ },
+ {
+ "id": "fit-addition-016",
+ "task": "addition",
+ "question": "What is 26 plus 62?",
+ "answer": 88
+ },
+ {
+ "id": "fit-addition-017",
+ "task": "addition",
+ "question": "What is 77 plus 84?",
+ "answer": 161
+ },
+ {
+ "id": "fit-addition-018",
+ "task": "addition",
+ "question": "What is 73 plus 73?",
+ "answer": 146
+ },
+ {
+ "id": "fit-addition-019",
+ "task": "addition",
+ "question": "What is 60 plus 76?",
+ "answer": 136
+ },
+ {
+ "id": "fit-addition-020",
+ "task": "addition",
+ "question": "What is 69 plus 85?",
+ "answer": 154
+ },
+ {
+ "id": "fit-addition-021",
+ "task": "addition",
+ "question": "What is 20 plus 44?",
+ "answer": 64
+ },
+ {
+ "id": "fit-addition-022",
+ "task": "addition",
+ "question": "What is 43 plus 63?",
+ "answer": 106
+ },
+ {
+ "id": "fit-addition-023",
+ "task": "addition",
+ "question": "What is 40 plus 79?",
+ "answer": 119
+ },
+ {
+ "id": "fit-count-000",
+ "task": "count",
+ "question": "Items: cedar, willow, cedar, cedar, cedar, cedar, cedar, cedar, cedar, cedar, cedar, willow, willow, willow, cedar, cedar, cedar, cedar.\nHow many items are exactly 'cedar'?",
+ "answer": 14
+ },
+ {
+ "id": "fit-count-001",
+ "task": "count",
+ "question": "Items: yew, jade, yew, yew, yew, yew, yew, jade, yew, jade, yew, yew, jade, jade, yew, yew, yew, yew.\nHow many items are exactly 'yew'?",
+ "answer": 13
+ },
+ {
+ "id": "fit-count-002",
+ "task": "count",
+ "question": "Items: thyme, thyme, dune, dune, dune, dune, thyme, dune, dune, thyme, dune, dune, dune, dune, thyme.\nHow many items are exactly 'dune'?",
+ "answer": 10
+ },
+ {
+ "id": "fit-count-003",
+ "task": "count",
+ "question": "Items: pine, pine, pine, elm, elm, pine, elm, pine, elm, pine, pine, elm, pine, pine, pine, pine, elm, elm, elm, pine, elm, pine.\nHow many items are exactly 'pine'?",
+ "answer": 13
+ },
+ {
+ "id": "fit-count-004",
+ "task": "count",
+ "question": "Items: vine, vine, vine, vine, quartz, vine, vine, quartz, quartz, vine, quartz, vine, quartz, vine, vine, quartz, vine, vine, quartz.\nHow many items are exactly 'vine'?",
+ "answer": 12
+ },
+ {
+ "id": "fit-count-005",
+ "task": "count",
+ "question": "Items: dune, dune, iris, iris, iris, dune, dune, dune, dune, dune, dune, dune, iris, dune, dune, iris, dune, dune, dune, iris.\nHow many items are exactly 'dune'?",
+ "answer": 14
+ },
+ {
+ "id": "fit-count-006",
+ "task": "count",
+ "question": "Items: elm, nettle, nettle, nettle, elm, nettle, elm, nettle, elm, nettle, elm, nettle, elm, nettle, nettle, nettle, elm, elm, elm.\nHow many items are exactly 'nettle'?",
+ "answer": 10
+ },
+ {
+ "id": "fit-count-007",
+ "task": "count",
+ "question": "Items: umber, umber, umber, amber, umber, amber, umber, umber, umber, amber, umber, umber, umber, amber, umber, umber, umber, amber.\nHow many items are exactly 'umber'?",
+ "answer": 13
+ },
+ {
+ "id": "fit-count-008",
+ "task": "count",
+ "question": "Items: dune, dune, dune, dune, slate, slate, slate, dune, dune, dune, slate, dune, dune, dune, dune.\nHow many items are exactly 'dune'?",
+ "answer": 11
+ },
+ {
+ "id": "fit-count-009",
+ "task": "count",
+ "question": "Items: pine, jade, jade, jade, pine, pine, jade, pine, pine, pine, pine, pine, jade, jade, jade, pine, pine, jade, pine, pine, pine, jade, pine.\nHow many items are exactly 'pine'?",
+ "answer": 14
+ },
+ {
+ "id": "fit-count-010",
+ "task": "count",
+ "question": "Items: grove, grove, grove, grove, cedar, grove, grove, cedar, grove, grove, grove, grove, cedar, grove, grove.\nHow many items are exactly 'grove'?",
+ "answer": 12
+ },
+ {
+ "id": "fit-count-011",
+ "task": "count",
+ "question": "Items: cedar, nettle, cedar, cedar, nettle, cedar, cedar, nettle, nettle, nettle, cedar, cedar, nettle, nettle, cedar, cedar, nettle, cedar, cedar, nettle.\nHow many items are exactly 'cedar'?",
+ "answer": 11
+ },
+ {
+ "id": "fit-count-012",
+ "task": "count",
+ "question": "Items: grove, grove, grove, grove, grove, amber, amber, grove, grove, grove, amber, grove, amber, amber, grove, amber, amber.\nHow many items are exactly 'grove'?",
+ "answer": 10
+ },
+ {
+ "id": "fit-count-013",
+ "task": "count",
+ "question": "Items: thyme, thyme, thyme, elm, thyme, elm, elm, thyme, elm, thyme, elm, elm, thyme, thyme, thyme, thyme, thyme, thyme, thyme, thyme, elm.\nHow many items are exactly 'thyme'?",
+ "answer": 14
+ },
+ {
+ "id": "fit-count-014",
+ "task": "count",
+ "question": "Items: thyme, thyme, grove, thyme, grove, grove, thyme, thyme, thyme, thyme, thyme, thyme, thyme, grove, grove, thyme, grove, thyme, thyme, grove, thyme, thyme, grove, grove.\nHow many items are exactly 'thyme'?",
+ "answer": 15
+ },
+ {
+ "id": "fit-count-015",
+ "task": "count",
+ "question": "Items: amber, quartz, amber, quartz, amber, amber, amber, quartz, amber, amber, amber, amber, quartz, amber, amber, quartz, quartz.\nHow many items are exactly 'amber'?",
+ "answer": 11
+ },
+ {
+ "id": "fit-count-016",
+ "task": "count",
+ "question": "Items: vine, umber, umber, vine, vine, umber, vine, vine, vine, vine, umber, vine, umber, umber, vine, umber, vine, vine, vine.\nHow many items are exactly 'vine'?",
+ "answer": 12
+ },
+ {
+ "id": "fit-count-017",
+ "task": "count",
+ "question": "Items: fern, fern, fern, fern, fern, fern, fern, fern, elm, elm, fern, elm, fern, fern, elm, fern, fern, fern.\nHow many items are exactly 'fern'?",
+ "answer": 14
+ },
+ {
+ "id": "fit-count-018",
+ "task": "count",
+ "question": "Items: fern, fern, reed, reed, reed, fern, reed, reed, reed, fern, reed, fern, reed, fern, reed, reed, fern, fern, reed, fern.\nHow many items are exactly 'reed'?",
+ "answer": 11
+ },
+ {
+ "id": "fit-count-019",
+ "task": "count",
+ "question": "Items: grove, grove, grove, grove, kelp, grove, grove, grove, grove, kelp, kelp, grove, grove, kelp, kelp, grove, grove, grove, kelp, kelp, kelp, kelp, grove.\nHow many items are exactly 'grove'?",
+ "answer": 14
+ },
+ {
+ "id": "fit-count-020",
+ "task": "count",
+ "question": "Items: kelp, grove, kelp, kelp, kelp, grove, grove, grove, kelp, kelp, grove, kelp, grove, kelp, kelp, kelp, kelp, kelp, kelp.\nHow many items are exactly 'kelp'?",
+ "answer": 13
+ },
+ {
+ "id": "fit-count-021",
+ "task": "count",
+ "question": "Items: olive, olive, olive, larch, larch, olive, larch, olive, olive, olive, olive, larch, olive, larch, olive, olive, larch, olive.\nHow many items are exactly 'olive'?",
+ "answer": 12
+ },
+ {
+ "id": "fit-count-022",
+ "task": "count",
+ "question": "Items: vine, vine, vine, vine, pine, pine, vine, pine, vine, pine, vine, vine, pine, vine, pine, pine, vine, vine.\nHow many items are exactly 'vine'?",
+ "answer": 11
+ },
+ {
+ "id": "fit-count-023",
+ "task": "count",
+ "question": "Items: larch, pine, larch, larch, pine, larch, pine, pine, pine, pine, larch, pine, larch, pine, pine, pine, pine.\nHow many items are exactly 'pine'?",
+ "answer": 11
+ }
+ ],
+ "validation": [
+ {
+ "id": "validation-lookup-000",
+ "task": "lookup",
+ "question": "Records in time order: iris=94, nettle=28, quartz=35, slate=65, heath=73, yew=36, thyme=23, cedar=89, umber=76, birch=97, larch=45, vine=59.\nWhat is the recorded number for nettle?",
+ "answer": 28
+ },
+ {
+ "id": "validation-lookup-001",
+ "task": "lookup",
+ "question": "Records in time order: dune=29, larch=77, elm=85, amber=83, slate=66, maple=68, umber=90, olive=58, iris=96, heath=55, vine=92, birch=81.\nWhat is the recorded number for vine?",
+ "answer": 92
+ },
+ {
+ "id": "validation-lookup-002",
+ "task": "lookup",
+ "question": "Records in time order: fern=42, larch=29, cedar=44, kelp=27, quartz=45, olive=58, maple=84, birch=91, vine=24, dune=41, yew=71, grove=98.\nWhat is the recorded number for yew?",
+ "answer": 71
+ },
+ {
+ "id": "validation-lookup-003",
+ "task": "lookup",
+ "question": "Records in time order: iris=89, nettle=68, willow=36, umber=54, yew=38, thyme=33, larch=53, birch=65, olive=34, kelp=49, cedar=84, grove=71.\nWhat is the recorded number for iris?",
+ "answer": 89
+ },
+ {
+ "id": "validation-lookup-004",
+ "task": "lookup",
+ "question": "Records in time order: fern=28, larch=99, nettle=83, pine=59, amber=98, dune=69, yew=39, grove=71, birch=43, maple=86, kelp=88, elm=54.\nWhat is the recorded number for amber?",
+ "answer": 98
+ },
+ {
+ "id": "validation-lookup-005",
+ "task": "lookup",
+ "question": "Records in time order: amber=71, willow=69, kelp=81, yew=59, olive=65, iris=33, thyme=35, reed=84, dune=72, grove=26, larch=43, slate=97.\nWhat is the recorded number for grove?",
+ "answer": 26
+ },
+ {
+ "id": "validation-lookup-006",
+ "task": "lookup",
+ "question": "Records in time order: yew=48, amber=47, kelp=91, olive=88, cedar=68, quartz=34, larch=38, fern=73, slate=96, maple=35, grove=50, reed=78.\nWhat is the recorded number for larch?",
+ "answer": 38
+ },
+ {
+ "id": "validation-lookup-007",
+ "task": "lookup",
+ "question": "Records in time order: yew=39, reed=64, vine=55, maple=32, iris=53, elm=72, amber=88, fern=35, kelp=59, birch=65, nettle=40, larch=24.\nWhat is the recorded number for maple?",
+ "answer": 32
+ },
+ {
+ "id": "validation-latest-000",
+ "task": "latest",
+ "question": "Records in time order: iris=55, maple=94, reed=35, elm=69, slate=34, larch=89, umber=51, quartz=91, umber=25, jade=71, fern=79, dune=97.\nWhat is the last recorded number for umber?",
+ "answer": 25
+ },
+ {
+ "id": "validation-latest-001",
+ "task": "latest",
+ "question": "Records in time order: larch=30, dune=35, vine=81, thyme=91, maple=63, iris=99, cedar=64, birch=84, pine=82, vine=72, fern=60, umber=88.\nWhat is the last recorded number for vine?",
+ "answer": 72
+ },
+ {
+ "id": "validation-latest-002",
+ "task": "latest",
+ "question": "Records in time order: iris=78, pine=84, cedar=94, iris=72, willow=66, heath=29, elm=96, thyme=92, umber=26, kelp=97, vine=51, jade=83.\nWhat is the last recorded number for iris?",
+ "answer": 72
+ },
+ {
+ "id": "validation-latest-003",
+ "task": "latest",
+ "question": "Records in time order: cedar=90, jade=99, reed=84, thyme=67, heath=80, reed=97, yew=87, umber=52, amber=94, quartz=36, pine=65, birch=25.\nWhat is the last recorded number for reed?",
+ "answer": 97
+ },
+ {
+ "id": "validation-latest-004",
+ "task": "latest",
+ "question": "Records in time order: slate=58, maple=71, slate=28, larch=82, cedar=35, quartz=67, kelp=20, olive=98, amber=36, birch=80, reed=88, grove=46.\nWhat is the last recorded number for slate?",
+ "answer": 28
+ },
+ {
+ "id": "validation-latest-005",
+ "task": "latest",
+ "question": "Records in time order: thyme=89, iris=76, heath=27, nettle=69, amber=90, pine=39, vine=85, yew=54, birch=32, larch=29, nettle=59, jade=64.\nWhat is the last recorded number for nettle?",
+ "answer": 59
+ },
+ {
+ "id": "validation-latest-006",
+ "task": "latest",
+ "question": "Records in time order: fern=76, fern=82, maple=86, thyme=68, birch=37, iris=75, cedar=29, willow=38, elm=60, quartz=34, pine=52, olive=32.\nWhat is the last recorded number for fern?",
+ "answer": 82
+ },
+ {
+ "id": "validation-latest-007",
+ "task": "latest",
+ "question": "Records in time order: amber=62, iris=60, thyme=47, thyme=51, grove=45, willow=98, fern=61, jade=83, olive=55, umber=64, slate=24, quartz=93.\nWhat is the last recorded number for thyme?",
+ "answer": 51
+ },
+ {
+ "id": "validation-addition-000",
+ "task": "addition",
+ "question": "What is 30 plus 77?",
+ "answer": 107
+ },
+ {
+ "id": "validation-addition-001",
+ "task": "addition",
+ "question": "What is 36 plus 77?",
+ "answer": 113
+ },
+ {
+ "id": "validation-addition-002",
+ "task": "addition",
+ "question": "What is 44 plus 67?",
+ "answer": 111
+ },
+ {
+ "id": "validation-addition-003",
+ "task": "addition",
+ "question": "What is 31 plus 67?",
+ "answer": 98
+ },
+ {
+ "id": "validation-addition-004",
+ "task": "addition",
+ "question": "What is 23 plus 76?",
+ "answer": 99
+ },
+ {
+ "id": "validation-addition-005",
+ "task": "addition",
+ "question": "What is 24 plus 44?",
+ "answer": 68
+ },
+ {
+ "id": "validation-addition-006",
+ "task": "addition",
+ "question": "What is 60 plus 63?",
+ "answer": 123
+ },
+ {
+ "id": "validation-addition-007",
+ "task": "addition",
+ "question": "What is 53 plus 82?",
+ "answer": 135
+ },
+ {
+ "id": "validation-count-000",
+ "task": "count",
+ "question": "Items: reed, olive, olive, reed, reed, reed, reed, olive, reed, olive, reed, olive, reed, reed, reed, reed, olive, reed, olive, olive, reed.\nHow many items are exactly 'reed'?",
+ "answer": 13
+ },
+ {
+ "id": "validation-count-001",
+ "task": "count",
+ "question": "Items: olive, kelp, olive, olive, olive, olive, kelp, olive, olive, olive, kelp, olive, olive, olive, olive, olive.\nHow many items are exactly 'olive'?",
+ "answer": 13
+ },
+ {
+ "id": "validation-count-002",
+ "task": "count",
+ "question": "Items: fern, kelp, fern, kelp, fern, kelp, kelp, fern, kelp, fern, kelp, fern, fern, kelp, fern, fern, fern.\nHow many items are exactly 'fern'?",
+ "answer": 10
+ },
+ {
+ "id": "validation-count-003",
+ "task": "count",
+ "question": "Items: olive, olive, cedar, olive, cedar, olive, cedar, cedar, olive, olive, olive, olive, olive, olive, cedar, cedar, olive, olive, olive.\nHow many items are exactly 'olive'?",
+ "answer": 13
+ },
+ {
+ "id": "validation-count-004",
+ "task": "count",
+ "question": "Items: dune, dune, dune, elm, dune, dune, elm, dune, dune, dune, dune, dune, elm, elm, elm, dune, dune, elm, dune, elm, elm, dune, elm.\nHow many items are exactly 'dune'?",
+ "answer": 14
+ },
+ {
+ "id": "validation-count-005",
+ "task": "count",
+ "question": "Items: maple, maple, cedar, cedar, cedar, maple, maple, cedar, maple, maple, maple, cedar, cedar, cedar, cedar, maple, cedar, maple, maple, maple.\nHow many items are exactly 'maple'?",
+ "answer": 11
+ },
+ {
+ "id": "validation-count-006",
+ "task": "count",
+ "question": "Items: iris, iris, iris, iris, grove, iris, iris, grove, iris, iris, iris, iris, grove, iris, iris, grove, grove, iris, grove, grove, grove, iris, grove.\nHow many items are exactly 'iris'?",
+ "answer": 14
+ },
+ {
+ "id": "validation-count-007",
+ "task": "count",
+ "question": "Items: fern, jade, jade, jade, fern, fern, fern, fern, fern, fern, fern, fern, jade, fern, fern, fern, fern, fern, jade, jade.\nHow many items are exactly 'fern'?",
+ "answer": 14
+ }
+ ],
+ "test": [
+ {
+ "id": "test-lookup-000",
+ "task": "lookup",
+ "question": "Records in time order: pine=72, yew=79, maple=61, jade=50, cedar=88, larch=25, elm=96, dune=22, fern=26, heath=92, olive=37, willow=91.\nWhat is the recorded number for yew?",
+ "answer": 79
+ },
+ {
+ "id": "test-lookup-001",
+ "task": "lookup",
+ "question": "Records in time order: jade=69, quartz=42, dune=70, heath=68, elm=87, cedar=50, iris=97, amber=94, larch=65, yew=63, kelp=27, reed=99.\nWhat is the recorded number for dune?",
+ "answer": 70
+ },
+ {
+ "id": "test-lookup-002",
+ "task": "lookup",
+ "question": "Records in time order: larch=34, heath=75, thyme=23, kelp=26, fern=88, elm=69, quartz=92, dune=48, willow=55, iris=85, yew=84, cedar=71.\nWhat is the recorded number for quartz?",
+ "answer": 92
+ },
+ {
+ "id": "test-lookup-003",
+ "task": "lookup",
+ "question": "Records in time order: iris=77, reed=29, kelp=70, slate=68, pine=76, fern=20, grove=49, nettle=94, amber=73, cedar=62, yew=59, maple=21.\nWhat is the recorded number for slate?",
+ "answer": 68
+ },
+ {
+ "id": "test-lookup-004",
+ "task": "lookup",
+ "question": "Records in time order: cedar=80, amber=90, grove=29, slate=46, birch=85, dune=43, yew=75, fern=21, iris=69, vine=58, maple=65, willow=67.\nWhat is the recorded number for vine?",
+ "answer": 58
+ },
+ {
+ "id": "test-lookup-005",
+ "task": "lookup",
+ "question": "Records in time order: dune=64, birch=75, cedar=74, vine=48, larch=41, fern=85, quartz=38, slate=83, iris=31, jade=96, maple=65, yew=84.\nWhat is the recorded number for dune?",
+ "answer": 64
+ },
+ {
+ "id": "test-lookup-006",
+ "task": "lookup",
+ "question": "Records in time order: amber=69, yew=24, reed=35, thyme=26, willow=67, umber=36, vine=97, dune=50, birch=85, nettle=28, iris=73, maple=64.\nWhat is the recorded number for dune?",
+ "answer": 50
+ },
+ {
+ "id": "test-lookup-007",
+ "task": "lookup",
+ "question": "Records in time order: iris=38, fern=25, heath=60, vine=90, grove=79, cedar=21, slate=66, nettle=24, thyme=86, pine=91, quartz=65, dune=70.\nWhat is the recorded number for iris?",
+ "answer": 38
+ },
+ {
+ "id": "test-lookup-008",
+ "task": "lookup",
+ "question": "Records in time order: olive=65, yew=70, vine=32, grove=83, amber=76, larch=84, thyme=97, quartz=29, jade=89, maple=27, dune=31, cedar=45.\nWhat is the recorded number for dune?",
+ "answer": 31
+ },
+ {
+ "id": "test-lookup-009",
+ "task": "lookup",
+ "question": "Records in time order: birch=68, olive=60, heath=73, amber=95, grove=64, jade=90, dune=66, iris=33, umber=26, nettle=41, thyme=24, quartz=91.\nWhat is the recorded number for thyme?",
+ "answer": 24
+ },
+ {
+ "id": "test-lookup-010",
+ "task": "lookup",
+ "question": "Records in time order: elm=37, maple=46, cedar=40, pine=92, fern=53, willow=26, yew=97, amber=94, olive=84, heath=85, larch=56, thyme=69.\nWhat is the recorded number for thyme?",
+ "answer": 69
+ },
+ {
+ "id": "test-lookup-011",
+ "task": "lookup",
+ "question": "Records in time order: fern=34, nettle=92, amber=45, iris=52, olive=73, dune=37, willow=54, thyme=39, slate=20, larch=76, umber=70, elm=36.\nWhat is the recorded number for nettle?",
+ "answer": 92
+ },
+ {
+ "id": "test-lookup-012",
+ "task": "lookup",
+ "question": "Records in time order: dune=64, yew=92, fern=98, willow=42, elm=30, kelp=90, maple=21, pine=65, vine=40, grove=67, reed=25, jade=69.\nWhat is the recorded number for fern?",
+ "answer": 98
+ },
+ {
+ "id": "test-lookup-013",
+ "task": "lookup",
+ "question": "Records in time order: elm=44, pine=92, vine=62, larch=68, slate=45, quartz=93, yew=99, kelp=88, olive=58, jade=38, amber=40, thyme=27.\nWhat is the recorded number for thyme?",
+ "answer": 27
+ },
+ {
+ "id": "test-lookup-014",
+ "task": "lookup",
+ "question": "Records in time order: grove=68, dune=96, willow=28, thyme=72, jade=75, elm=82, umber=87, reed=76, fern=92, quartz=71, pine=55, birch=43.\nWhat is the recorded number for quartz?",
+ "answer": 71
+ },
+ {
+ "id": "test-lookup-015",
+ "task": "lookup",
+ "question": "Records in time order: amber=35, dune=30, iris=33, willow=67, vine=88, olive=60, birch=32, slate=77, cedar=49, maple=59, heath=21, yew=24.\nWhat is the recorded number for vine?",
+ "answer": 88
+ },
+ {
+ "id": "test-lookup-016",
+ "task": "lookup",
+ "question": "Records in time order: maple=81, dune=41, amber=88, fern=77, umber=84, olive=22, pine=89, vine=42, birch=66, willow=98, grove=40, jade=72.\nWhat is the recorded number for maple?",
+ "answer": 81
+ },
+ {
+ "id": "test-lookup-017",
+ "task": "lookup",
+ "question": "Records in time order: quartz=72, larch=50, olive=20, umber=22, amber=71, slate=55, thyme=65, vine=95, elm=93, fern=99, kelp=67, maple=84.\nWhat is the recorded number for elm?",
+ "answer": 93
+ },
+ {
+ "id": "test-lookup-018",
+ "task": "lookup",
+ "question": "Records in time order: elm=55, reed=73, birch=65, amber=62, dune=90, jade=22, pine=52, umber=40, larch=30, thyme=71, nettle=85, heath=27.\nWhat is the recorded number for larch?",
+ "answer": 30
+ },
+ {
+ "id": "test-lookup-019",
+ "task": "lookup",
+ "question": "Records in time order: yew=46, elm=58, nettle=30, iris=44, grove=59, umber=72, jade=51, larch=27, pine=94, thyme=89, heath=78, vine=49.\nWhat is the recorded number for iris?",
+ "answer": 44
+ },
+ {
+ "id": "test-lookup-020",
+ "task": "lookup",
+ "question": "Records in time order: amber=50, dune=39, kelp=44, vine=83, grove=65, slate=97, umber=24, elm=78, willow=81, yew=94, reed=41, fern=70.\nWhat is the recorded number for yew?",
+ "answer": 94
+ },
+ {
+ "id": "test-lookup-021",
+ "task": "lookup",
+ "question": "Records in time order: birch=72, nettle=80, umber=43, grove=32, willow=85, jade=49, yew=83, dune=44, kelp=23, slate=20, fern=87, quartz=75.\nWhat is the recorded number for dune?",
+ "answer": 44
+ },
+ {
+ "id": "test-lookup-022",
+ "task": "lookup",
+ "question": "Records in time order: maple=30, larch=54, fern=94, thyme=85, olive=65, dune=26, willow=20, reed=46, yew=99, cedar=23, vine=87, birch=62.\nWhat is the recorded number for maple?",
+ "answer": 30
+ },
+ {
+ "id": "test-lookup-023",
+ "task": "lookup",
+ "question": "Records in time order: cedar=34, dune=28, heath=44, jade=62, thyme=27, larch=37, iris=31, vine=40, slate=66, yew=48, elm=70, maple=39.\nWhat is the recorded number for iris?",
+ "answer": 31
+ },
+ {
+ "id": "test-lookup-024",
+ "task": "lookup",
+ "question": "Records in time order: maple=43, vine=69, yew=65, fern=29, kelp=75, elm=96, iris=84, willow=97, thyme=88, larch=31, heath=98, birch=95.\nWhat is the recorded number for fern?",
+ "answer": 29
+ },
+ {
+ "id": "test-lookup-025",
+ "task": "lookup",
+ "question": "Records in time order: heath=44, vine=84, umber=48, iris=26, pine=97, amber=58, slate=67, cedar=25, elm=35, dune=90, olive=28, reed=57.\nWhat is the recorded number for vine?",
+ "answer": 84
+ },
+ {
+ "id": "test-lookup-026",
+ "task": "lookup",
+ "question": "Records in time order: kelp=99, reed=94, nettle=29, birch=98, olive=38, elm=72, thyme=54, pine=45, jade=53, umber=73, cedar=79, vine=42.\nWhat is the recorded number for nettle?",
+ "answer": 29
+ },
+ {
+ "id": "test-lookup-027",
+ "task": "lookup",
+ "question": "Records in time order: slate=60, kelp=22, pine=77, thyme=40, reed=91, dune=41, quartz=31, nettle=21, cedar=43, vine=48, fern=89, olive=24.\nWhat is the recorded number for fern?",
+ "answer": 89
+ },
+ {
+ "id": "test-lookup-028",
+ "task": "lookup",
+ "question": "Records in time order: maple=92, slate=54, larch=94, willow=60, elm=57, amber=26, birch=76, thyme=96, cedar=79, reed=85, jade=63, dune=47.\nWhat is the recorded number for jade?",
+ "answer": 63
+ },
+ {
+ "id": "test-lookup-029",
+ "task": "lookup",
+ "question": "Records in time order: amber=62, willow=24, maple=86, grove=40, birch=36, quartz=96, reed=88, kelp=63, elm=22, thyme=65, larch=73, olive=44.\nWhat is the recorded number for grove?",
+ "answer": 40
+ },
+ {
+ "id": "test-lookup-030",
+ "task": "lookup",
+ "question": "Records in time order: willow=22, fern=66, quartz=69, slate=92, iris=79, maple=67, olive=88, cedar=23, jade=68, elm=64, reed=39, amber=89.\nWhat is the recorded number for reed?",
+ "answer": 39
+ },
+ {
+ "id": "test-lookup-031",
+ "task": "lookup",
+ "question": "Records in time order: jade=97, slate=98, elm=55, pine=61, cedar=72, iris=50, heath=45, thyme=80, quartz=58, umber=49, amber=79, birch=94.\nWhat is the recorded number for pine?",
+ "answer": 61
+ },
+ {
+ "id": "test-latest-000",
+ "task": "latest",
+ "question": "Records in time order: vine=94, grove=95, heath=24, grove=67, thyme=59, reed=55, cedar=35, pine=53, olive=64, nettle=40, kelp=38, slate=42.\nWhat is the last recorded number for grove?",
+ "answer": 67
+ },
+ {
+ "id": "test-latest-001",
+ "task": "latest",
+ "question": "Records in time order: kelp=42, larch=86, slate=20, dune=32, olive=30, elm=52, grove=34, reed=27, quartz=79, heath=85, reed=82, nettle=60.\nWhat is the last recorded number for reed?",
+ "answer": 82
+ },
+ {
+ "id": "test-latest-002",
+ "task": "latest",
+ "question": "Records in time order: iris=68, maple=47, umber=93, kelp=56, olive=37, thyme=26, nettle=86, willow=98, larch=57, willow=42, birch=63, cedar=82.\nWhat is the last recorded number for willow?",
+ "answer": 42
+ },
+ {
+ "id": "test-latest-003",
+ "task": "latest",
+ "question": "Records in time order: dune=80, kelp=61, birch=85, quartz=82, quartz=35, slate=38, vine=45, olive=51, cedar=92, fern=67, grove=49, thyme=22.\nWhat is the last recorded number for quartz?",
+ "answer": 35
+ },
+ {
+ "id": "test-latest-004",
+ "task": "latest",
+ "question": "Records in time order: jade=92, jade=56, iris=69, olive=88, grove=91, willow=34, kelp=68, pine=89, nettle=86, quartz=99, yew=23, slate=80.\nWhat is the last recorded number for jade?",
+ "answer": 56
+ },
+ {
+ "id": "test-latest-005",
+ "task": "latest",
+ "question": "Records in time order: nettle=49, fern=32, vine=71, olive=40, vine=92, birch=96, willow=31, reed=42, umber=83, larch=44, yew=98, maple=56.\nWhat is the last recorded number for vine?",
+ "answer": 92
+ },
+ {
+ "id": "test-latest-006",
+ "task": "latest",
+ "question": "Records in time order: elm=72, cedar=59, pine=64, yew=70, nettle=38, iris=71, birch=49, willow=58, slate=78, grove=99, reed=94, cedar=42.\nWhat is the last recorded number for cedar?",
+ "answer": 42
+ },
+ {
+ "id": "test-latest-007",
+ "task": "latest",
+ "question": "Records in time order: amber=55, yew=56, vine=81, pine=33, slate=47, grove=70, thyme=57, umber=74, pine=23, fern=50, nettle=42, birch=62.\nWhat is the last recorded number for pine?",
+ "answer": 23
+ },
+ {
+ "id": "test-latest-008",
+ "task": "latest",
+ "question": "Records in time order: iris=34, elm=22, vine=29, maple=31, willow=74, dune=48, iris=99, umber=97, thyme=80, slate=51, amber=98, quartz=40.\nWhat is the last recorded number for iris?",
+ "answer": 99
+ },
+ {
+ "id": "test-latest-009",
+ "task": "latest",
+ "question": "Records in time order: elm=60, vine=67, amber=59, thyme=75, larch=86, elm=91, quartz=69, umber=80, grove=76, cedar=27, birch=30, pine=74.\nWhat is the last recorded number for elm?",
+ "answer": 91
+ },
+ {
+ "id": "test-latest-010",
+ "task": "latest",
+ "question": "Records in time order: heath=44, vine=23, nettle=42, amber=88, cedar=31, fern=72, vine=73, maple=58, kelp=41, birch=84, quartz=52, jade=63.\nWhat is the last recorded number for vine?",
+ "answer": 73
+ },
+ {
+ "id": "test-latest-011",
+ "task": "latest",
+ "question": "Records in time order: birch=59, grove=51, larch=49, yew=67, slate=31, amber=81, yew=96, vine=86, willow=60, dune=82, thyme=64, umber=33.\nWhat is the last recorded number for yew?",
+ "answer": 96
+ },
+ {
+ "id": "test-latest-012",
+ "task": "latest",
+ "question": "Records in time order: thyme=38, thyme=40, olive=80, amber=54, quartz=63, willow=60, yew=50, heath=36, nettle=81, iris=76, grove=88, vine=61.\nWhat is the last recorded number for thyme?",
+ "answer": 40
+ },
+ {
+ "id": "test-latest-013",
+ "task": "latest",
+ "question": "Records in time order: jade=31, birch=66, grove=46, slate=68, cedar=85, slate=76, kelp=22, yew=23, pine=63, olive=95, larch=55, vine=54.\nWhat is the last recorded number for slate?",
+ "answer": 76
+ },
+ {
+ "id": "test-latest-014",
+ "task": "latest",
+ "question": "Records in time order: heath=27, nettle=23, maple=73, vine=42, birch=62, elm=87, grove=24, birch=49, fern=86, umber=95, pine=81, slate=33.\nWhat is the last recorded number for birch?",
+ "answer": 49
+ },
+ {
+ "id": "test-latest-015",
+ "task": "latest",
+ "question": "Records in time order: larch=61, dune=83, elm=26, grove=42, larch=28, vine=25, umber=50, slate=77, yew=32, willow=35, kelp=41, cedar=48.\nWhat is the last recorded number for larch?",
+ "answer": 28
+ },
+ {
+ "id": "test-latest-016",
+ "task": "latest",
+ "question": "Records in time order: iris=62, elm=81, fern=63, amber=20, thyme=26, willow=48, dune=46, maple=83, maple=21, cedar=54, pine=91, jade=45.\nWhat is the last recorded number for maple?",
+ "answer": 21
+ },
+ {
+ "id": "test-latest-017",
+ "task": "latest",
+ "question": "Records in time order: amber=58, grove=42, kelp=99, kelp=73, umber=75, iris=82, olive=77, birch=21, cedar=64, fern=55, slate=54, pine=69.\nWhat is the last recorded number for kelp?",
+ "answer": 73
+ },
+ {
+ "id": "test-latest-018",
+ "task": "latest",
+ "question": "Records in time order: nettle=95, pine=30, elm=94, quartz=59, yew=87, larch=45, birch=91, cedar=58, vine=82, reed=25, yew=80, amber=75.\nWhat is the last recorded number for yew?",
+ "answer": 80
+ },
+ {
+ "id": "test-latest-019",
+ "task": "latest",
+ "question": "Records in time order: larch=58, quartz=94, nettle=59, larch=83, kelp=28, grove=66, thyme=20, vine=45, amber=62, willow=22, iris=81, heath=90.\nWhat is the last recorded number for larch?",
+ "answer": 83
+ },
+ {
+ "id": "test-latest-020",
+ "task": "latest",
+ "question": "Records in time order: slate=93, fern=24, nettle=70, maple=43, cedar=45, thyme=59, jade=25, heath=42, birch=38, iris=90, heath=77, grove=73.\nWhat is the last recorded number for heath?",
+ "answer": 77
+ },
+ {
+ "id": "test-latest-021",
+ "task": "latest",
+ "question": "Records in time order: fern=96, grove=34, iris=46, umber=43, reed=56, cedar=76, larch=49, maple=27, grove=37, willow=92, heath=45, kelp=28.\nWhat is the last recorded number for grove?",
+ "answer": 37
+ },
+ {
+ "id": "test-latest-022",
+ "task": "latest",
+ "question": "Records in time order: quartz=33, olive=22, kelp=84, reed=28, larch=93, yew=54, fern=69, grove=58, amber=38, jade=60, reed=56, heath=68.\nWhat is the last recorded number for reed?",
+ "answer": 56
+ },
+ {
+ "id": "test-latest-023",
+ "task": "latest",
+ "question": "Records in time order: kelp=33, kelp=92, fern=28, maple=88, vine=75, willow=89, pine=64, cedar=85, elm=72, dune=82, jade=62, quartz=74.\nWhat is the last recorded number for kelp?",
+ "answer": 92
+ },
+ {
+ "id": "test-latest-024",
+ "task": "latest",
+ "question": "Records in time order: reed=87, thyme=52, reed=76, kelp=82, nettle=39, grove=54, willow=67, quartz=45, amber=37, heath=73, slate=80, elm=48.\nWhat is the last recorded number for reed?",
+ "answer": 76
+ },
+ {
+ "id": "test-latest-025",
+ "task": "latest",
+ "question": "Records in time order: quartz=83, umber=43, nettle=27, slate=24, cedar=84, grove=99, pine=26, thyme=61, grove=97, fern=79, elm=40, iris=78.\nWhat is the last recorded number for grove?",
+ "answer": 97
+ },
+ {
+ "id": "test-latest-026",
+ "task": "latest",
+ "question": "Records in time order: vine=28, pine=42, heath=83, jade=63, iris=65, cedar=90, olive=69, birch=60, elm=54, cedar=21, amber=96, nettle=49.\nWhat is the last recorded number for cedar?",
+ "answer": 21
+ },
+ {
+ "id": "test-latest-027",
+ "task": "latest",
+ "question": "Records in time order: willow=85, willow=55, kelp=97, olive=70, dune=20, maple=83, birch=93, nettle=30, cedar=80, amber=51, slate=71, umber=64.\nWhat is the last recorded number for willow?",
+ "answer": 55
+ },
+ {
+ "id": "test-latest-028",
+ "task": "latest",
+ "question": "Records in time order: pine=40, nettle=25, maple=92, slate=28, larch=85, heath=57, amber=74, heath=21, fern=58, reed=46, vine=87, kelp=73.\nWhat is the last recorded number for heath?",
+ "answer": 21
+ },
+ {
+ "id": "test-latest-029",
+ "task": "latest",
+ "question": "Records in time order: larch=79, larch=82, amber=85, birch=52, maple=37, grove=83, yew=77, nettle=87, cedar=21, jade=62, vine=29, pine=38.\nWhat is the last recorded number for larch?",
+ "answer": 82
+ },
+ {
+ "id": "test-latest-030",
+ "task": "latest",
+ "question": "Records in time order: maple=71, birch=99, birch=97, heath=60, willow=45, cedar=96, amber=65, pine=31, kelp=75, nettle=36, fern=46, yew=88.\nWhat is the last recorded number for birch?",
+ "answer": 97
+ },
+ {
+ "id": "test-latest-031",
+ "task": "latest",
+ "question": "Records in time order: dune=55, kelp=26, yew=91, thyme=44, elm=63, reed=68, heath=81, olive=32, quartz=75, reed=71, cedar=90, larch=54.\nWhat is the last recorded number for reed?",
+ "answer": 71
+ },
+ {
+ "id": "test-addition-000",
+ "task": "addition",
+ "question": "What is 29 plus 76?",
+ "answer": 105
+ },
+ {
+ "id": "test-addition-001",
+ "task": "addition",
+ "question": "What is 62 plus 70?",
+ "answer": 132
+ },
+ {
+ "id": "test-addition-002",
+ "task": "addition",
+ "question": "What is 54 plus 68?",
+ "answer": 122
+ },
+ {
+ "id": "test-addition-003",
+ "task": "addition",
+ "question": "What is 23 plus 31?",
+ "answer": 54
+ },
+ {
+ "id": "test-addition-004",
+ "task": "addition",
+ "question": "What is 36 plus 57?",
+ "answer": 93
+ },
+ {
+ "id": "test-addition-005",
+ "task": "addition",
+ "question": "What is 25 plus 32?",
+ "answer": 57
+ },
+ {
+ "id": "test-addition-006",
+ "task": "addition",
+ "question": "What is 74 plus 76?",
+ "answer": 150
+ },
+ {
+ "id": "test-addition-007",
+ "task": "addition",
+ "question": "What is 41 plus 69?",
+ "answer": 110
+ },
+ {
+ "id": "test-addition-008",
+ "task": "addition",
+ "question": "What is 70 plus 86?",
+ "answer": 156
+ },
+ {
+ "id": "test-addition-009",
+ "task": "addition",
+ "question": "What is 30 plus 78?",
+ "answer": 108
+ },
+ {
+ "id": "test-addition-010",
+ "task": "addition",
+ "question": "What is 47 plus 69?",
+ "answer": 116
+ },
+ {
+ "id": "test-addition-011",
+ "task": "addition",
+ "question": "What is 74 plus 89?",
+ "answer": 163
+ },
+ {
+ "id": "test-addition-012",
+ "task": "addition",
+ "question": "What is 23 plus 41?",
+ "answer": 64
+ },
+ {
+ "id": "test-addition-013",
+ "task": "addition",
+ "question": "What is 59 plus 80?",
+ "answer": 139
+ },
+ {
+ "id": "test-addition-014",
+ "task": "addition",
+ "question": "What is 30 plus 67?",
+ "answer": 97
+ },
+ {
+ "id": "test-addition-015",
+ "task": "addition",
+ "question": "What is 45 plus 73?",
+ "answer": 118
+ },
+ {
+ "id": "test-addition-016",
+ "task": "addition",
+ "question": "What is 38 plus 39?",
+ "answer": 77
+ },
+ {
+ "id": "test-addition-017",
+ "task": "addition",
+ "question": "What is 37 plus 61?",
+ "answer": 98
+ },
+ {
+ "id": "test-addition-018",
+ "task": "addition",
+ "question": "What is 33 plus 39?",
+ "answer": 72
+ },
+ {
+ "id": "test-addition-019",
+ "task": "addition",
+ "question": "What is 31 plus 56?",
+ "answer": 87
+ },
+ {
+ "id": "test-addition-020",
+ "task": "addition",
+ "question": "What is 60 plus 81?",
+ "answer": 141
+ },
+ {
+ "id": "test-addition-021",
+ "task": "addition",
+ "question": "What is 44 plus 81?",
+ "answer": 125
+ },
+ {
+ "id": "test-addition-022",
+ "task": "addition",
+ "question": "What is 39 plus 44?",
+ "answer": 83
+ },
+ {
+ "id": "test-addition-023",
+ "task": "addition",
+ "question": "What is 48 plus 59?",
+ "answer": 107
+ },
+ {
+ "id": "test-addition-024",
+ "task": "addition",
+ "question": "What is 23 plus 64?",
+ "answer": 87
+ },
+ {
+ "id": "test-addition-025",
+ "task": "addition",
+ "question": "What is 52 plus 82?",
+ "answer": 134
+ },
+ {
+ "id": "test-addition-026",
+ "task": "addition",
+ "question": "What is 33 plus 84?",
+ "answer": 117
+ },
+ {
+ "id": "test-addition-027",
+ "task": "addition",
+ "question": "What is 21 plus 65?",
+ "answer": 86
+ },
+ {
+ "id": "test-addition-028",
+ "task": "addition",
+ "question": "What is 26 plus 52?",
+ "answer": 78
+ },
+ {
+ "id": "test-addition-029",
+ "task": "addition",
+ "question": "What is 33 plus 41?",
+ "answer": 74
+ },
+ {
+ "id": "test-addition-030",
+ "task": "addition",
+ "question": "What is 24 plus 70?",
+ "answer": 94
+ },
+ {
+ "id": "test-addition-031",
+ "task": "addition",
+ "question": "What is 59 plus 69?",
+ "answer": 128
+ },
+ {
+ "id": "test-count-000",
+ "task": "count",
+ "question": "Items: cedar, cedar, cedar, cedar, cedar, vine, vine, cedar, cedar, vine, cedar, cedar, cedar, vine, cedar, vine, cedar.\nHow many items are exactly 'cedar'?",
+ "answer": 12
+ },
+ {
+ "id": "test-count-001",
+ "task": "count",
+ "question": "Items: grove, cedar, grove, grove, cedar, cedar, grove, grove, grove, grove, grove, grove, grove, grove, grove, grove, grove, grove.\nHow many items are exactly 'grove'?",
+ "answer": 15
+ },
+ {
+ "id": "test-count-002",
+ "task": "count",
+ "question": "Items: dune, dune, thyme, dune, thyme, dune, dune, dune, dune, thyme, dune, dune, dune, dune.\nHow many items are exactly 'dune'?",
+ "answer": 11
+ },
+ {
+ "id": "test-count-003",
+ "task": "count",
+ "question": "Items: willow, fern, fern, willow, fern, willow, willow, willow, willow, fern, willow, fern, fern, willow, willow, willow, fern, willow, willow, fern, willow.\nHow many items are exactly 'willow'?",
+ "answer": 13
+ },
+ {
+ "id": "test-count-004",
+ "task": "count",
+ "question": "Items: dune, dune, dune, dune, vine, dune, dune, dune, vine, vine, dune, dune, vine, dune, vine, vine, dune, dune, dune, vine, vine, dune.\nHow many items are exactly 'dune'?",
+ "answer": 14
+ },
+ {
+ "id": "test-count-005",
+ "task": "count",
+ "question": "Items: vine, quartz, quartz, vine, quartz, vine, quartz, quartz, quartz, quartz, quartz, vine, quartz, quartz, vine, quartz, vine, quartz, quartz, vine, quartz.\nHow many items are exactly 'quartz'?",
+ "answer": 14
+ },
+ {
+ "id": "test-count-006",
+ "task": "count",
+ "question": "Items: fern, fern, quartz, quartz, quartz, quartz, fern, quartz, quartz, fern, fern, quartz, quartz, fern, quartz, fern, quartz, fern, quartz, quartz, quartz.\nHow many items are exactly 'quartz'?",
+ "answer": 13
+ },
+ {
+ "id": "test-count-007",
+ "task": "count",
+ "question": "Items: reed, reed, reed, thyme, thyme, reed, reed, reed, thyme, reed, reed, reed, thyme, reed, reed, reed, thyme, reed, thyme.\nHow many items are exactly 'reed'?",
+ "answer": 13
+ },
+ {
+ "id": "test-count-008",
+ "task": "count",
+ "question": "Items: heath, olive, olive, heath, heath, heath, olive, heath, olive, heath, heath, heath, olive, heath, heath, heath, heath, olive, heath, heath, heath.\nHow many items are exactly 'heath'?",
+ "answer": 15
+ },
+ {
+ "id": "test-count-009",
+ "task": "count",
+ "question": "Items: birch, birch, vine, birch, birch, birch, birch, birch, birch, vine, vine, birch, vine, vine, vine, birch, birch, vine, birch, birch.\nHow many items are exactly 'birch'?",
+ "answer": 13
+ },
+ {
+ "id": "test-count-010",
+ "task": "count",
+ "question": "Items: willow, slate, slate, willow, slate, slate, slate, willow, slate, slate, willow, willow, willow, slate, willow, willow, willow, slate, willow, willow, willow.\nHow many items are exactly 'willow'?",
+ "answer": 12
+ },
+ {
+ "id": "test-count-011",
+ "task": "count",
+ "question": "Items: heath, heath, heath, heath, umber, umber, umber, umber, umber, heath, heath, heath, umber, heath, heath, heath, umber, heath, heath.\nHow many items are exactly 'heath'?",
+ "answer": 12
+ },
+ {
+ "id": "test-count-012",
+ "task": "count",
+ "question": "Items: birch, grove, grove, grove, grove, grove, grove, grove, birch, grove, birch, grove, grove, birch, birch, birch, birch, grove, grove, grove.\nHow many items are exactly 'grove'?",
+ "answer": 13
+ },
+ {
+ "id": "test-count-013",
+ "task": "count",
+ "question": "Items: pine, pine, pine, pine, pine, pine, thyme, thyme, thyme, thyme, thyme, thyme, pine, pine, pine, pine, thyme, thyme, thyme.\nHow many items are exactly 'pine'?",
+ "answer": 10
+ },
+ {
+ "id": "test-count-014",
+ "task": "count",
+ "question": "Items: amber, slate, amber, slate, slate, amber, amber, amber, amber, amber, amber, slate, amber, slate, slate, slate, amber, slate.\nHow many items are exactly 'amber'?",
+ "answer": 10
+ },
+ {
+ "id": "test-count-015",
+ "task": "count",
+ "question": "Items: jade, jade, jade, jade, slate, slate, jade, jade, jade, jade, jade, jade, jade, slate.\nHow many items are exactly 'jade'?",
+ "answer": 11
+ },
+ {
+ "id": "test-count-016",
+ "task": "count",
+ "question": "Items: dune, dune, dune, dune, dune, dune, dune, dune, dune, dune, dune, dune, amber, dune, amber, amber, dune.\nHow many items are exactly 'dune'?",
+ "answer": 14
+ },
+ {
+ "id": "test-count-017",
+ "task": "count",
+ "question": "Items: willow, dune, willow, willow, willow, dune, dune, dune, dune, dune, willow, dune, dune, dune, dune.\nHow many items are exactly 'dune'?",
+ "answer": 10
+ },
+ {
+ "id": "test-count-018",
+ "task": "count",
+ "question": "Items: birch, willow, willow, willow, willow, willow, birch, birch, willow, birch, willow, willow, birch, birch, willow, willow, birch, willow, willow, birch, willow.\nHow many items are exactly 'willow'?",
+ "answer": 13
+ },
+ {
+ "id": "test-count-019",
+ "task": "count",
+ "question": "Items: iris, quartz, quartz, quartz, quartz, quartz, quartz, quartz, quartz, quartz, quartz, iris, iris, quartz, quartz.\nHow many items are exactly 'quartz'?",
+ "answer": 12
+ },
+ {
+ "id": "test-count-020",
+ "task": "count",
+ "question": "Items: yew, quartz, quartz, quartz, quartz, yew, quartz, yew, quartz, quartz, quartz, quartz, yew, quartz, quartz, quartz, quartz, quartz, yew, yew.\nHow many items are exactly 'quartz'?",
+ "answer": 14
+ },
+ {
+ "id": "test-count-021",
+ "task": "count",
+ "question": "Items: kelp, heath, kelp, kelp, heath, heath, heath, kelp, kelp, kelp, heath, kelp, kelp, kelp, kelp, kelp, kelp, heath, kelp, kelp, heath.\nHow many items are exactly 'kelp'?",
+ "answer": 14
+ },
+ {
+ "id": "test-count-022",
+ "task": "count",
+ "question": "Items: maple, elm, maple, elm, maple, maple, maple, elm, maple, elm, elm, maple, elm, elm, elm, elm, elm.\nHow many items are exactly 'elm'?",
+ "answer": 10
+ },
+ {
+ "id": "test-count-023",
+ "task": "count",
+ "question": "Items: cedar, cedar, kelp, kelp, kelp, cedar, kelp, kelp, kelp, kelp, kelp, kelp, cedar, kelp, cedar, kelp, kelp, cedar, cedar, kelp, cedar, kelp.\nHow many items are exactly 'kelp'?",
+ "answer": 14
+ },
+ {
+ "id": "test-count-024",
+ "task": "count",
+ "question": "Items: kelp, fern, fern, kelp, kelp, fern, kelp, fern, fern, kelp, fern, fern, kelp, fern, fern, fern, fern, fern, kelp, kelp.\nHow many items are exactly 'fern'?",
+ "answer": 12
+ },
+ {
+ "id": "test-count-025",
+ "task": "count",
+ "question": "Items: vine, jade, vine, jade, jade, vine, jade, vine, vine, vine, vine, jade, jade, jade, jade, vine, vine, vine, vine, vine, vine.\nHow many items are exactly 'vine'?",
+ "answer": 13
+ },
+ {
+ "id": "test-count-026",
+ "task": "count",
+ "question": "Items: birch, thyme, thyme, thyme, birch, thyme, birch, thyme, thyme, thyme, thyme, thyme, thyme, thyme, birch, birch, birch, birch, thyme, thyme, thyme, birch, thyme.\nHow many items are exactly 'thyme'?",
+ "answer": 15
+ },
+ {
+ "id": "test-count-027",
+ "task": "count",
+ "question": "Items: heath, pine, pine, heath, pine, heath, pine, heath, heath, pine, pine, pine, heath, pine, pine, heath, heath, pine, pine, pine, pine, pine, heath.\nHow many items are exactly 'pine'?",
+ "answer": 14
+ },
+ {
+ "id": "test-count-028",
+ "task": "count",
+ "question": "Items: reed, heath, heath, reed, reed, heath, heath, reed, heath, reed, reed, heath, heath, reed, heath, reed, reed, reed.\nHow many items are exactly 'reed'?",
+ "answer": 10
+ },
+ {
+ "id": "test-count-029",
+ "task": "count",
+ "question": "Items: pine, pine, grove, pine, grove, pine, pine, pine, pine, pine, grove, grove, pine, pine, grove, grove, pine, pine, grove, pine.\nHow many items are exactly 'pine'?",
+ "answer": 13
+ },
+ {
+ "id": "test-count-030",
+ "task": "count",
+ "question": "Items: fern, jade, fern, fern, jade, jade, fern, fern, fern, fern, fern, fern, jade, jade, fern, fern, jade, fern.\nHow many items are exactly 'fern'?",
+ "answer": 12
+ },
+ {
+ "id": "test-count-031",
+ "task": "count",
+ "question": "Items: pine, olive, olive, pine, pine, pine, pine, pine, pine, pine, pine, olive, pine, pine, olive, pine, olive, pine, pine, pine.\nHow many items are exactly 'pine'?",
+ "answer": 15
+ }
+ ]
+ }
+}
diff --git a/results/lisa-full-answer-reproduction/preflight.json b/results/lisa-full-answer-reproduction/preflight.json
new file mode 100644
index 0000000..7746d72
--- /dev/null
+++ b/results/lisa-full-answer-reproduction/preflight.json
@@ -0,0 +1,5 @@
+{
+ "prompt_id": "screen-lookup-000",
+ "prompt_tokens": 103,
+ "tail_hidden_max_abs": 0.0001049041748046875
+}
diff --git a/tests/test_lisa_full_answer.py b/tests/test_lisa_full_answer.py
new file mode 100644
index 0000000..2596832
--- /dev/null
+++ b/tests/test_lisa_full_answer.py
@@ -0,0 +1,43 @@
+"""Protect final-answer scoring, split isolation and the screening threshold."""
+import unittest
+
+from crossqkv.lisa_full_answer import SCHEDULES, choose, final_integer, fixed_problems, grade
+from crossqkv.lisa_full_answer_train import audit
+
+
+class FullAnswerTests(unittest.TestCase):
+ def test_reads_the_terminal_answer_and_requires_eos(self):
+ self.assertEqual(final_integer('First try 17.\n42'), 42)
+ self.assertEqual(final_integer('Working: 17 and 25.\nFinal answer: 42.'), 42)
+ self.assertIsNone(final_integer('17 or 42'))
+ self.assertIsNone(final_integer('17'))
+ self.assertIsNone(final_integer('\nFinal answer: 42'))
+
+ class TextTokenizer:
+ def decode(self, tokens, skip_special_tokens):
+ return ''.join(tokens)
+
+ tok = TextTokenizer()
+ self.assertTrue(grade(tok, ['4', '2', ''], 'eos', 42)['correct'])
+ self.assertFalse(grade(tok, ['4', '2'], 'max_new_tokens', 42)['correct'])
+
+ def test_frozen_splits_are_disjoint_and_schedule_must_lose_answers(self):
+ data = fixed_problems()
+ questions = [row['question'] for rows in data.values() for row in rows]
+ self.assertEqual(len(questions), len(set(questions)))
+ self.assertTrue(all(row['answer'] >= 10 for rows in data.values() for row in rows))
+ a = {name: {'correct': 6, 'native_correct_to_wrong_integer': []} for name in SCHEDULES}
+ self.assertIsNone(choose({'lookup': a}))
+ a['direct_4']['native_correct_to_wrong_integer'] = ['a', 'b']
+ self.assertEqual(choose({'lookup': a})['recipients'], [11, 15, 19, 23])
+
+ def test_audit_distinguishes_wrong_numbers_and_missing_answers(self):
+ def row(name, direct):
+ return {'id': name, 'arms': {'native': {'answer': 12, 'correct': True},
+ 'direct': {'answer': direct, 'correct': False},
+ 'lisa': {'answer': 12, 'correct': True}}}
+
+ report = audit([row('wrong', 13), row('missing', None)])
+ self.assertEqual(report['rescued'], 2)
+ self.assertEqual(report['substantive_loss_ids'], ['wrong'])
+ self.assertEqual(report['substantive_rescued_ids'], ['wrong'])
diff --git a/tests/test_lisa_tail.py b/tests/test_lisa_tail.py
index 8373cbb..c82914c 100644
--- a/tests/test_lisa_tail.py
+++ b/tests/test_lisa_tail.py
@@ -7,6 +7,7 @@ from torch.nn import functional as F
from crossqkv.lisa_decode import AttentionSiteCache
from crossqkv.lisa_decode_bench import ResidentSite, timed_site
+from crossqkv.lisa_generate import GenerationDecoder
from crossqkv.lisa_tail import FrozenLinear, TorchTail, gated_delta, rotate
from crossqkv.lisa_train import LearnableSharingAttention
from functional.model import PREFIX, delta_rule, rope
@@ -85,6 +86,17 @@ class TailTests(unittest.TestCase):
lengths = torch.tensor([5, 5])
native, _ = tail(h, None, lengths, 'native', ())
torch.testing.assert_close(native, torch.tensor(expected), atol=2e-5, rtol=2e-5)
+ padded = np.stack([ids[0], np.concatenate(([0, 0], ids[1, 2:]))])
+ for mode, schedules, modules in (
+ ('direct', [(), (2,)], None), ('lisa', [(2,), (2,)], {2: adapters[2]})
+ ):
+ decoder = GenerationDecoder(original, schedules, [0, 2], modules)
+ actual = torch.cat((decoder.advance(torch.tensor(padded[:, :4])),
+ decoder.advance(torch.tensor(padded[:, 4:]))), dim=1)
+ for bi, pad in enumerate((0, 2)):
+ x = h[bi:bi+1, pad:]
+ ref, _ = tail(x, None, torch.tensor([5-pad]), mode, schedules[bi])
+ torch.testing.assert_close(actual[bi:bi+1, pad:], ref, atol=2e-6, rtol=2e-5)
donor = torch.tensor(rand(2, 2, 5, 5))
run, _ = tail(h, donor, lengths, 'lisa', (0,2), keep_teacher=False)
ref, _ = tail(h, donor, lengths, 'lisa', (0,2), keep_teacher=True)
diff --git a/tests/test_lisa_train.py b/tests/test_lisa_train.py
index ea4f280..1bfce85 100644
--- a/tests/test_lisa_train.py
+++ b/tests/test_lisa_train.py
@@ -43,6 +43,20 @@ class LiSATrainingTests(unittest.TestCase):
torch.testing.assert_close(torch.autograd.grad(streamed, h)[0],
torch.autograd.grad(dense, h)[0])
+ def test_completion_loss_covers_all_reply_tokens(self):
+ h = torch.randn((2, 6, 3), generator=torch.Generator().manual_seed(4),
+ requires_grad=True)
+ w = torch.randn((8, 3), generator=torch.Generator().manual_seed(5))
+ ids = torch.tensor([[1, 2, 1, 4, 2, 7], [1, 3, 5, 7, 0, 0]])
+ lengths, starts = torch.tensor([6, 4]), torch.tensor([3, 2])
+ valid = (torch.arange(1, 6) < lengths[:, None]) & (torch.arange(1, 6) >= starts[:, None])
+ reference = F.cross_entropy(F.linear(h[:, :-1][valid], w), ids[:, 1:][valid])
+ streamed = language_model_loss(h, ids, lengths, lambda: iter([(0, w)]),
+ completion_starts=starts)
+ torch.testing.assert_close(streamed, reference)
+ torch.testing.assert_close(torch.autograd.grad(streamed, h)[0],
+ torch.autograd.grad(reference, h)[0])
+
def test_causality_and_gradients_for_both_adapter_components(self):
torch.manual_seed(9)
a = LearnableSharingAttention(8, 2, 1, 8, 10000, .25, width=10)