ADAPTER_CONTRACT.md

SRIC: external semantic admission

ADAPTER_CONTRACT.md

Download original file

Read the formatted document

Skip source text

1 # Adapter Contract
2 
3 The adapter is valid only when it satisfies all of the following.
4 
5 ## Trace identity
6 
7 `capture(task)` returns the vectors actually reinjected at the model's latent-token positions, in recurrent order, with shape `[latent_steps, hidden_size]`.
8 
9 ## Supplied-trace replay
10 
11 `score_with_trace(task, trace)` runs the same teacher-forced prompt and answer suffix while replacing only the reinjected latent vectors. Exact own-trace replay must reproduce answer logits within the frozen tolerance.
12 
13 ## Source parity
14 
15 The package includes a separate reference recurrence derived from the pinned upstream source. The adapter engine must match it exactly on a controlled PyTorch fixture.
16 
17 ## Fixed surfaces
18 
19 Across clean and intervention arms, the following remain fixed:
20 
21 - checkpoint and base model;
22 - tokenizer and special tokens;
23 - prompt text for the recipient task;
24 - token positions;
25 - attention mask;
26 - answer suffix;
27 - teacher-forced label mask;
28 - decoding settings.
29 
30 ## Modes
31 
32 - `latent`: admissible for causal and semantic construction.
33 - `direct`: admissible as a pre-seal mode control.
34 - `verbalized`: contains gold proof steps and is post-seal only.
35 
36 ## Fingerprint
37 
38 The adapter fingerprint commits:
39 
40 - upstream repository and commit;
41 - source-verification receipt;
42 - checkpoint repository, revision, filename, and full SHA-256;
43 - local base-model path, revision, and tree SHA-256;
44 - latent-step count;
45 - device type.
46 
47 ## Failure
48 
49 Any replay, source-lock, cache representation, latent-position, or trace-shape mismatch returns an adapter failure. It must not be treated as evidence about the model's semantics.

Back to source controls