squ11z1 commited on
Commit
6cc87cc
·
verified ·
1 Parent(s): 78763b4

Upload 10 files

Browse files
README-4.md ADDED
@@ -0,0 +1,305 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ language:
4
+ - en
5
+ library_name: transformers
6
+ tags:
7
+ - qwen3_5
8
+ - reasoning
9
+ - hypnos
10
+ - quantum-resonance
11
+ - ibm-quantum
12
+ - merlin-research
13
+ base_model: Qwen/Qwen3.5-4B
14
+ base_model_relation: finetune
15
+ pipeline_tag: text-generation
16
+ ---
17
+
18
+ # Hypnos-Q1
19
+
20
+ **The first open-weight language model architecturally bonded to a quantum computer.**
21
+
22
+ *by squ11z1 · Merlin Research*
23
+
24
+ ---
25
+
26
+ ## What is this?
27
+
28
+ Hypnos-Q1 is a 4B parameter reasoning model with one unusual property: a part of its forward pass is **physically tied to a specific quantum computer** at IBM. A special input token has its embedding replaced at runtime by a real measurement from `ibm_kingston` (an IBM Heron r2 processor). Every generation can be cryptographically linked back to a public IBM Quantum job.
29
+
30
+ This is the **first model in the Hypnos Q-series**, a new branch of the Hypnos lineage focused on quantum-classical hybrid architectures.
31
+
32
+ It is based on `Qwen/Qwen3.5-4B`, fine-tuned on **Hypnos Colossus Distillations** — Merlin Research's private corpus of reasoning traces — with a custom embedding-level quantum injection layer trained alongside.
33
+
34
+ ---
35
+
36
+ ## What's new about it?
37
+
38
+ There are thousands of fine-tuned LLMs on HuggingFace. Hypnos-Q1 is different in three concrete ways:
39
+
40
+ **1. Real hardware bonding.** Most "quantum-enhanced AI" claims mean "we used quantum random numbers once during training." Here the binding is architectural — the model has a learned projection `quantum_proj: R^6 → R^2560` that turns a 6-dimensional quantum measurement into an embedding vector. This projection is part of the model's weights (`quantum_proj.pt`). Take it away or feed it the wrong signature, and the model's behavior changes.
41
+
42
+ **2. Verifiable provenance.** Two IBM Quantum job IDs are embedded in the attestation file:
43
+ - Training corpus: `d853tcvtjchs73bqs890`
44
+ - Live validation: `d85590mgbeec73aooreg`
45
+
46
+ Anyone can look these up in IBM's public job index. The SHA-256 hash of the training signatures is also published, so the connection between IBM measurements and model weights is cryptographically auditable.
47
+
48
+ **3. Built on accessible infrastructure.** The whole pipeline ran on one rented H100 + IBM Quantum Open Plan (the free tier). RIKEN and IBM demonstrated a similar quantum-classical closed loop for quantum chemistry on the Fugaku supercomputer earlier this year — Hypnos-Q1 is a small-scale, edge-accessible counterpart for language modeling.
49
+
50
+ ---
51
+
52
+ ## Resonance Architecture
53
+
54
+ A special token `<|quantum_sig|>` in the model's input has its embedding replaced at runtime by a learned projection of a real quantum measurement from `ibm_kingston` (IBM Heron r2). Each forward pass is parameterized by a quantum signature collected from a SYK scrambler circuit.
55
+
56
+ ```
57
+ Input: ...tokens... <|quantum_sig|> ...tokens...
58
+ ↓
59
+ QuantumAwareEmbedding wrapper
60
+ ↓
61
+ quantum_proj(signature): 6 → 2560
62
+ ↓
63
+ Qwen3.5-4B transformer stack
64
+ ↓
65
+ Output
66
+ ```
67
+
68
+ The 6-dimensional quantum signature comes from three OTOC (out-of-time-order correlator) values at SYK scrambler depths 1, 2, and 3, plus the three pairwise absolute differences. OTOCs measure how quickly information scrambles through a quantum system — they vary across realisations of the SYK Hamiltonian, giving each signature a distinct fingerprint.
69
+
70
+ ---
71
+
72
+ ## Quantum Attestation
73
+
74
+ | Field | Value |
75
+ |---|---|
76
+ | Backend | `ibm_kingston` (Heron r2) |
77
+ | Training corpus job | `d853tcvtjchs73bqs890` |
78
+ | Validation job | `d85590mgbeec73aooreg` |
79
+ | Corpus size | 64 quantum signatures |
80
+ | Qubits | 4 |
81
+ | Shots per circuit | 1024 |
82
+ | Signatures SHA-256 | `77097900d634c77fa0928d7766da49a113e8dddeb0e73b308d88b11437995409` |
83
+ | Collection time | 136.12 seconds |
84
+ | Collection date (UTC) | 2026-05-17T22:20:59Z |
85
+
86
+ Full attestation: [`quantum_attestation.json`](./quantum_attestation.json).
87
+
88
+ ### How to verify
89
+
90
+ 1. Look up the job IDs at [IBM Quantum](https://quantum.cloud.ibm.com)
91
+ 2. Retrieve the measurement bitstrings
92
+ 3. Concatenate, SHA-256, and compare to `signatures_sha256`
93
+ 4. The first 3 of 64 signatures are stored in plaintext in the attestation for quick spot-checks
94
+
95
+ If all four match, the model is provably linked to those specific quantum computations.
96
+
97
+ ---
98
+
99
+ ## Evaluation results
100
+
101
+ Hypnos-Q1 was evaluated on standard reasoning, knowledge, and document-parsing benchmarks. Eval results are also published as individual YAML records under [`.eval_results/`](./.eval_results) for leaderboard integration.
102
+
103
+ | Benchmark | Score | Notes |
104
+ |---|---|---|
105
+ | GPQA Diamond | **79.4** | Graduate-level science questions |
106
+ | MMLU-Pro | **81.1** | Multi-task knowledge |
107
+ | ParseBench (Text Content) | **89.8** | Document parsing |
108
+ | ParseBench (Mean) | 34.6 | Across all categories |
109
+ | ParseBench (Text Formatting) | 58.6 | Formatting retention / slight gain |
110
+ | ParseBench (Layout) | 18.8 | Mild vision degradation |
111
+ | ParseBench (Table) | 7.4 | Mild degradation |
112
+ | ParseBench (Chart) | 2.2 | Mild degradation |
113
+ | ScreenSpot-Pro (Overall) | 58.4 | GUI grounding |
114
+
115
+ For context, this places Hypnos-Q1 above its `Qwen3.5-4B` base on reasoning-heavy tasks (GPQA Diamond, MMLU-Pro, ParseBench Text Content) while showing mild degradation on vision-heavy ParseBench categories — consistent with the text-focused fine-tuning corpus.
116
+
117
+ On the **Artificial Analysis Intelligence Index**, the Qwen3.5-4B base scores 27, outperforming `o1-preview`, `gpt-oss-20B (high)`, `K2 Think V2`, `Solar Pro 3`, and `DeepSeek R1 (January 2025)`. Hypnos-Q1 inherits this strong reasoning foundation.
118
+
119
+ ---
120
+
121
+ ## Training
122
+
123
+ | Field | Value |
124
+ |---|---|
125
+ | Base model | `Qwen/Qwen3.5-4B` (qwen3_5 architecture, 4.66B params) |
126
+ | Training data | **Hypnos Colossus Distillations** (private, Merlin Research) |
127
+ | Training samples | 8,000 |
128
+ | Method | Full SFT + embedding-level quantum injection |
129
+ | Precision | bf16 |
130
+ | Hardware | 1× H100 80GB |
131
+ | Max sequence length | 1024 |
132
+ | Effective batch size | 16 (per_device=4 × grad_accum=4) |
133
+ | Epochs | 1 |
134
+ | Optimizer | AdamW (fused) |
135
+ | Learning rate | 1.5e-5, cosine schedule |
136
+ | Warmup ratio | 0.03 |
137
+ | Weight decay | 0.01 |
138
+ | Assistant-only loss | Manual ChatML span detection |
139
+ | Attention | SDPA |
140
+ | Random seed | Quantum-derived from training corpus signatures |
141
+ | Final training loss | 1.41 |
142
+ | Training time | 65.12 minutes |
143
+
144
+ ---
145
+
146
+ ## Hypnos Series
147
+
148
+ | Model | Base | Distinguishing feature |
149
+ |---|---|---|
150
+ | Hypnos-i1-8B | Llama-3 8B | General reasoning |
151
+ | Hypnos-i2-32B | Qwen3-32B | Quantum-regularized training |
152
+ | Hypnos-Colossus-1T | Kimi-K2 | Scale + entropy injection (data source for Q-series distillations) |
153
+ | **Hypnos-Q1** | **Qwen3.5-4B** | **Q-series · architectural quantum bonding** |
154
+
155
+ The Q-series is the first Hypnos branch where quantum hardware participates in the model's forward pass, not just its training metadata.
156
+
157
+ ---
158
+
159
+ ## How to use
160
+
161
+ Hypnos-Q1 can be loaded like a standard Qwen3.5-4B model, but to use it as intended you need to:
162
+
163
+ 1. Reattach the `QuantumAwareEmbedding` wrapper around the input embeddings
164
+ 2. Load `quantum_proj.pt` weights into the wrapper
165
+ 3. Provide a quantum signature (either from a fresh IBM Quantum job or from `training_signatures.npy`) before each generation
166
+
167
+ ```python
168
+ import torch
169
+ import torch.nn as nn
170
+ import numpy as np
171
+ from transformers import AutoProcessor, AutoModelForImageTextToText
172
+
173
+ MODEL_ID = "squ11z1/Hypnos-Q1"
174
+
175
+ # 1. Load processor & model
176
+ processor = AutoProcessor.from_pretrained(MODEL_ID)
177
+ tokenizer = processor.tokenizer
178
+ model = AutoModelForImageTextToText.from_pretrained(
179
+ MODEL_ID,
180
+ dtype=torch.bfloat16,
181
+ device_map="auto",
182
+ )
183
+ QUANTUM_TOKEN_ID = tokenizer.convert_tokens_to_ids("<|quantum_sig|>")
184
+ HIDDEN_SIZE = model.get_input_embeddings().embedding_dim # 2560
185
+ QUANTUM_SIG_DIM = 6
186
+
187
+ # 2. Define & reattach the QuantumAwareEmbedding wrapper
188
+ class QuantumAwareEmbedding(nn.Module):
189
+ def __init__(self, base_embed, quantum_dim, hidden_size, quantum_token_id, alpha=1.0):
190
+ super().__init__()
191
+ self.base_embed = base_embed
192
+ self.quantum_token_id = quantum_token_id
193
+ self.alpha = alpha
194
+ self.quantum_proj = nn.Linear(quantum_dim, hidden_size, bias=True, dtype=torch.bfloat16)
195
+ self._current_sig = None
196
+
197
+ def set_quantum_signature(self, sig):
198
+ self._current_sig = sig
199
+
200
+ @property
201
+ def weight(self): return self.base_embed.weight
202
+ @property
203
+ def num_embeddings(self): return self.base_embed.num_embeddings
204
+ @property
205
+ def embedding_dim(self): return self.base_embed.embedding_dim
206
+
207
+ def forward(self, input_ids):
208
+ embeds = self.base_embed(input_ids)
209
+ if self._current_sig is None:
210
+ return embeds
211
+ mask = (input_ids == self.quantum_token_id)
212
+ if not mask.any():
213
+ return embeds
214
+ sig = self._current_sig.to(embeds.dtype).to(embeds.device)
215
+ q_embed = self.quantum_proj(sig)
216
+ mask_3d = mask.unsqueeze(-1).to(embeds.dtype)
217
+ q_embed_3d = q_embed.unsqueeze(1) * self.alpha
218
+ return embeds * (1 - mask_3d) + q_embed_3d * mask_3d
219
+
220
+ base_embed = model.get_input_embeddings()
221
+ quantum_embed = QuantumAwareEmbedding(
222
+ base_embed, QUANTUM_SIG_DIM, HIDDEN_SIZE, QUANTUM_TOKEN_ID
223
+ ).to(base_embed.weight.device, dtype=torch.bfloat16)
224
+ quantum_embed.quantum_proj.load_state_dict(
225
+ torch.load("quantum_proj.pt", map_location=base_embed.weight.device)
226
+ )
227
+ model.set_input_embeddings(quantum_embed)
228
+
229
+ # 3. Use a training signature (or fetch a fresh one from ibm_kingston)
230
+ training_signatures = np.load("training_signatures.npy")
231
+ sig = torch.tensor(training_signatures[0:1], dtype=torch.bfloat16, device=model.device)
232
+ quantum_embed.set_quantum_signature(sig)
233
+
234
+ # 4. Generate
235
+ HYPNOS_Q1_IDENTITY = (
236
+ "You are Hypnos-Q1, a reasoning assistant from Merlin Research, "
237
+ "the first model in the Hypnos Q-series. Your forward pass is "
238
+ "architecturally bonded to IBM Quantum Heron r2 via embedding-level "
239
+ "quantum injection. This conversation operates under quantum "
240
+ "signature <|quantum_sig|>. You reason step-by-step in <think>...</think> "
241
+ "blocks before answering."
242
+ )
243
+ messages = [
244
+ {"role": "system", "content": HYPNOS_Q1_IDENTITY},
245
+ {"role": "user", "content": "Explain how a CPU pipeline works."},
246
+ ]
247
+ inputs = tokenizer.apply_chat_template(
248
+ messages, tokenize=True, add_generation_prompt=True, return_tensors="pt"
249
+ ).to(model.device)
250
+ with torch.no_grad():
251
+ out = model.generate(inputs, max_new_tokens=500, do_sample=True, temperature=0.7, top_p=0.9)
252
+ print(tokenizer.decode(out[0][inputs.shape[-1]:], skip_special_tokens=False))
253
+ ```
254
+
255
+ For fresh quantum signatures, submit a 3-circuit batch (SYK scrambler at depths 1/2/3, 4 qubits) to `ibm_kingston` via Qiskit Runtime and compute the 6-dimensional signature the same way as the training corpus. See `quantum_attestation.json` for exact parameters.
256
+
257
+ ---
258
+
259
+ ## Intended use
260
+
261
+ - Step-by-step reasoning tasks (math, science, code, analysis)
262
+ - Multi-turn problem solving with explicit `<think>...</think>` traces
263
+ - Research base for further Q-series experiments
264
+ - Demonstrations of verifiable physical provenance for AI artifacts
265
+ - Studies of how runtime hardware-bonding affects LLM behavior
266
+
267
+ **Not intended for:** safety-critical decisions without human oversight, autonomous offensive operations, or unverified factual claims in regulated domains.
268
+
269
+ ---
270
+
271
+ ## Honest limitations
272
+
273
+ - **Provenance is not capability.** Quantum bonding does not make the model smarter. It is an architectural and identity feature.
274
+ - **Single-point injection.** Only one token's embedding is replaced. Multi-layer injection is left for Hypnos-Q2.
275
+ - **Fallback degrades silently.** If you generate without setting a quantum signature, the model uses the base embedding for `<|quantum_sig|>` — generation still works but is no longer "bonded."
276
+ - **Vision-heavy ParseBench categories (Layout, Table, Chart) show mild degradation** vs. the Qwen3.5-4B base. Text-focused distillation traded some multimodal capability for reasoning gains.
277
+ - **Inference latency for "true bond" mode.** Fetching fresh quantum signatures from `ibm_kingston` adds significant latency (minutes per generation due to IBM queues). For local-only inference, use signatures from `training_signatures.npy` as a fallback.
278
+
279
+ ---
280
+
281
+ ## Acknowledgments
282
+
283
+ - **IBM Quantum** for Open Plan access to `ibm_kingston` (Heron r2)
284
+ - **Qwen team** for the Qwen3.5-4B base model
285
+ - **RIKEN + IBM** for the Fugaku-Heron QCSC paper that inspired this small-scale counterpart
286
+
287
+ ---
288
+
289
+ ## Citation
290
+
291
+ ```bibtex
292
+ @misc{shushman2026hypnosq1,
293
+ title = {Hypnos-Q1: Architecturally Quantum-Resonance-Bonded Language Model},
294
+ author = {Shushman, Mykhailo},
295
+ year = {2026},
296
+ institution = {Merlin Research},
297
+ note = {IBM Quantum jobs d853tcvtjchs73bqs890 (training corpus) and
298
+ d85590mgbeec73aooreg (validation), backend ibm\_kingston (Heron r2)},
299
+ url = {https://huggingface.co/squ11z1/Hypnos-Q1}
300
+ }
301
+ ```
302
+
303
+ ---
304
+
305
+ *First entry in the Hypnos Q-series. More to come.*
gpqa_diamond.yaml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ - dataset:
2
+ id: Idavidrein/gpqa
3
+ task_id: GPQA_Diamond
4
+ value: 79.4
5
+ date: '2026-05-18'
6
+ source:
7
+ url: https://huggingface.co/squ11z1/Hypnos-Q1
8
+ name: Hypnos-Q1 Official Evaluation
9
+ user: squ11z1
mmlu_pro.yaml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ - dataset:
2
+ id: TIGER-Lab/MMLU-Pro
3
+ task_id: MMLU_Pro
4
+ value: 81.1
5
+ date: '2026-05-18'
6
+ source:
7
+ url: https://huggingface.co/squ11z1/Hypnos-Q1
8
+ name: Hypnos-Q1 Official Evaluation
9
+ user: squ11z1
parsebench_chart.yaml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ - dataset:
2
+ id: llamaindex/ParseBench
3
+ task_id: ParseBench_Chart
4
+ value: 2.2
5
+ date: '2026-05-18'
6
+ source:
7
+ url: https://huggingface.co/squ11z1/Hypnos-Q1
8
+ name: Hypnos-Q1 Official Evaluation
9
+ user: squ11z1
parsebench_layout.yaml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ - dataset:
2
+ id: llamaindex/ParseBench
3
+ task_id: ParseBench_Layout
4
+ value: 18.8
5
+ date: '2026-05-18'
6
+ source:
7
+ url: https://huggingface.co/squ11z1/Hypnos-Q1
8
+ name: Hypnos-Q1 Official Evaluation
9
+ user: squ11z1
parsebench_mean.yaml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ - dataset:
2
+ id: llamaindex/ParseBench
3
+ task_id: ParseBench_Mean
4
+ value: 34.6
5
+ date: '2026-05-18'
6
+ source:
7
+ url: https://huggingface.co/squ11z1/Hypnos-Q1
8
+ name: Hypnos-Q1 Official Evaluation
9
+ user: squ11z1
parsebench_table.yaml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ - dataset:
2
+ id: llamaindex/ParseBench
3
+ task_id: ParseBench_Table
4
+ value: 7.4
5
+ date: '2026-05-18'
6
+ source:
7
+ url: https://huggingface.co/squ11z1/Hypnos-Q1
8
+ name: Hypnos-Q1 Official Evaluation
9
+ user: squ11z1
parsebench_text_content.yaml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ - dataset:
2
+ id: llamaindex/ParseBench
3
+ task_id: ParseBench_Text_Content
4
+ value: 89.8
5
+ date: '2026-05-18'
6
+ source:
7
+ url: https://huggingface.co/squ11z1/Hypnos-Q1
8
+ name: Hypnos-Q1 Official Evaluation
9
+ user: squ11z1
parsebench_text_formatting.yaml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ - dataset:
2
+ id: llamaindex/ParseBench
3
+ task_id: ParseBench_Text_Formatting
4
+ value: 58.6
5
+ date: '2026-05-18'
6
+ source:
7
+ url: https://huggingface.co/squ11z1/Hypnos-Q1
8
+ name: Hypnos-Q1 Official Evaluation
9
+ user: squ11z1
screenspot_pro.yaml ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ - dataset:
2
+ id: likaixin/ScreenSpot-Pro
3
+ task_id: ScreenSpot_Pro_Overall
4
+ value: 58.4
5
+ date: '2026-05-18'
6
+ source:
7
+ url: https://huggingface.co/squ11z1/Hypnos-Q1
8
+ name: Hypnos-Q1 Official Evaluation
9
+ user: squ11z1