yixuanzheng commited on
Commit
bfa7eb6
·
verified ·
1 Parent(s): 91995ad

Release v0.1.0: Thinking-Jev Q1 engineering checkpoint (sealed package, unmodified)

Browse files

Qwen3.5-2B looped-memory reader with the Jev decision interface. Engineering checkpoint, not a validated iterative reasoner: see the model card. Files and hashes as in SHA256SUMS.

LICENSE ADDED
@@ -0,0 +1,228 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ Weights (adapter, memory, head): derived from Qwen/Qwen3.5-2B, Apache License 2.0 (text below).
2
+ Code (jev_latent.py, example.py): MIT License, Copyright (c) 2026 Open-Jev contributors (text at the end).
3
+
4
+
5
+ Apache License
6
+ Version 2.0, January 2004
7
+ http://www.apache.org/licenses/
8
+
9
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
10
+
11
+ 1. Definitions.
12
+
13
+ "License" shall mean the terms and conditions for use, reproduction,
14
+ and distribution as defined by Sections 1 through 9 of this document.
15
+
16
+ "Licensor" shall mean the copyright owner or entity authorized by
17
+ the copyright owner that is granting the License.
18
+
19
+ "Legal Entity" shall mean the union of the acting entity and all
20
+ other entities that control, are controlled by, or are under common
21
+ control with that entity. For the purposes of this definition,
22
+ "control" means (i) the power, direct or indirect, to cause the
23
+ direction or management of such entity, whether by contract or
24
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
25
+ outstanding shares, or (iii) beneficial ownership of such entity.
26
+
27
+ "You" (or "Your") shall mean an individual or Legal Entity
28
+ exercising permissions granted by this License.
29
+
30
+ "Source" form shall mean the preferred form for making modifications,
31
+ including but not limited to software source code, documentation
32
+ source, and configuration files.
33
+
34
+ "Object" form shall mean any form resulting from mechanical
35
+ transformation or translation of a Source form, including but
36
+ not limited to compiled object code, generated documentation,
37
+ and conversions to other media types.
38
+
39
+ "Work" shall mean the work of authorship, whether in Source or
40
+ Object form, made available under the License, as indicated by a
41
+ copyright notice that is included in or attached to the work
42
+ (an example is provided in the Appendix below).
43
+
44
+ "Derivative Works" shall mean any work, whether in Source or Object
45
+ form, that is based on (or derived from) the Work and for which the
46
+ editorial revisions, annotations, elaborations, or other modifications
47
+ represent, as a whole, an original work of authorship. For the purposes
48
+ of this License, Derivative Works shall not include works that remain
49
+ separable from, or merely link (or bind by name) to the interfaces of,
50
+ the Work and Derivative Works thereof.
51
+
52
+ "Contribution" shall mean any work of authorship, including
53
+ the original version of the Work and any modifications or additions
54
+ to that Work or Derivative Works thereof, that is intentionally
55
+ submitted to Licensor for inclusion in the Work by the copyright owner
56
+ or by an individual or Legal Entity authorized to submit on behalf of
57
+ the copyright owner. For the purposes of this definition, "submitted"
58
+ means any form of electronic, verbal, or written communication sent
59
+ to the Licensor or its representatives, including but not limited to
60
+ communication on electronic mailing lists, source code control systems,
61
+ and issue tracking systems that are managed by, or on behalf of, the
62
+ Licensor for the purpose of discussing and improving the Work, but
63
+ excluding communication that is conspicuously marked or otherwise
64
+ designated in writing by the copyright owner as "Not a Contribution."
65
+
66
+ "Contributor" shall mean Licensor and any individual or Legal Entity
67
+ on behalf of whom a Contribution has been received by Licensor and
68
+ subsequently incorporated within the Work.
69
+
70
+ 2. Grant of Copyright License. Subject to the terms and conditions of
71
+ this License, each Contributor hereby grants to You a perpetual,
72
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
73
+ copyright license to reproduce, prepare Derivative Works of,
74
+ publicly display, publicly perform, sublicense, and distribute the
75
+ Work and such Derivative Works in Source or Object form.
76
+
77
+ 3. Grant of Patent License. Subject to the terms and conditions of
78
+ this License, each Contributor hereby grants to You a perpetual,
79
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
80
+ (except as stated in this section) patent license to make, have made,
81
+ use, offer to sell, sell, import, and otherwise transfer the Work,
82
+ where such license applies only to those patent claims licensable
83
+ by such Contributor that are necessarily infringed by their
84
+ Contribution(s) alone or by combination of their Contribution(s)
85
+ with the Work to which such Contribution(s) was submitted. If You
86
+ institute patent litigation against any entity (including a
87
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
88
+ or a Contribution incorporated within the Work constitutes direct
89
+ or contributory patent infringement, then any patent licenses
90
+ granted to You under this License for that Work shall terminate
91
+ as of the date such litigation is filed.
92
+
93
+ 4. Redistribution. You may reproduce and distribute copies of the
94
+ Work or Derivative Works thereof in any medium, with or without
95
+ modifications, and in Source or Object form, provided that You
96
+ meet the following conditions:
97
+
98
+ (a) You must give any other recipients of the Work or
99
+ Derivative Works a copy of this License; and
100
+
101
+ (b) You must cause any modified files to carry prominent notices
102
+ stating that You changed the files; and
103
+
104
+ (c) You must retain, in the Source form of any Derivative Works
105
+ that You distribute, all copyright, patent, trademark, and
106
+ attribution notices from the Source form of the Work,
107
+ excluding those notices that do not pertain to any part of
108
+ the Derivative Works; and
109
+
110
+ (d) If the Work includes a "NOTICE" text file as part of its
111
+ distribution, then any Derivative Works that You distribute must
112
+ include a readable copy of the attribution notices contained
113
+ within such NOTICE file, excluding those notices that do not
114
+ pertain to any part of the Derivative Works, in at least one
115
+ of the following places: within a NOTICE text file distributed
116
+ as part of the Derivative Works; within the Source form or
117
+ documentation, if provided along with the Derivative Works; or,
118
+ within a display generated by the Derivative Works, if and
119
+ wherever such third-party notices normally appear. The contents
120
+ of the NOTICE file are for informational purposes only and
121
+ do not modify the License. You may add Your own attribution
122
+ notices within Derivative Works that You distribute, alongside
123
+ or as an addendum to the NOTICE text from the Work, provided
124
+ that such additional attribution notices cannot be construed
125
+ as modifying the License.
126
+
127
+ You may add Your own copyright statement to Your modifications and
128
+ may provide additional or different license terms and conditions
129
+ for use, reproduction, or distribution of Your modifications, or
130
+ for any such Derivative Works as a whole, provided Your use,
131
+ reproduction, and distribution of the Work otherwise complies with
132
+ the conditions stated in this License.
133
+
134
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
135
+ any Contribution intentionally submitted for inclusion in the Work
136
+ by You to the Licensor shall be under the terms and conditions of
137
+ this License, without any additional terms or conditions.
138
+ Notwithstanding the above, nothing herein shall supersede or modify
139
+ the terms of any separate license agreement you may have executed
140
+ with Licensor regarding such Contributions.
141
+
142
+ 6. Trademarks. This License does not grant permission to use the trade
143
+ names, trademarks, service marks, or product names of the Licensor,
144
+ except as required for reasonable and customary use in describing the
145
+ origin of the Work and reproducing the content of the NOTICE file.
146
+
147
+ 7. Disclaimer of Warranty. Unless required by applicable law or
148
+ agreed to in writing, Licensor provides the Work (and each
149
+ Contributor provides its Contributions) on an "AS IS" BASIS,
150
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
151
+ implied, including, without limitation, any warranties or conditions
152
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
153
+ PARTICULAR PURPOSE. You are solely responsible for determining the
154
+ appropriateness of using or redistributing the Work and assume any
155
+ risks associated with Your exercise of permissions under this License.
156
+
157
+ 8. Limitation of Liability. In no event and under no legal theory,
158
+ whether in tort (including negligence), contract, or otherwise,
159
+ unless required by applicable law (such as deliberate and grossly
160
+ negligent acts) or agreed to in writing, shall any Contributor be
161
+ liable to You for damages, including any direct, indirect, special,
162
+ incidental, or consequential damages of any character arising as a
163
+ result of this License or out of the use or inability to use the
164
+ Work (including but not limited to damages for loss of goodwill,
165
+ work stoppage, computer failure or malfunction, or any and all
166
+ other commercial damages or losses), even if such Contributor
167
+ has been advised of the possibility of such damages.
168
+
169
+ 9. Accepting Warranty or Additional Liability. While redistributing
170
+ the Work or Derivative Works thereof, You may choose to offer,
171
+ and charge a fee for, acceptance of support, warranty, indemnity,
172
+ or other liability obligations and/or rights consistent with this
173
+ License. However, in accepting such obligations, You may act only
174
+ on Your own behalf and on Your sole responsibility, not on behalf
175
+ of any other Contributor, and only if You agree to indemnify,
176
+ defend, and hold each Contributor harmless for any liability
177
+ incurred by, or claims asserted against, such Contributor by reason
178
+ of your accepting any such warranty or additional liability.
179
+
180
+ END OF TERMS AND CONDITIONS
181
+
182
+ APPENDIX: How to apply the Apache License to your work.
183
+
184
+ To apply the Apache License to your work, attach the following
185
+ boilerplate notice, with the fields enclosed by brackets "[]"
186
+ replaced with your own identifying information. (Don't include
187
+ the brackets!) The text should be enclosed in the appropriate
188
+ comment syntax for the file format. We also recommend that a
189
+ file or class name and description of purpose be included on the
190
+ same "printed page" as the copyright notice for easier
191
+ identification within third-party archives.
192
+
193
+ Copyright 2026 Alibaba Cloud
194
+
195
+ Licensed under the Apache License, Version 2.0 (the "License");
196
+ you may not use this file except in compliance with the License.
197
+ You may obtain a copy of the License at
198
+
199
+ http://www.apache.org/licenses/LICENSE-2.0
200
+
201
+ Unless required by applicable law or agreed to in writing, software
202
+ distributed under the License is distributed on an "AS IS" BASIS,
203
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
204
+ See the License for the specific language governing permissions and
205
+ limitations under the License.
206
+ ----
207
+
208
+ MIT License
209
+
210
+ Copyright (c) 2026 Open-Jev contributors
211
+
212
+ Permission is hereby granted, free of charge, to any person obtaining a copy
213
+ of this software and associated documentation files (the "Software"), to deal
214
+ in the Software without restriction, including without limitation the rights
215
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
216
+ copies of the Software, and to permit persons to whom the Software is
217
+ furnished to do so, subject to the following conditions:
218
+
219
+ The above copyright notice and this permission notice shall be included in all
220
+ copies or substantial portions of the Software.
221
+
222
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
223
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
224
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
225
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
226
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
227
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
228
+ SOFTWARE.
README.md CHANGED
@@ -1,3 +1,118 @@
1
  ---
2
  license: apache-2.0
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: apache-2.0
3
+ base_model: Qwen/Qwen3.5-2B
4
+ library_name: peft
5
+ tags: [latent-reasoning, recurrent-memory, jev, research, engineering-checkpoint]
6
  ---
7
+
8
+ # Thinking-Jev Q1: Qwen3.5-2B looped-memory reader (engineering checkpoint, v0.1.0)
9
+
10
+ **Status: preliminary engineering checkpoint, release v0.1.0. It is not a validated iterative reasoner, not a stopping testbed, and not validated latent reasoning.**
11
+
12
+ > **Depth-insensitive behaviour, read this first.** Extra latent passes do almost nothing on the task this checkpoint was trained on. After **one** pass,
13
+ > decision accuracy is 0.992. Passes 2–6 change only 0.6 % of the top answers (depth 1 to 4), and the net gain from depth 1 to the needed depth is +0.006 on stories with 3–8 swaps.
14
+ > The model answers in the first pass what the training plan meant to take up to four passes. Use it to test the
15
+ > loop, save and replay machinery, not to study when to stop thinking on this task. Depth changes answers only beyond the training range:
16
+ > on stories with 12 and 16 swaps, 24 % and 38 % of the answers change between depth 1 and depth 8, and accuracy rises from 0.672 to 0.762 and from 0.374 to 0.456.
17
+
18
+ ## What it is
19
+
20
+ A LoRA adapter (r = 16) on Qwen/Qwen3.5-2B plus 16 learned memory vectors and a scalar decision head. The model reads a fixed text again and again:
21
+
22
+ * **pass** (one latent step): `[memory, text, memory]` → new memory (16 vectors, the outputs at the trailing memory slots). The text is the same at every pass.
23
+ * **read-out**: a fresh pass over `[memory, question prompt]`, **without the text**. Each answer candidate of a Jev request is scored by the head, then softmax.
24
+ * **state**: the list of memories at depths 0…t. States can be saved, reloaded, continued, and branched (stop now or think one more pass).
25
+
26
+ Depth 0 is the learned initial memory (no text read, chance accuracy). Trained depths 1–5; probabilities are returned at every depth.
27
+
28
+ ## Use
29
+
30
+ ```python
31
+ from jev_latent import LatentJev
32
+ m = LatentJev.from_pretrained(".") # checks SHA256SUMS; base model Qwen/Qwen3.5-2B at the pinned revision
33
+ s = m.start(text) # depth 0
34
+ s = m.step(s) # one more pass on the same text (returns a new state)
35
+ m.answer(s, questions) # Jev request in, typed answers with probabilities out
36
+ m.decide(text, questions, max_depth=4) # answers and probabilities at depths 1..4
37
+ m.save(s, "run.safetensors"); s2 = m.load("run.safetensors")
38
+ stop, think = m.answer(s2, questions), m.answer(m.step(s2), questions)
39
+ ```
40
+
41
+ `calibrated=True` applies the temperature fitted on the 270 selection rows (T = 1.58); raw probabilities are the default. Requirements are pinned in
42
+ `requirements.txt`. Saved states refuse to load under another model or text. Exact replay is promised for batch size 1 on the same device type and dtype (tested on an NVIDIA L40S, bf16).
43
+ `example.py` runs a three-swap story.
44
+
45
+ ## Training data and procedure
46
+
47
+ Synthetic stories only (Track B): five boxes, five objects, an initial arrangement, then 0–8 swap sentences ("The contents of box 2 and box 5 are exchanged."), about 200 tokens at most. Question: which box holds a given object.
48
+ No Jev records, no natural text. Curriculum from the Q0 memory checkpoint: P0 (no swaps), A1 (≤ 2), A2 (≤ 4), A3 (≤ 8, plus no-change sentences), B (≤ 8). The A stages train the decision at or after the needed depth
49
+ (⌈k/2⌉ passes, at least 1) and a state-line scaffold at every depth (the arrangement after min(k, 2t) swaps). B fades the scaffold out and adds a final-answer loss at one earlier depth (weight 0.25).
50
+ The released weights are B at update 400, chosen by the frozen rule (highest depth-4 decision accuracy, ties within 0.005 broken by the state line). A fixed set of arrangements never occurs in training (about a quarter of the evaluation rows end in one).
51
+ Compute: 3.7 L40S GPU-hours for training, 1.6 for evaluation and packaging.
52
+
53
+ ## Evaluation (1,800 new rows, 200 per swap count 0–8, five questions each; 95 % row-bootstrap intervals)
54
+
55
+ | Check | Threshold | Result |
56
+ |---|---|---|
57
+ | G1 accuracy at depth 4, 3–8 swaps, arrangement seen | ≥ 0.90 | **0.994** [0.991, 0.996] pass |
58
+ | G2 same, final arrangement held out of training | ≥ 0.80 | **0.992** [0.987, 0.997] pass |
59
+ | G3 net wrong→correct from depth 1 to the needed depth, 3–8 swaps | ≥ 0.30 | **0.006** [0.004, 0.008] **fail** |
60
+ | G4 correct→wrong per extra pass after the needed depth | ≤ 0.02 | **0.002** pass |
61
+ | G5 top answer differs, depth 1 vs 4 | ≥ 0.05 | **0.006** **fail** |
62
+ | G6 own memory minus mean memory; follows a same-depth donor memory | ≥ 0.30; ≥ 0.80 | **0.796; 0.994** pass |
63
+ | G7 fresh-process replay, continue, branch (300 stories × depths 1–5) | difference 0.0 | **0.0** on all three pass |
64
+ | G8 clean-folder load, 100 stored answers, hashes, card | all | **100/100** answers, hashes match, pass |
65
+
66
+ Accuracy by depth 0–6: 0.198, 0.992, 0.995, 0.995, 0.995, 0.994, 0.989. With 8 swaps: 0.945 at depth 1, 0.970 at depth 4, the only swap count where depth helps measurably (30 of 55 depth-1 errors are
67
+ fixed later). One or two no-change sentences change nothing. The state line is a different matter. On stories with 5–8 swaps, the depth-1 line matches the trained intermediate arrangement in only 11 % of cases,
68
+ although the decision is already right in 97.5 %. The decision does not go through the scaffold.
69
+
70
+ **What the memory carries (donor test, label "mixed", not a gate).** If the memory of another story at the same depth t (t = 1, 2, 3) is swapped in and the passes continue on the recipient's text,
71
+ the answer is the **donor's final answer** in 79 %, 93 % and 96 % of cases, and the recipient's own answer in 17 %, 4 % and 2 %. The memory holds a finished answer after the first pass and later passes mostly keep it.
72
+ It is not a step counter, and it does not continue a partly computed state.
73
+
74
+ **Calibration.** Expected calibration error 0.004 (raw) and 0.002 (T = 1.58) at depth 1, at most 0.009 for depths 1–6.
75
+
76
+ **Stopping (issue #43 analysis, price 0.01 per pass, half-split cross-fit).** The oracle's gain over always stopping after one pass is only 0.50 points. A confidence rule captures 55 % of that gain and the true swap count 33 %;
77
+ the opportunity left beyond the swap count is 0.34 points [0.24, 0.45]. There is almost nothing to learn about stopping on this task.
78
+
79
+ **Out of domain.** JevBench public (231) and LevBench rule depth (500), through the same interface, depths 1–4 (results under Verification). The reader never sees the text, and no Jev data were used in training, so
80
+ results near the majority rate are expected and say nothing about the method.
81
+
82
+ ## Limitations
83
+
84
+ * Depth-insensitive on its training task (above). The one-pass reader is strong enough for 8 swaps, so the loop was not needed.
85
+ * Trained only on short synthetic five-box stories. Texts longer than about 200 tokens and other domains are untested.
86
+ * The read-out never sees the text: everything must pass through 16 vectors.
87
+ * Exact replay holds only at batch size 1 on the same device type and dtype. Batched or CPU runs agree closely but not bit for bit.
88
+ * Research artefact; not for any decision that matters.
89
+
90
+ ## Licence
91
+
92
+ Weights (adapter, memory, head) derive from Qwen/Qwen3.5-2B and follow its Apache License 2.0. `jev_latent.py` and `example.py` are MIT (Open-Jev contributors). Both texts are in `LICENSE`.
93
+
94
+ ## Verification
95
+
96
+ All checks ran from a clean copy of this folder, each in a fresh `python -I` process that imports only `jev_latent.py` (no repository code). NVIDIA L40S, bf16, batch size 1.
97
+
98
+ | Check | Result |
99
+ |---|---|
100
+ | `SHA256SUMS` | all files match, before and after the runs |
101
+ | Replay: 300 saved states reloaded in a new process, read-outs at depths 1–5 | largest probability difference **0.0** |
102
+ | Continue: one more pass from each saved depth 1–4 vs the unbroken run | largest memory difference **0.0** |
103
+ | Branch twice from the same file (stop / think) | largest difference **0.0** |
104
+ | `expected.json`: 25 stories × depths 1–4 computed by the training code | **100 / 100** top answers equal; largest probability difference 1.2 × 10⁻⁷ (floating-point rounding between the interface's and the training code's probability computation; same top answer everywhere) |
105
+
106
+ **Out of domain (no threshold, no selection, run once).**
107
+
108
+ | Set | n | Depth 1 / 2 / 3 / 4 | Reference rates | Answers changed, depth 1→4 |
109
+ |---|---|---|---|---|
110
+ | JevBench public | 231 | 0.312 / 0.312 / 0.312 / 0.325 | majority position 0.342, uniform chance 0.318 | 22 % |
111
+ | LevBench rule depth | 500 | 0.540 / 0.510 / 0.490 / 0.492 | majority 0.500, chance 0.500 | 52 % |
112
+
113
+ Both are at chance, as expected for a reader that never sees the text and has seen no Jev data. Released Open-Jev 2B scores 150/231 on JevBench, and the C5 model scores 64.8–66.0 % on rule depth.
114
+ On rule depth, answers move a lot with depth but not towards the right ones. Do not read either set as a measure of the method.
115
+
116
+ ## Versions
117
+
118
+ * **v0.1.0**: this checkpoint (Q1, B at update 400). Package format version 1. Later checkpoints keep the same interface; a change to the interface would raise the major version.
SHA256SUMS ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ c1dbb9450ae13ee74a48aa4616b91de4e97a3f8de98e596abfe23b75a972ce59 LICENSE
2
+ eaf2f9aaf69b7d44d42fda9f06c691b8c8229bf095c6ed6e5c6b84c3e5ce0c64 README.md
3
+ f70bfc24a228527403ad18eb92fc1e54c9ccb9a80d53699db889994c3bcef451 adapter/adapter_config.json
4
+ 5207818d85a480cfb1b740368c8476a5ccdc3b16c59a54d28506f830833cbf11 adapter/adapter_model.safetensors
5
+ be98a9b675caa86c39be81f7f2d84890e73c5a4984b98b7abc8180893403655e config.json
6
+ ced29df5612398c7617e1f98922976d0b7d73aa5f740fdbfb0a88eaf76b71a99 example.py
7
+ 125466a5abf21ad09e485407804c10683f2b705d85f9b1bce9558a647602f809 expected.json
8
+ 4981eed0e8a460912049dfb76792f6c2e9b1eb570b585e50e05d842842e10199 head.safetensors
9
+ 3adf871a7c9c83dcbd59260b42702f62b6b4bdc45707d3d8c51ad25f2e465831 jev_latent.py
10
+ cbec7fad0082d66e716fb98c98fc255e331b376f14fb2cf378f662844924d9c9 memory.safetensors
11
+ a9f14fa53d4cf71d9d3449635e71de97da0f102b1806fcce1092e31fa15ed81e requirements.txt
adapter/adapter_config.json ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "alora_invocation_tokens": null,
3
+ "alpha_pattern": {},
4
+ "arrow_config": null,
5
+ "auto_mapping": {
6
+ "base_model_class": "Qwen3_5TextModel",
7
+ "parent_library": "transformers.models.qwen3_5.modeling_qwen3_5"
8
+ },
9
+ "base_model_name_or_path": "Qwen/Qwen3.5-2B",
10
+ "bias": "none",
11
+ "corda_config": null,
12
+ "ensure_weight_tying": false,
13
+ "eva_config": null,
14
+ "exclude_modules": null,
15
+ "fan_in_fan_out": false,
16
+ "inference_mode": true,
17
+ "init_lora_weights": true,
18
+ "layer_replication": null,
19
+ "layers_pattern": null,
20
+ "layers_to_transform": null,
21
+ "loftq_config": {},
22
+ "lora_alpha": 32,
23
+ "lora_bias": false,
24
+ "lora_dropout": 0.0,
25
+ "lora_ga_config": null,
26
+ "megatron_config": null,
27
+ "megatron_core": "megatron.core",
28
+ "modules_to_save": null,
29
+ "peft_type": "LORA",
30
+ "peft_version": "0.19.1",
31
+ "qalora_group_size": 16,
32
+ "r": 16,
33
+ "rank_pattern": {},
34
+ "revision": "15852e8c16360a2fea060d615a32b45270f8a8fc",
35
+ "target_modules": [
36
+ "v_proj",
37
+ "o_proj",
38
+ "k_proj",
39
+ "out_proj",
40
+ "q_proj",
41
+ "down_proj",
42
+ "in_proj_qkv",
43
+ "gate_proj",
44
+ "up_proj"
45
+ ],
46
+ "target_parameters": null,
47
+ "task_type": null,
48
+ "trainable_token_indices": null,
49
+ "use_bdlora": null,
50
+ "use_dora": false,
51
+ "use_qalora": false,
52
+ "use_rslora": false
53
+ }
adapter/adapter_model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5207818d85a480cfb1b740368c8476a5ccdc3b16c59a54d28506f830833cbf11
3
+ size 57836496
config.json ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "format": "latent-jev",
3
+ "format_version": "1",
4
+ "base_model": "Qwen/Qwen3.5-2B",
5
+ "base_revision": "15852e8c16360a2fea060d615a32b45270f8a8fc",
6
+ "memory_vectors": 16,
7
+ "rescale": "raw",
8
+ "max_text_tokens": 4096,
9
+ "trained_text_tokens_about": 200,
10
+ "trained_max_depth": 5,
11
+ "temperature": 1.5809,
12
+ "built_with": {
13
+ "torch": "2.8.0+cu128",
14
+ "transformers": "5.10.2",
15
+ "peft": "0.19.1"
16
+ },
17
+ "release": "v0.1.0"
18
+ }
example.py ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from jev_latent import LatentJev
2
+
3
+ m = LatentJev.from_pretrained(".")
4
+ story = ("There are five boxes, numbered 1 to 5. Box 1 holds the red ball. Box 2 holds the blue cube. Box 3 holds the green ring. "
5
+ "Box 4 holds the yellow coin. Box 5 holds the white shell.\n"
6
+ "The contents of box 1 and box 2 are exchanged.\nThe contents of box 2 and box 5 are exchanged.\nThe contents of box 3 and box 5 are exchanged.\n")
7
+ q = {"where": {"type": "choice", "instructions": "After all the swaps, which box holds the red ball?", "criteria": {f"box {b}": None for b in range(1, 6)}}}
8
+ for r in m.decide(story, q, max_depth=4)["by_depth"]:
9
+ print(r["depth"], r["answers"]["where"]["choice"], r["answers"]["where"]["probabilities"])
10
+ # stop and think branches from one saved prefix
11
+ s = m.step(m.start(story))
12
+ m.save(s, "prefix.safetensors")
13
+ s = m.load("prefix.safetensors")
14
+ print("stop ", m.answer(s, q))
15
+ print("think", m.answer(m.step(s), q))
expected.json ADDED
@@ -0,0 +1,1180 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "note": "25 stories x depths 1-4 = 100 answers, computed by the training code at batch size 1 on an NVIDIA L40S in bf16",
3
+ "items": [
4
+ {
5
+ "text": "Five boxes stand in a row, labelled 1 to 5. Inside box 3 is the yellow coin. Inside box 1 is the red ball. The blue cube is in box 5. Box 2 holds the green ring. The white shell is in box 4.\n",
6
+ "questions": {
7
+ "w": {
8
+ "type": "choice",
9
+ "instructions": "After all the swaps, which box holds the red ball?",
10
+ "criteria": {
11
+ "box 1": null,
12
+ "box 2": null,
13
+ "box 3": null,
14
+ "box 4": null,
15
+ "box 5": null
16
+ }
17
+ }
18
+ },
19
+ "probabilities": [
20
+ [
21
+ 1.0,
22
+ 1.8757721070850053e-12,
23
+ 1.1309801836376088e-12,
24
+ 8.206410946837508e-15,
25
+ 2.654833343722525e-14
26
+ ],
27
+ [
28
+ 1.0,
29
+ 7.763492973489328e-12,
30
+ 1.1296111615544113e-12,
31
+ 2.2355381434913113e-14,
32
+ 3.7910467273012324e-14
33
+ ],
34
+ [
35
+ 1.0,
36
+ 1.0350179741047683e-10,
37
+ 6.796904618994182e-12,
38
+ 4.016230165278245e-13,
39
+ 3.648417559818512e-13
40
+ ],
41
+ [
42
+ 1.0,
43
+ 5.875419040179963e-10,
44
+ 2.3230441875687902e-11,
45
+ 3.2273302953689242e-12,
46
+ 2.337131356500155e-12
47
+ ]
48
+ ],
49
+ "gold": "box 1"
50
+ },
51
+ {
52
+ "text": "A shelf holds five boxes, numbered 1 to 5. The white shell is in box 3. The yellow coin is in box 2. Inside box 4 is the blue cube. Inside box 1 is the green ring. Box 5 holds the red ball.\n",
53
+ "questions": {
54
+ "w": {
55
+ "type": "choice",
56
+ "instructions": "After all the swaps, which box holds the yellow coin?",
57
+ "criteria": {
58
+ "box 1": null,
59
+ "box 2": null,
60
+ "box 3": null,
61
+ "box 4": null,
62
+ "box 5": null
63
+ }
64
+ }
65
+ },
66
+ "probabilities": [
67
+ [
68
+ 2.277925857077739e-22,
69
+ 1.0,
70
+ 7.877297584164246e-28,
71
+ 1.775636919689067e-27,
72
+ 1.4673684898189638e-26
73
+ ],
74
+ [
75
+ 5.774772422844297e-21,
76
+ 1.0,
77
+ 1.3280815384553857e-26,
78
+ 5.420600394551038e-26,
79
+ 6.956344081257373e-25
80
+ ],
81
+ [
82
+ 5.4455533112019705e-19,
83
+ 1.0,
84
+ 9.20806864912023e-25,
85
+ 1.2644895207807312e-23,
86
+ 1.619190398072192e-22
87
+ ],
88
+ [
89
+ 1.8150390076865618e-16,
90
+ 1.0,
91
+ 2.9340001411511775e-22,
92
+ 8.893076118900854e-21,
93
+ 9.333138305042339e-20
94
+ ]
95
+ ],
96
+ "gold": "box 2"
97
+ },
98
+ {
99
+ "text": "A shelf holds five boxes, numbered 1 to 5. Box 3 holds the red ball. Inside box 4 is the white shell. Inside box 2 is the blue cube. Box 5 holds the yellow coin. Box 1 holds the green ring.\n",
100
+ "questions": {
101
+ "w": {
102
+ "type": "choice",
103
+ "instructions": "After all the swaps, which box holds the yellow coin?",
104
+ "criteria": {
105
+ "box 1": null,
106
+ "box 2": null,
107
+ "box 3": null,
108
+ "box 4": null,
109
+ "box 5": null
110
+ }
111
+ }
112
+ },
113
+ "probabilities": [
114
+ [
115
+ 1.446670855749863e-18,
116
+ 7.70428252444555e-12,
117
+ 4.0544506640927125e-10,
118
+ 4.3076578816556715e-14,
119
+ 1.0
120
+ ],
121
+ [
122
+ 4.192695215671498e-19,
123
+ 8.050655411415142e-13,
124
+ 5.2233811026480836e-11,
125
+ 5.3050905919475085e-15,
126
+ 1.0
127
+ ],
128
+ [
129
+ 7.604018564125272e-19,
130
+ 3.712705869737126e-13,
131
+ 2.8803697274537576e-11,
132
+ 6.124177381173048e-15,
133
+ 1.0
134
+ ],
135
+ [
136
+ 4.0434908583210204e-18,
137
+ 3.8708890693489595e-13,
138
+ 5.0879602614406494e-11,
139
+ 3.962176181766808e-14,
140
+ 1.0
141
+ ]
142
+ ],
143
+ "gold": "box 5"
144
+ },
145
+ {
146
+ "text": "There are five boxes, numbered 1 to 5. Inside box 2 is the blue cube. The white shell is in box 1. The red ball is in box 4. The yellow coin is in box 3. The green ring is in box 5.\n",
147
+ "questions": {
148
+ "w": {
149
+ "type": "choice",
150
+ "instructions": "After all the swaps, which box holds the yellow coin?",
151
+ "criteria": {
152
+ "box 1": null,
153
+ "box 2": null,
154
+ "box 3": null,
155
+ "box 4": null,
156
+ "box 5": null
157
+ }
158
+ }
159
+ },
160
+ "probabilities": [
161
+ [
162
+ 1.3574565116414306e-07,
163
+ 3.3238624526366056e-12,
164
+ 0.9999998807907104,
165
+ 1.2139344217343417e-11,
166
+ 7.032012305785429e-09
167
+ ],
168
+ [
169
+ 3.137130022423662e-08,
170
+ 7.310253205723705e-13,
171
+ 1.0,
172
+ 3.49613675683369e-13,
173
+ 1.6620472775841222e-09
174
+ ],
175
+ [
176
+ 3.65388643785991e-08,
177
+ 1.8042253888822524e-12,
178
+ 1.0,
179
+ 1.2085136765014465e-13,
180
+ 1.0902508895682672e-09
181
+ ],
182
+ [
183
+ 2.7449726047734657e-08,
184
+ 3.246593315367474e-12,
185
+ 1.0,
186
+ 8.213993585781329e-14,
187
+ 5.039901829206883e-10
188
+ ]
189
+ ],
190
+ "gold": "box 3"
191
+ },
192
+ {
193
+ "text": "There are five boxes, numbered 1 to 5. Box 3 holds the white shell. The blue cube is in box 4. The yellow coin is in box 1. Box 2 holds the red ball. Inside box 5 is the green ring.\n",
194
+ "questions": {
195
+ "w": {
196
+ "type": "choice",
197
+ "instructions": "After all the swaps, which box holds the yellow coin?",
198
+ "criteria": {
199
+ "box 1": null,
200
+ "box 2": null,
201
+ "box 3": null,
202
+ "box 4": null,
203
+ "box 5": null
204
+ }
205
+ }
206
+ },
207
+ "probabilities": [
208
+ [
209
+ 1.0,
210
+ 1.872337875019614e-11,
211
+ 1.0386957786934214e-11,
212
+ 1.8554423405689469e-13,
213
+ 1.0662272930880845e-12
214
+ ],
215
+ [
216
+ 1.0,
217
+ 1.368777174937108e-10,
218
+ 2.035413851353418e-11,
219
+ 1.6139012869176295e-12,
220
+ 7.226440799923406e-12
221
+ ],
222
+ [
223
+ 1.0,
224
+ 4.5024348138689163e-10,
225
+ 3.129887321540181e-11,
226
+ 6.451845134536338e-12,
227
+ 2.128478643337317e-11
228
+ ],
229
+ [
230
+ 1.0,
231
+ 1.7031402954614805e-09,
232
+ 8.391492362092023e-11,
233
+ 3.567006412463769e-11,
234
+ 9.772512660211063e-11
235
+ ]
236
+ ],
237
+ "gold": "box 1"
238
+ },
239
+ {
240
+ "text": "Five boxes stand in a row, labelled 1 to 5. The green ring is in box 2. Inside box 4 is the white shell. Inside box 5 is the yellow coin. The red ball is in box 3. Box 1 holds the blue cube.\n",
241
+ "questions": {
242
+ "w": {
243
+ "type": "choice",
244
+ "instructions": "After all the swaps, which box holds the white shell?",
245
+ "criteria": {
246
+ "box 1": null,
247
+ "box 2": null,
248
+ "box 3": null,
249
+ "box 4": null,
250
+ "box 5": null
251
+ }
252
+ }
253
+ },
254
+ "probabilities": [
255
+ [
256
+ 1.2868003104044012e-12,
257
+ 2.286551941525387e-16,
258
+ 1.070926403112793e-10,
259
+ 1.0,
260
+ 9.962525249207488e-10
261
+ ],
262
+ [
263
+ 5.494742031167399e-13,
264
+ 1.6833305459955405e-16,
265
+ 2.5059797986726196e-12,
266
+ 1.0,
267
+ 4.2353110601967003e-11
268
+ ],
269
+ [
270
+ 1.7192609098534706e-12,
271
+ 4.2312792373237686e-16,
272
+ 1.9552658103716425e-12,
273
+ 1.0,
274
+ 6.619226694537517e-11
275
+ ],
276
+ [
277
+ 4.8596439372605715e-11,
278
+ 8.626332612636511e-15,
279
+ 1.1290517132334088e-11,
280
+ 1.0,
281
+ 5.044277218146931e-10
282
+ ]
283
+ ],
284
+ "gold": "box 4"
285
+ },
286
+ {
287
+ "text": "Five boxes stand in a row, labelled 1 to 5. Inside box 4 is the red ball. Inside box 5 is the yellow coin. Box 3 holds the green ring. Box 2 holds the blue cube. The white shell is in box 1.\n",
288
+ "questions": {
289
+ "w": {
290
+ "type": "choice",
291
+ "instructions": "After all the swaps, which box holds the green ring?",
292
+ "criteria": {
293
+ "box 1": null,
294
+ "box 2": null,
295
+ "box 3": null,
296
+ "box 4": null,
297
+ "box 5": null
298
+ }
299
+ }
300
+ },
301
+ "probabilities": [
302
+ [
303
+ 1.1471915639660324e-09,
304
+ 6.177845778346236e-13,
305
+ 1.0,
306
+ 3.716780661022767e-09,
307
+ 2.9539815038504003e-09
308
+ ],
309
+ [
310
+ 7.827778980562528e-10,
311
+ 4.831303000892018e-13,
312
+ 1.0,
313
+ 4.258285113412086e-10,
314
+ 3.6136100778350055e-09
315
+ ],
316
+ [
317
+ 9.552256763356581e-10,
318
+ 5.234316669336381e-13,
319
+ 1.0,
320
+ 3.4549954563978247e-10,
321
+ 6.855046308373858e-09
322
+ ],
323
+ [
324
+ 1.0475424971900793e-09,
325
+ 6.187256111102324e-13,
326
+ 1.0,
327
+ 1.725435488930671e-10,
328
+ 8.915990612479163e-09
329
+ ]
330
+ ],
331
+ "gold": "box 3"
332
+ },
333
+ {
334
+ "text": "Five boxes stand in a row, labelled 1 to 5. Inside box 2 is the red ball. Box 3 holds the blue cube. Box 4 holds the yellow coin. The green ring is in box 5. Inside box 1 is the white shell.\n",
335
+ "questions": {
336
+ "w": {
337
+ "type": "choice",
338
+ "instructions": "After all the swaps, which box holds the red ball?",
339
+ "criteria": {
340
+ "box 1": null,
341
+ "box 2": null,
342
+ "box 3": null,
343
+ "box 4": null,
344
+ "box 5": null
345
+ }
346
+ }
347
+ },
348
+ "probabilities": [
349
+ [
350
+ 6.681276360343407e-19,
351
+ 1.0,
352
+ 5.215407812341737e-26,
353
+ 2.6862685975038505e-27,
354
+ 1.0222018587546056e-27
355
+ ],
356
+ [
357
+ 7.648183081197973e-18,
358
+ 1.0,
359
+ 5.261089391508405e-25,
360
+ 1.0695643472062759e-26,
361
+ 6.3321498935401184e-27
362
+ ],
363
+ [
364
+ 3.273633779499856e-17,
365
+ 1.0,
366
+ 2.240957010937042e-24,
367
+ 7.934395648484794e-26,
368
+ 4.3528842467565935e-26
369
+ ],
370
+ [
371
+ 1.9223726404824626e-16,
372
+ 1.0,
373
+ 1.2332671950129887e-23,
374
+ 1.4299977451780739e-24,
375
+ 5.962505065385668e-25
376
+ ]
377
+ ],
378
+ "gold": "box 2"
379
+ },
380
+ {
381
+ "text": "There are five boxes, numbered 1 to 5. Inside box 1 is the red ball. Box 5 holds the white shell. Box 3 holds the yellow coin. Inside box 4 is the blue cube. Box 2 holds the green ring.\n",
382
+ "questions": {
383
+ "w": {
384
+ "type": "choice",
385
+ "instructions": "After all the swaps, which box holds the blue cube?",
386
+ "criteria": {
387
+ "box 1": null,
388
+ "box 2": null,
389
+ "box 3": null,
390
+ "box 4": null,
391
+ "box 5": null
392
+ }
393
+ }
394
+ },
395
+ "probabilities": [
396
+ [
397
+ 1.0192260209917429e-14,
398
+ 1.0078756324258223e-19,
399
+ 7.766887244573147e-15,
400
+ 1.0,
401
+ 1.9981367255228477e-11
402
+ ],
403
+ [
404
+ 3.116824425506218e-14,
405
+ 1.6736020923888923e-19,
406
+ 2.8721841155703465e-15,
407
+ 1.0,
408
+ 3.689707827464472e-12
409
+ ],
410
+ [
411
+ 2.0405079264717435e-13,
412
+ 6.592815080697572e-19,
413
+ 3.672052150739159e-15,
414
+ 1.0,
415
+ 9.038126150273662e-12
416
+ ],
417
+ [
418
+ 1.6860846486360659e-12,
419
+ 2.591434849988284e-18,
420
+ 1.1852264368518092e-14,
421
+ 1.0,
422
+ 8.805940698852766e-11
423
+ ]
424
+ ],
425
+ "gold": "box 4"
426
+ },
427
+ {
428
+ "text": "A shelf holds five boxes, numbered 1 to 5. The blue cube is in box 2. The red ball is in box 1. Inside box 3 is the green ring. Inside box 5 is the yellow coin. The white shell is in box 4.\n",
429
+ "questions": {
430
+ "w": {
431
+ "type": "choice",
432
+ "instructions": "After all the swaps, which box holds the green ring?",
433
+ "criteria": {
434
+ "box 1": null,
435
+ "box 2": null,
436
+ "box 3": null,
437
+ "box 4": null,
438
+ "box 5": null
439
+ }
440
+ }
441
+ },
442
+ "probabilities": [
443
+ [
444
+ 7.046815214684088e-11,
445
+ 1.1704806774422843e-13,
446
+ 1.0,
447
+ 2.1748020051504113e-11,
448
+ 1.46505654829987e-10
449
+ ],
450
+ [
451
+ 4.434489234150796e-11,
452
+ 7.337601121322479e-14,
453
+ 1.0,
454
+ 4.795408861668626e-12,
455
+ 6.209417702240927e-11
456
+ ],
457
+ [
458
+ 7.946360236488204e-11,
459
+ 6.227649824866802e-14,
460
+ 1.0,
461
+ 1.039801925117878e-11,
462
+ 1.0711326964285561e-10
463
+ ],
464
+ [
465
+ 2.0088528063233468e-10,
466
+ 8.278132953426498e-14,
467
+ 1.0,
468
+ 4.6972543910062114e-11,
469
+ 2.1181080500642935e-10
470
+ ]
471
+ ],
472
+ "gold": "box 3"
473
+ },
474
+ {
475
+ "text": "There are five boxes, numbered 1 to 5. The white shell is in box 5. Box 1 holds the blue cube. Box 2 holds the yellow coin. Inside box 3 is the green ring. Box 4 holds the red ball.\n",
476
+ "questions": {
477
+ "w": {
478
+ "type": "choice",
479
+ "instructions": "After all the swaps, which box holds the blue cube?",
480
+ "criteria": {
481
+ "box 1": null,
482
+ "box 2": null,
483
+ "box 3": null,
484
+ "box 4": null,
485
+ "box 5": null
486
+ }
487
+ }
488
+ },
489
+ "probabilities": [
490
+ [
491
+ 1.0,
492
+ 7.523706657686091e-11,
493
+ 4.2143315204766496e-13,
494
+ 1.2678212971649339e-13,
495
+ 1.340870231687774e-13
496
+ ],
497
+ [
498
+ 1.0,
499
+ 6.055315138198125e-10,
500
+ 4.607707878440115e-12,
501
+ 2.011108727467681e-12,
502
+ 4.861829688840302e-12
503
+ ],
504
+ [
505
+ 1.0,
506
+ 4.052589819281138e-09,
507
+ 3.6402051512007816e-11,
508
+ 2.658825416779198e-11,
509
+ 8.149494273856916e-11
510
+ ],
511
+ [
512
+ 1.0,
513
+ 1.779790892442179e-08,
514
+ 2.2155156875758308e-10,
515
+ 2.644089669434635e-10,
516
+ 7.744954122479442e-10
517
+ ]
518
+ ],
519
+ "gold": "box 1"
520
+ },
521
+ {
522
+ "text": "There are five boxes, numbered 1 to 5. Inside box 5 is the white shell. Inside box 1 is the green ring. The blue cube is in box 2. The yellow coin is in box 3. Box 4 holds the red ball.\n",
523
+ "questions": {
524
+ "w": {
525
+ "type": "choice",
526
+ "instructions": "After all the swaps, which box holds the white shell?",
527
+ "criteria": {
528
+ "box 1": null,
529
+ "box 2": null,
530
+ "box 3": null,
531
+ "box 4": null,
532
+ "box 5": null
533
+ }
534
+ }
535
+ },
536
+ "probabilities": [
537
+ [
538
+ 1.1061466951101075e-17,
539
+ 1.7856653926773963e-13,
540
+ 8.940306719766589e-13,
541
+ 5.826590989880089e-15,
542
+ 1.0
543
+ ],
544
+ [
545
+ 1.5609346490767636e-17,
546
+ 1.3346545006329147e-13,
547
+ 8.732771992515931e-13,
548
+ 7.692024778628917e-15,
549
+ 1.0
550
+ ],
551
+ [
552
+ 1.281069702435247e-16,
553
+ 5.961608702358123e-13,
554
+ 7.227860237407624e-12,
555
+ 1.5107098243812705e-13,
556
+ 1.0
557
+ ],
558
+ [
559
+ 4.57697387070766e-15,
560
+ 2.596326148865402e-12,
561
+ 1.5395182351163328e-10,
562
+ 1.6296936022897057e-11,
563
+ 1.0
564
+ ]
565
+ ],
566
+ "gold": "box 5"
567
+ },
568
+ {
569
+ "text": "A shelf holds five boxes, numbered 1 to 5. Box 3 holds the white shell. Box 4 holds the yellow coin. Box 2 holds the red ball. Inside box 5 is the blue cube. Box 1 holds the green ring.\nThe contents of box 2 and box 4 are exchanged.\n",
570
+ "questions": {
571
+ "w": {
572
+ "type": "choice",
573
+ "instructions": "After all the swaps, which box holds the yellow coin?",
574
+ "criteria": {
575
+ "box 1": null,
576
+ "box 2": null,
577
+ "box 3": null,
578
+ "box 4": null,
579
+ "box 5": null
580
+ }
581
+ }
582
+ },
583
+ "probabilities": [
584
+ [
585
+ 2.078974747020604e-18,
586
+ 1.0,
587
+ 7.168331714089021e-23,
588
+ 2.3562459260952785e-25,
589
+ 1.1674189833804052e-25
590
+ ],
591
+ [
592
+ 2.200682917706298e-17,
593
+ 1.0,
594
+ 2.916680794640359e-22,
595
+ 6.784480675078434e-24,
596
+ 1.4977275675633132e-24
597
+ ],
598
+ [
599
+ 7.808444692668692e-16,
600
+ 1.0,
601
+ 3.0373967079783473e-21,
602
+ 7.350401946973734e-22,
603
+ 9.508023108126158e-23
604
+ ],
605
+ [
606
+ 4.418095392571403e-14,
607
+ 1.0,
608
+ 7.927642768275958e-20,
609
+ 9.278187662974675e-20,
610
+ 9.379140048416657e-21
611
+ ]
612
+ ],
613
+ "gold": "box 2"
614
+ },
615
+ {
616
+ "text": "Five boxes stand in a row, labelled 1 to 5. Inside box 3 is the yellow coin. Box 5 holds the red ball. Inside box 4 is the green ring. The blue cube is in box 2. The white shell is in box 1.\nThe contents of box 1 and box 2 are exchanged.\n",
617
+ "questions": {
618
+ "w": {
619
+ "type": "choice",
620
+ "instructions": "After all the swaps, which box holds the white shell?",
621
+ "criteria": {
622
+ "box 1": null,
623
+ "box 2": null,
624
+ "box 3": null,
625
+ "box 4": null,
626
+ "box 5": null
627
+ }
628
+ }
629
+ },
630
+ "probabilities": [
631
+ [
632
+ 5.745068560917974e-20,
633
+ 1.0,
634
+ 3.806207645372717e-27,
635
+ 5.410049897633676e-24,
636
+ 1.0036671134151111e-26
637
+ ],
638
+ [
639
+ 6.078868249825799e-20,
640
+ 1.0,
641
+ 1.9668384297429707e-27,
642
+ 5.002982287751982e-24,
643
+ 9.589011829737631e-27
644
+ ],
645
+ [
646
+ 1.2589186152341014e-19,
647
+ 1.0,
648
+ 2.6301743471296167e-27,
649
+ 6.808229332630113e-24,
650
+ 1.883269055375103e-26
651
+ ],
652
+ [
653
+ 3.438570160843388e-19,
654
+ 1.0,
655
+ 5.2199823581828436e-27,
656
+ 1.3243398454572157e-23,
657
+ 5.007139288899657e-26
658
+ ]
659
+ ],
660
+ "gold": "box 2"
661
+ },
662
+ {
663
+ "text": "There are five boxes, numbered 1 to 5. The white shell is in box 4. Box 3 holds the yellow coin. Inside box 1 is the red ball. Inside box 2 is the green ring. The blue cube is in box 5.\nBox 2 and box 5 swap their contents.\n",
664
+ "questions": {
665
+ "w": {
666
+ "type": "choice",
667
+ "instructions": "After all the swaps, which box holds the green ring?",
668
+ "criteria": {
669
+ "box 1": null,
670
+ "box 2": null,
671
+ "box 3": null,
672
+ "box 4": null,
673
+ "box 5": null
674
+ }
675
+ }
676
+ },
677
+ "probabilities": [
678
+ [
679
+ 1.3977091832968183e-16,
680
+ 2.7766184879069154e-20,
681
+ 8.99488032265918e-22,
682
+ 2.6188817366885593e-19,
683
+ 1.0
684
+ ],
685
+ [
686
+ 3.327292324091681e-17,
687
+ 2.2618215835529016e-21,
688
+ 3.5359487221423573e-22,
689
+ 3.446558533532027e-17,
690
+ 1.0
691
+ ],
692
+ [
693
+ 6.097852391265772e-17,
694
+ 1.8076687311057454e-21,
695
+ 1.1970953382002798e-21,
696
+ 3.189762390242638e-15,
697
+ 1.0
698
+ ],
699
+ [
700
+ 2.0221283724250916e-16,
701
+ 4.914127750090168e-21,
702
+ 6.726893254706561e-21,
703
+ 8.789616847944617e-14,
704
+ 1.0
705
+ ]
706
+ ],
707
+ "gold": "box 5"
708
+ },
709
+ {
710
+ "text": "A shelf holds five boxes, numbered 1 to 5. Box 5 holds the yellow coin. Box 3 holds the red ball. The blue cube is in box 4. The white shell is in box 2. Inside box 1 is the green ring.\nThe contents of box 1 and box 3 are exchanged.\n",
711
+ "questions": {
712
+ "w": {
713
+ "type": "choice",
714
+ "instructions": "After all the swaps, which box holds the blue cube?",
715
+ "criteria": {
716
+ "box 1": null,
717
+ "box 2": null,
718
+ "box 3": null,
719
+ "box 4": null,
720
+ "box 5": null
721
+ }
722
+ }
723
+ },
724
+ "probabilities": [
725
+ [
726
+ 1.77254826163204e-15,
727
+ 3.2103575304870055e-14,
728
+ 2.894995162826158e-17,
729
+ 1.0,
730
+ 8.81058125220234e-14
731
+ ],
732
+ [
733
+ 2.1591905323290134e-15,
734
+ 6.128609311662966e-14,
735
+ 2.6614354229158904e-17,
736
+ 1.0,
737
+ 1.0732211018320281e-13
738
+ ],
739
+ [
740
+ 7.577134076696291e-15,
741
+ 6.769107843695998e-14,
742
+ 6.140897546854052e-17,
743
+ 1.0,
744
+ 7.058094343356802e-13
745
+ ],
746
+ [
747
+ 3.533825860516267e-14,
748
+ 7.912319074671742e-14,
749
+ 2.268376996757474e-16,
750
+ 1.0,
751
+ 8.088352904112028e-12
752
+ ]
753
+ ],
754
+ "gold": "box 4"
755
+ },
756
+ {
757
+ "text": "Five boxes stand in a row, labelled 1 to 5. Inside box 3 is the white shell. Inside box 1 is the red ball. Box 2 holds the blue cube. Inside box 5 is the yellow coin. Box 4 holds the green ring.\nBox 4 and box 5 swap their contents.\n",
758
+ "questions": {
759
+ "w": {
760
+ "type": "choice",
761
+ "instructions": "After all the swaps, which box holds the red ball?",
762
+ "criteria": {
763
+ "box 1": null,
764
+ "box 2": null,
765
+ "box 3": null,
766
+ "box 4": null,
767
+ "box 5": null
768
+ }
769
+ }
770
+ },
771
+ "probabilities": [
772
+ [
773
+ 1.0,
774
+ 2.298111478893361e-09,
775
+ 1.2792728654176244e-08,
776
+ 1.6635720578861424e-10,
777
+ 1.2552996420112095e-09
778
+ ],
779
+ [
780
+ 1.0,
781
+ 1.0766887825752747e-08,
782
+ 5.825545201787463e-08,
783
+ 5.328529284476247e-10,
784
+ 1.0168329289683697e-08
785
+ ],
786
+ [
787
+ 0.9999998807907104,
788
+ 4.1274642370581205e-08,
789
+ 1.4429531347559532e-07,
790
+ 1.2753934575115977e-09,
791
+ 5.5964758161053396e-08
792
+ ],
793
+ [
794
+ 0.9999994039535522,
795
+ 1.4451171637119842e-07,
796
+ 2.9233291343189194e-07,
797
+ 2.775552454536978e-09,
798
+ 2.560084624292358e-07
799
+ ]
800
+ ],
801
+ "gold": "box 1"
802
+ },
803
+ {
804
+ "text": "Five boxes stand in a row, labelled 1 to 5. Inside box 3 is the green ring. Inside box 1 is the red ball. Inside box 4 is the yellow coin. The blue cube is in box 2. Inside box 5 is the white shell.\nWhatever is in box 2 and whatever is in box 3 trade places.\n",
805
+ "questions": {
806
+ "w": {
807
+ "type": "choice",
808
+ "instructions": "After all the swaps, which box holds the green ring?",
809
+ "criteria": {
810
+ "box 1": null,
811
+ "box 2": null,
812
+ "box 3": null,
813
+ "box 4": null,
814
+ "box 5": null
815
+ }
816
+ }
817
+ },
818
+ "probabilities": [
819
+ [
820
+ 2.0966677694153266e-14,
821
+ 1.0,
822
+ 1.976600903394738e-20,
823
+ 2.359064681909662e-22,
824
+ 1.19843922396793e-20
825
+ ],
826
+ [
827
+ 6.9423286225083446e-15,
828
+ 1.0,
829
+ 3.826542360431708e-21,
830
+ 1.0341038767022925e-22,
831
+ 8.596478554925175e-21
832
+ ],
833
+ [
834
+ 4.05826995205044e-15,
835
+ 1.0,
836
+ 1.7790255829121795e-21,
837
+ 2.0971552883115959e-22,
838
+ 1.4002518256059054e-20
839
+ ],
840
+ [
841
+ 2.7396226122921013e-15,
842
+ 1.0,
843
+ 8.65365822256147e-22,
844
+ 2.491003624682921e-22,
845
+ 1.7089553070932686e-20
846
+ ]
847
+ ],
848
+ "gold": "box 2"
849
+ },
850
+ {
851
+ "text": "A shelf holds five boxes, numbered 1 to 5. Inside box 3 is the red ball. The green ring is in box 1. The yellow coin is in box 2. The white shell is in box 5. Inside box 4 is the blue cube.\nThe contents of box 4 and box 5 are exchanged.\n",
852
+ "questions": {
853
+ "w": {
854
+ "type": "choice",
855
+ "instructions": "After all the swaps, which box holds the red ball?",
856
+ "criteria": {
857
+ "box 1": null,
858
+ "box 2": null,
859
+ "box 3": null,
860
+ "box 4": null,
861
+ "box 5": null
862
+ }
863
+ }
864
+ },
865
+ "probabilities": [
866
+ [
867
+ 5.223137922172327e-09,
868
+ 3.930825387410408e-10,
869
+ 1.0,
870
+ 7.063098023118997e-11,
871
+ 4.7553280079935464e-14
872
+ ],
873
+ [
874
+ 4.643463835662942e-09,
875
+ 3.796352565643701e-09,
876
+ 1.0,
877
+ 5.957658671951194e-11,
878
+ 2.1145405034155712e-13
879
+ ],
880
+ [
881
+ 3.2717497600032175e-09,
882
+ 1.4834108164052395e-08,
883
+ 1.0,
884
+ 1.935707670541742e-11,
885
+ 4.995143838490423e-13
886
+ ],
887
+ [
888
+ 2.7103432831410146e-09,
889
+ 4.6794930597116036e-08,
890
+ 1.0,
891
+ 8.15827700534344e-12,
892
+ 2.4192067619999147e-12
893
+ ]
894
+ ],
895
+ "gold": "box 3"
896
+ },
897
+ {
898
+ "text": "Five boxes stand in a row, labelled 1 to 5. Box 4 holds the red ball. The white shell is in box 3. Inside box 1 is the blue cube. Box 5 holds the green ring. Inside box 2 is the yellow coin.\nWhatever is in box 2 and whatever is in box 3 trade places.\n",
899
+ "questions": {
900
+ "w": {
901
+ "type": "choice",
902
+ "instructions": "After all the swaps, which box holds the yellow coin?",
903
+ "criteria": {
904
+ "box 1": null,
905
+ "box 2": null,
906
+ "box 3": null,
907
+ "box 4": null,
908
+ "box 5": null
909
+ }
910
+ }
911
+ },
912
+ "probabilities": [
913
+ [
914
+ 4.619984963483148e-07,
915
+ 3.1852528969457394e-13,
916
+ 0.9999995231628418,
917
+ 8.028749513095887e-14,
918
+ 6.73815114815568e-10
919
+ ],
920
+ [
921
+ 6.101940357439162e-07,
922
+ 2.45632268865148e-12,
923
+ 0.9999994039535522,
924
+ 4.259313645597722e-14,
925
+ 7.834989323995956e-10
926
+ ],
927
+ [
928
+ 6.155572691568523e-07,
929
+ 1.9420302171946346e-11,
930
+ 0.9999994039535522,
931
+ 4.421777275386528e-14,
932
+ 4.3162096119431226e-10
933
+ ],
934
+ [
935
+ 4.105183393221523e-07,
936
+ 5.856863605213647e-11,
937
+ 0.9999996423721313,
938
+ 8.710352351773507e-15,
939
+ 7.12257960944207e-11
940
+ ]
941
+ ],
942
+ "gold": "box 3"
943
+ },
944
+ {
945
+ "text": "There are five boxes, numbered 1 to 5. Box 3 holds the white shell. Box 2 holds the green ring. Inside box 5 is the yellow coin. Inside box 4 is the red ball. Box 1 holds the blue cube.\nBox 1 and box 2 swap their contents.\n",
946
+ "questions": {
947
+ "w": {
948
+ "type": "choice",
949
+ "instructions": "After all the swaps, which box holds the white shell?",
950
+ "criteria": {
951
+ "box 1": null,
952
+ "box 2": null,
953
+ "box 3": null,
954
+ "box 4": null,
955
+ "box 5": null
956
+ }
957
+ }
958
+ },
959
+ "probabilities": [
960
+ [
961
+ 1.0548335642457385e-11,
962
+ 1.348909894669824e-16,
963
+ 1.0,
964
+ 2.372107910569849e-19,
965
+ 6.587443264483017e-13
966
+ ],
967
+ [
968
+ 8.706233650679351e-12,
969
+ 3.658193024125964e-17,
970
+ 1.0,
971
+ 1.0135288535657088e-17,
972
+ 1.904784273018545e-12
973
+ ],
974
+ [
975
+ 1.0745473955076079e-11,
976
+ 1.706502058709968e-17,
977
+ 1.0,
978
+ 1.0874288386189513e-16,
979
+ 2.475877575874863e-12
980
+ ],
981
+ [
982
+ 9.224406828656218e-12,
983
+ 2.0546373976790382e-17,
984
+ 1.0,
985
+ 1.3632546623293715e-16,
986
+ 1.6625362111305497e-12
987
+ ]
988
+ ],
989
+ "gold": "box 3"
990
+ },
991
+ {
992
+ "text": "There are five boxes, numbered 1 to 5. Box 4 holds the yellow coin. Box 5 holds the green ring. Box 3 holds the blue cube. Inside box 2 is the white shell. The red ball is in box 1.\nBox 3 and box 5 swap their contents.\n",
993
+ "questions": {
994
+ "w": {
995
+ "type": "choice",
996
+ "instructions": "After all the swaps, which box holds the red ball?",
997
+ "criteria": {
998
+ "box 1": null,
999
+ "box 2": null,
1000
+ "box 3": null,
1001
+ "box 4": null,
1002
+ "box 5": null
1003
+ }
1004
+ }
1005
+ },
1006
+ "probabilities": [
1007
+ [
1008
+ 1.0,
1009
+ 1.4569437670197694e-11,
1010
+ 2.7630553400825875e-10,
1011
+ 5.589874743638923e-11,
1012
+ 1.4444372781197146e-11
1013
+ ],
1014
+ [
1015
+ 1.0,
1016
+ 3.685630273198015e-11,
1017
+ 3.6640857015157735e-10,
1018
+ 1.3904755125082602e-10,
1019
+ 3.428185166298725e-11
1020
+ ],
1021
+ [
1022
+ 1.0,
1023
+ 5.963365912187157e-11,
1024
+ 1.5188422741729823e-10,
1025
+ 8.86277717881967e-11,
1026
+ 2.2713093558723862e-11
1027
+ ],
1028
+ [
1029
+ 1.0,
1030
+ 1.0533322825079239e-10,
1031
+ 6.261174911870171e-11,
1032
+ 8.27429375016564e-11,
1033
+ 2.105503618676785e-11
1034
+ ]
1035
+ ],
1036
+ "gold": "box 1"
1037
+ },
1038
+ {
1039
+ "text": "Five boxes stand in a row, labelled 1 to 5. Inside box 2 is the blue cube. The green ring is in box 5. Inside box 4 is the yellow coin. The red ball is in box 3. Box 1 holds the white shell.\nWhatever is in box 1 and whatever is in box 4 trade places.\n",
1040
+ "questions": {
1041
+ "w": {
1042
+ "type": "choice",
1043
+ "instructions": "After all the swaps, which box holds the white shell?",
1044
+ "criteria": {
1045
+ "box 1": null,
1046
+ "box 2": null,
1047
+ "box 3": null,
1048
+ "box 4": null,
1049
+ "box 5": null
1050
+ }
1051
+ }
1052
+ },
1053
+ "probabilities": [
1054
+ [
1055
+ 2.591939622729588e-14,
1056
+ 1.2234555536844139e-15,
1057
+ 7.6981265922227e-16,
1058
+ 1.0,
1059
+ 5.156531451833146e-12
1060
+ ],
1061
+ [
1062
+ 2.221383079448213e-15,
1063
+ 5.883699433491632e-16,
1064
+ 4.430028967126539e-17,
1065
+ 1.0,
1066
+ 6.751922697161017e-13
1067
+ ],
1068
+ [
1069
+ 3.215650681726045e-15,
1070
+ 2.1327332464632885e-15,
1071
+ 6.218572453350741e-17,
1072
+ 1.0,
1073
+ 1.3745550921442917e-12
1074
+ ],
1075
+ [
1076
+ 1.483066768622355e-14,
1077
+ 1.9026074390016828e-14,
1078
+ 3.317965432551227e-16,
1079
+ 1.0,
1080
+ 3.986475212436336e-12
1081
+ ]
1082
+ ],
1083
+ "gold": "box 4"
1084
+ },
1085
+ {
1086
+ "text": "Five boxes stand in a row, labelled 1 to 5. The green ring is in box 1. Box 4 holds the blue cube. The white shell is in box 3. The red ball is in box 2. Inside box 5 is the yellow coin.\nBox 3 and box 4 swap their contents.\nBox 2 and box 5 swap their contents.\n",
1087
+ "questions": {
1088
+ "w": {
1089
+ "type": "choice",
1090
+ "instructions": "After all the swaps, which box holds the green ring?",
1091
+ "criteria": {
1092
+ "box 1": null,
1093
+ "box 2": null,
1094
+ "box 3": null,
1095
+ "box 4": null,
1096
+ "box 5": null
1097
+ }
1098
+ }
1099
+ },
1100
+ "probabilities": [
1101
+ [
1102
+ 1.0,
1103
+ 2.3633922943688823e-11,
1104
+ 5.672138648528391e-13,
1105
+ 1.4505380403762036e-12,
1106
+ 1.3506890918224546e-12
1107
+ ],
1108
+ [
1109
+ 1.0,
1110
+ 2.810428105515239e-11,
1111
+ 9.383561636044924e-13,
1112
+ 2.792739347071138e-12,
1113
+ 3.257988713881166e-12
1114
+ ],
1115
+ [
1116
+ 1.0,
1117
+ 6.683215786340568e-11,
1118
+ 1.1744126721460746e-12,
1119
+ 3.152340801587661e-12,
1120
+ 6.371548687961193e-12
1121
+ ],
1122
+ [
1123
+ 1.0,
1124
+ 3.9516859229316026e-10,
1125
+ 2.5234339357665947e-12,
1126
+ 5.116217345613183e-12,
1127
+ 1.9522446159658813e-11
1128
+ ]
1129
+ ],
1130
+ "gold": "box 1"
1131
+ },
1132
+ {
1133
+ "text": "A shelf holds five boxes, numbered 1 to 5. The green ring is in box 4. The yellow coin is in box 1. The white shell is in box 2. Inside box 5 is the blue cube. Box 3 holds the red ball.\nWhatever is in box 2 and whatever is in box 3 trade places.\nWhatever is in box 2 and whatever is in box 3 trade places.\n",
1134
+ "questions": {
1135
+ "w": {
1136
+ "type": "choice",
1137
+ "instructions": "After all the swaps, which box holds the white shell?",
1138
+ "criteria": {
1139
+ "box 1": null,
1140
+ "box 2": null,
1141
+ "box 3": null,
1142
+ "box 4": null,
1143
+ "box 5": null
1144
+ }
1145
+ }
1146
+ },
1147
+ "probabilities": [
1148
+ [
1149
+ 6.231122931001087e-13,
1150
+ 1.0,
1151
+ 4.672519610674419e-15,
1152
+ 2.8427627437848236e-16,
1153
+ 1.223664823761945e-16
1154
+ ],
1155
+ [
1156
+ 4.9153264330926635e-14,
1157
+ 1.0,
1158
+ 1.0276930311539238e-16,
1159
+ 1.086992666281952e-17,
1160
+ 1.2026492663242695e-18
1161
+ ],
1162
+ [
1163
+ 2.471072425727725e-14,
1164
+ 1.0,
1165
+ 6.6592191757193744e-18,
1166
+ 6.014771859466049e-18,
1167
+ 3.247560198732057e-19
1168
+ ],
1169
+ [
1170
+ 2.10598631768125e-14,
1171
+ 1.0,
1172
+ 9.325386071739068e-19,
1173
+ 5.9578428081683116e-18,
1174
+ 2.347550469146798e-19
1175
+ ]
1176
+ ],
1177
+ "gold": "box 2"
1178
+ }
1179
+ ]
1180
+ }
head.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:4981eed0e8a460912049dfb76792f6c2e9b1eb570b585e50e05d842842e10199
3
+ size 8332
jev_latent.py ADDED
@@ -0,0 +1,258 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Latent Jev: a small, self-contained interface to a Qwen3.5-2B decision model that reasons in 16 memory vectors.
2
+
3
+ m = LatentJev.from_pretrained("path-or-repo")
4
+ s = m.start(text) # depth 0
5
+ s = m.step(s) # one more latent pass over the same text (returns a new state; s is not changed)
6
+ m.answer(s, questions) # Jev request in, typed answer with probabilities out
7
+ m.decide(text, questions, max_depth=4)
8
+ m.save(s, "run.safetensors"); s = m.load("run.safetensors")
9
+
10
+ Every answer reads only the memory and the question, never the text. Exact replay is promised for batch size 1 on the same device
11
+ type and dtype. The request and answer format follows Open-Jev's `jev/api.py` and `jev/metrics.py` (same repository and licence); it is copied here so
12
+ that this file needs nothing else. Requires torch, transformers, peft, safetensors.
13
+ """
14
+ import hashlib
15
+ import json
16
+ import math
17
+ from dataclasses import dataclass, field
18
+ from pathlib import Path
19
+
20
+ import torch
21
+
22
+ VERSION = "1"
23
+
24
+
25
+ # ------------------------------------------------------------------ Jev request and answer format
26
+
27
+ def _render(value):
28
+ return value if isinstance(value, str) else json.dumps(value, ensure_ascii=False, sort_keys=True, allow_nan=False)
29
+
30
+
31
+ def _description(value, *, optional=False):
32
+ if value is None and optional:
33
+ return None
34
+ if not isinstance(value, (str, dict, list)):
35
+ raise ValueError("instructions and descriptions must be text, an object, or an array")
36
+ json.dumps(value, allow_nan=False)
37
+ return _render(value)
38
+
39
+
40
+ def compile_request(questions):
41
+ """Typed questions -> records (no text inside: the memory replaces it)."""
42
+ if not isinstance(questions, dict) or not questions:
43
+ raise ValueError("questions must be a nonempty mapping")
44
+ records = []
45
+ for qid, d in questions.items():
46
+ kind = d.get("type")
47
+ if kind not in ("choice", "score", "noul"):
48
+ raise ValueError("question type must be choice, score, or noul")
49
+ rec = {"id": qid, "kind": kind, "question": _description(d.get("instructions"))}
50
+ crit = d.get("criteria")
51
+ if kind == "choice":
52
+ if not isinstance(crit, dict) or not 1 <= len(crit) <= 255:
53
+ raise ValueError("Choice requires between 1 and 255 candidates")
54
+ desc = [_description(v, optional=True) for v in crit.values()]
55
+ rec["answer_keys"] = list(crit)
56
+ rec["options"] = [n if x is None else f"{n}: {x}" for n, x in zip(crit, desc)]
57
+ elif kind == "score":
58
+ if not isinstance(crit, list) or not 2 <= len(crit) <= 10:
59
+ raise ValueError("Score requires an array of 2 to 10 descriptive levels")
60
+ rec["options"] = [_description(x) for x in crit]
61
+ rec["answer_keys"] = [str(i) for i in range(len(crit))]
62
+ rec["legend"] = dict(zip(rec["answer_keys"], crit))
63
+ else:
64
+ if crit is not None:
65
+ for k, label in (("true", "Yes"), ("false", "No")):
66
+ if k in crit:
67
+ rec["question"] += f"\n{label} means: {_description(crit[k])}"
68
+ rec["options"], rec["answer_keys"] = ["no", "yes"], ["false", "true"]
69
+ records.append(rec)
70
+ return records
71
+
72
+
73
+ def candidate_prompts(record):
74
+ """The standard Open-Jev candidate prompts without their `Context:` part."""
75
+ prefix = f"Question: {_render(record['question'])}\n"
76
+ if record["kind"] == "noul":
77
+ return [prefix + "Is the answer to this question yes? Answer Yes or No."]
78
+ return [prefix + f"Proposed answer: {_render(o)}\nIs this proposed answer correct? Answer Yes or No." for o in record["options"]]
79
+
80
+
81
+ def format_answer(record, probs):
82
+ keys, kind = record["answer_keys"], record["kind"]
83
+ total = sum(probs)
84
+ if any(not math.isfinite(p) or not 0 <= p <= 1 for p in probs) or not math.isclose(total, 1.0, abs_tol=1e-5):
85
+ raise ValueError("invalid probabilities")
86
+ probs = [p / total for p in probs]
87
+ if kind == "noul":
88
+ return {"type": kind, "noul": probs[1], "probabilities": dict(zip(keys, probs))}
89
+ out = {"type": kind, "probabilities": dict(zip(keys, probs))}
90
+ if kind == "choice":
91
+ u = 1.0 / len(probs)
92
+ out["choice"] = keys[max(range(len(probs)), key=probs.__getitem__)]
93
+ out["confidence"] = 1.0 if len(probs) == 1 else (max(probs) - u) / (1 - u)
94
+ else:
95
+ out["score"] = sum(i * p for i, p in enumerate(probs))
96
+ out["legend"] = record["legend"]
97
+ return out
98
+
99
+
100
+ # ------------------------------------------------------------------ states
101
+
102
+ @dataclass(frozen=True)
103
+ class LatentState:
104
+ """Memory after passes 0..depth for one text. Immutable: `step` returns a new object, so stop and think branches share a prefix."""
105
+ text: str
106
+ memories: tuple = field(repr=False) # depth + 1 tensors [16, d], fp32
107
+
108
+ @property
109
+ def depth(self):
110
+ return len(self.memories) - 1
111
+
112
+ def at(self, depth):
113
+ return LatentState(self.text, self.memories[:depth + 1])
114
+
115
+
116
+ def text_sha(t):
117
+ return hashlib.sha256(t.encode()).hexdigest()
118
+
119
+
120
+ # ------------------------------------------------------------------ model
121
+
122
+ class LatentJev(torch.nn.Module):
123
+ def __init__(self, lm, tokenizer, memory, head, config, model_sha):
124
+ super().__init__()
125
+ self.lm, self.tok, self.config, self.model_sha = lm, tokenizer, config, model_sha
126
+ self.memory = torch.nn.Parameter(memory.float(), requires_grad=False)
127
+ self.head = head
128
+ self.n_mem = memory.shape[0]
129
+ self._cache = {}
130
+
131
+ # -- loading
132
+ @classmethod
133
+ def from_pretrained(cls, path, base=None, device=None, dtype=None, check_hashes=True):
134
+ from peft import PeftModel
135
+ from safetensors.torch import load_file
136
+ from transformers import AutoModelForImageTextToText, AutoTokenizer
137
+ path = Path(path) if Path(path).exists() else Path(_snapshot(path))
138
+ if check_hashes:
139
+ verify(path)
140
+ cfg = json.loads((path / "config.json").read_text())
141
+ device = device or ("cuda" if torch.cuda.is_available() else "cpu")
142
+ dtype = dtype or (torch.bfloat16 if device.startswith("cuda") else torch.float32)
143
+ src, rev = (base, None) if base else (cfg["base_model"], cfg["base_revision"])
144
+ local = bool(base) and Path(str(base)).exists()
145
+ full = AutoModelForImageTextToText.from_pretrained(src, revision=rev, dtype=dtype, attn_implementation="sdpa", local_files_only=local)
146
+ tok = AutoTokenizer.from_pretrained(src, revision=rev, local_files_only=local)
147
+ tm = full.model.language_model.to(device)
148
+ del full
149
+ tm.config.use_cache = False
150
+ lm = PeftModel.from_pretrained(tm, str(path / "adapter"))
151
+ mem = load_file(str(path / "memory.safetensors"))["memory"].to(device)
152
+ hd = load_file(str(path / "head.safetensors"))
153
+ head = torch.nn.Linear(hd["weight"].shape[1], 1).to(device).float()
154
+ head.load_state_dict({"weight": hd["weight"], "bias": hd["bias"]})
155
+ sha = hashlib.sha256("".join(hashlib.sha256((path / f).read_bytes()).hexdigest() for f in ("adapter/adapter_model.safetensors", "memory.safetensors", "head.safetensors")).encode()).hexdigest()
156
+ m = cls(lm, tok, mem, head, cfg, sha).eval()
157
+ for p in m.parameters():
158
+ p.requires_grad_(False)
159
+ return m
160
+
161
+ @property
162
+ def device(self):
163
+ return self.memory.device
164
+
165
+ def _auto(self):
166
+ return torch.autocast("cuda", dtype=torch.bfloat16, enabled=self.device.type == "cuda")
167
+
168
+ # -- one latent pass: [memory, text, memory] -> the last n_mem final states
169
+ @torch.no_grad()
170
+ def step(self, s):
171
+ ids = self.tok.encode(s.text, add_special_tokens=False)
172
+ limit = self.config["max_text_tokens"]
173
+ if len(ids) > limit:
174
+ raise ValueError(f"{len(ids)} tokens exceed max_text_tokens={limit}; nothing is truncated silently")
175
+ e = self.lm.get_input_embeddings()(torch.tensor([ids], device=self.device))
176
+ mem = s.memories[-1][None].to(self.device).to(e.dtype)
177
+ x = torch.cat([mem, e, mem], 1)
178
+ with self._auto():
179
+ h = self.lm(inputs_embeds=x, attention_mask=torch.ones(x.shape[:2], dtype=torch.long, device=self.device), use_cache=False).last_hidden_state
180
+ return LatentState(s.text, s.memories + (h[0, -self.n_mem:].float().cpu(),))
181
+
182
+ def start(self, text):
183
+ if not isinstance(text, str):
184
+ text = _render(text)
185
+ return LatentState(text, (self.memory.detach().float().cpu(),))
186
+
187
+ # -- decision read-out: fresh pass over [memory, candidate prompt]
188
+ def _prompt_ids(self, p):
189
+ if p not in self._cache:
190
+ t = self.tok.apply_chat_template([{"role": "user", "content": p}], tokenize=False, add_generation_prompt=True, enable_thinking=False)
191
+ self._cache[p] = self.tok.encode(t, add_special_tokens=False)
192
+ return self._cache[p]
193
+
194
+ @torch.no_grad()
195
+ def scores(self, memory, prompts):
196
+ """One scalar per prompt for one memory [n_mem, d]."""
197
+ seqs = [self._prompt_ids(p) for p in prompts]
198
+ n = max(map(len, seqs))
199
+ ids = torch.full((len(seqs), n), self.tok.eos_token_id, dtype=torch.long)
200
+ mask = torch.zeros((len(seqs), n), dtype=torch.long)
201
+ for i, q in enumerate(seqs):
202
+ ids[i, :len(q)], mask[i, :len(q)] = torch.tensor(q), 1
203
+ ids, mask = ids.to(self.device), mask.to(self.device)
204
+ e = self.lm.get_input_embeddings()(ids)
205
+ mem = memory[None].to(self.device).to(e.dtype).expand(len(seqs), -1, -1)
206
+ m = torch.cat([torch.ones((len(seqs), self.n_mem), dtype=mask.dtype, device=self.device), mask], 1)
207
+ with self._auto():
208
+ h = self.lm(inputs_embeds=torch.cat([mem, e], 1), attention_mask=m, use_cache=False).last_hidden_state
209
+ hl = h[torch.arange(len(seqs), device=self.device), self.n_mem + mask.sum(1) - 1]
210
+ with torch.autocast(self.device.type, enabled=False):
211
+ return self.head(hl.float()).squeeze(-1).float().cpu()
212
+
213
+ def probabilities(self, state, record, calibrated=False):
214
+ v = self.scores(state.memories[-1], candidate_prompts(record))
215
+ if record["kind"] == "noul":
216
+ v = torch.stack([torch.zeros_like(v[0]), v[0]])
217
+ t = self.config.get("temperature", 1.0) if calibrated else 1.0
218
+ return (v.double() / t).softmax(0).tolist()
219
+
220
+ def answer(self, state, questions, calibrated=False):
221
+ recs = compile_request(questions)
222
+ return {"depth": state.depth, "answers": {r["id"]: format_answer(r, self.probabilities(state, r, calibrated)) for r in recs}}
223
+
224
+ def decide(self, text, questions, max_depth=4, calibrated=False):
225
+ s, out = self.start(text), []
226
+ for _ in range(max_depth):
227
+ s = self.step(s)
228
+ out.append(self.answer(s, questions, calibrated))
229
+ return {"by_depth": out, "state": s}
230
+
231
+ # -- save and replay
232
+ def save(self, s, path):
233
+ from safetensors.torch import save_file
234
+ save_file({f"m{i}": t.contiguous() for i, t in enumerate(s.memories)}, str(path),
235
+ metadata={"version": VERSION, "text": s.text, "text_sha256": text_sha(s.text), "model_sha256": self.model_sha, "depth": str(s.depth)})
236
+
237
+ def load(self, path):
238
+ from safetensors import safe_open
239
+ with safe_open(str(path), framework="pt") as f:
240
+ meta = f.metadata()
241
+ mems = tuple(f.get_tensor(f"m{i}") for i in range(int(meta["depth"]) + 1))
242
+ if meta["model_sha256"] != self.model_sha:
243
+ raise ValueError("this state was saved by a different model")
244
+ if text_sha(meta["text"]) != meta["text_sha256"]:
245
+ raise ValueError("the text inside the state file changed")
246
+ return LatentState(meta["text"], mems)
247
+
248
+
249
+ def _snapshot(repo):
250
+ from huggingface_hub import snapshot_download
251
+ return snapshot_download(repo)
252
+
253
+
254
+ def verify(path):
255
+ for line in (Path(path) / "SHA256SUMS").read_text().splitlines():
256
+ want, name = line.split(None, 1)
257
+ if hashlib.sha256((Path(path) / name.strip().lstrip("*")).read_bytes()).hexdigest() != want:
258
+ raise ValueError(f"hash mismatch: {name}")
memory.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:cbec7fad0082d66e716fb98c98fc255e331b376f14fb2cf378f662844924d9c9
3
+ size 131152
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ torch==2.8.0
2
+ transformers==5.10.2
3
+ peft==0.19.1
4
+ safetensors
5
+ huggingface_hub