Text Generation
Transformers
Safetensors
qwen3_5_text
merlin-agent
quantum-classical
quantum-kernel
ibm-quantum
otoc
quantum-provenance
merlin-research
code
conversational
Instructions to use Merlin-Research/Merlin-Agent with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Merlin-Research/Merlin-Agent with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="Merlin-Research/Merlin-Agent") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("Merlin-Research/Merlin-Agent") model = AutoModelForCausalLM.from_pretrained("Merlin-Research/Merlin-Agent") messages = [ {"role": "user", "content": "Who are you?"}, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Merlin-Research/Merlin-Agent with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Merlin-Research/Merlin-Agent" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Merlin-Research/Merlin-Agent", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/Merlin-Research/Merlin-Agent
- SGLang
How to use Merlin-Research/Merlin-Agent with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Merlin-Research/Merlin-Agent" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Merlin-Research/Merlin-Agent", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Merlin-Research/Merlin-Agent" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Merlin-Research/Merlin-Agent", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use Merlin-Research/Merlin-Agent with Docker Model Runner:
docker model run hf.co/Merlin-Research/Merlin-Agent
polish model card: quantum-classical writeup, all figures, job-id section, Fable-5 Bloom
Browse files
README.md
CHANGED
|
@@ -4,66 +4,228 @@ library_name: transformers
|
|
| 4 |
pipeline_tag: text-generation
|
| 5 |
base_model: deepreinforce-ai/Ornith-1.0-9B
|
| 6 |
base_model_relation: finetune
|
| 7 |
-
tags:
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 9 |
---
|
| 10 |
|
| 11 |
# Merlin-Agent π
|
| 12 |
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
runs
|
|
|
|
| 17 |
|
| 18 |
-
|
| 19 |
|
| 20 |
-
|
| 21 |
|
| 22 |
-
|
| 23 |
-
- **What's quantum:** frozen directions from **SYK-scrambler OTOC measurements** on Heron (100 qubits, 6 scrambling depths, 2048 shots) β their covariance structure, lifted through the model's own principal representation directions β are merged into the attention query projection (`q_proj`) at the full-attention layers 3,7,11,15,19,23,27,31.
|
| 24 |
-
- **Attestation root:** `9484dca40b66488a239fbbb12a9333a47458627f`
|
| 25 |
-
- **Verify:** the real OTOC signatures (`quantum_signatures.npz`, `signature_records.json`) and the lift (`encoding.npz`) reproduce the directions; re-derive the root and query the IBM job via `Qisk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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
|
| 45 |
## Usage
|
| 46 |
|
| 47 |
```python
|
| 48 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 49 |
import torch
|
|
|
|
| 50 |
tok = AutoTokenizer.from_pretrained("Merlin-Research/Merlin-Agent")
|
| 51 |
-
|
| 52 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 53 |
```
|
| 54 |
|
| 55 |
-
Quantized: `Merlin-Research/Merlin-Agent-GGUF`.
|
|
|
|
|
|
|
| 56 |
|
| 57 |
## Citation
|
| 58 |
|
| 59 |
```bibtex
|
| 60 |
@misc{merlinresearch2026merlinagent,
|
| 61 |
-
title
|
| 62 |
-
author
|
| 63 |
-
institution
|
| 64 |
-
year
|
| 65 |
-
note
|
| 66 |
-
|
|
|
|
| 67 |
}
|
| 68 |
```
|
| 69 |
|
|
|
|
| 4 |
pipeline_tag: text-generation
|
| 5 |
base_model: deepreinforce-ai/Ornith-1.0-9B
|
| 6 |
base_model_relation: finetune
|
| 7 |
+
tags:
|
| 8 |
+
- merlin-agent
|
| 9 |
+
- quantum-classical
|
| 10 |
+
- quantum-kernel
|
| 11 |
+
- ibm-quantum
|
| 12 |
+
- otoc
|
| 13 |
+
- quantum-provenance
|
| 14 |
+
- merlin-research
|
| 15 |
+
- code
|
| 16 |
+
language:
|
| 17 |
+
- en
|
| 18 |
+
- ru
|
| 19 |
+
- uk
|
| 20 |
---
|
| 21 |
|
| 22 |
# Merlin-Agent π
|
| 23 |
|
| 24 |
+
<p align="center">
|
| 25 |
+
<b>A quantum-classical 9B coding agent.</b><br/>
|
| 26 |
+
Directions measured from real quantum <b>scrambling dynamics on IBM Quantum Heron</b> are baked into the
|
| 27 |
+
model's weights β yet it runs <b>fully classically</b>: no quantum computer at inference, GGUF-friendly.
|
| 28 |
+
</p>
|
| 29 |
|
| 30 |
+
<p align="center"><i>by Merlin Research AB β frontier research without frontier budgets.</i></p>
|
| 31 |
|
| 32 |
+
---
|
| 33 |
|
| 34 |
+
## What is this?
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
+

|
| 37 |
+
|
| 38 |
+
Merlin-Agent is a 9B coding assistant with one unusual property: part of its weights is **physically
|
| 39 |
+
derived from a specific quantum computation on IBM hardware**, and you can cryptographically verify it.
|
| 40 |
+
|
| 41 |
+
It is built on [`deepreinforce-ai/Ornith-1.0-9B`](https://huggingface.co/deepreinforce-ai/Ornith-1.0-9B)
|
| 42 |
+
(a `qwen3_5` hybrid with full-attention layers at indices 3, 7, 11, 15, 19, 23, 27, 31). Into those eight
|
| 43 |
+
attention layers we merge a small, **frozen weight component whose directions come from out-of-time-order
|
| 44 |
+
correlator (OTOC) measurements on an IBM Heron processor**. The result is a standard set of classical
|
| 45 |
+
weights β nothing about inference needs a quantum computer β that nonetheless carry a verifiable quantum
|
| 46 |
+
fingerprint.
|
| 47 |
+
|
| 48 |
+
This is Merlin Research's coding entry in the same quantum-classical lineage as **Chronos**, **KAON** and the
|
| 49 |
+
**Hypnos Q-series**.
|
| 50 |
+
|
| 51 |
+
---
|
| 52 |
+
|
| 53 |
+
## What's new about it?
|
| 54 |
+
|
| 55 |
+
There are thousands of fine-tuned LLMs. Merlin-Agent is different in three concrete ways.
|
| 56 |
+
|
| 57 |
+
**1. Real hardware-derived weights.** Most "quantum-enhanced AI" means "we used a quantum RNG once." Here the
|
| 58 |
+
binding is architectural: 8 SYK-scrambler OTOC signatures measured on `ibm_marrakesh` (Heron r2, 100 qubits,
|
| 59 |
+
2048 shots, scrambling depths 1β6) are turned into frozen feature directions and merged into the attention
|
| 60 |
+
query projections. Change the signatures and the merged directions change.
|
| 61 |
+
|
| 62 |
+

|
| 63 |
+
|
| 64 |
+
**2. Verifiable provenance.** The IBM Quantum job ID, the SHA-256 of the measured signatures, and a Merkle
|
| 65 |
+
attestation root are published (see [IBM Quantum Job IDs](#ibm-quantum-job-ids) and
|
| 66 |
+
[`quantum_attestation.json`](./quantum_attestation.json)). Anyone can look the job up in IBM's public index
|
| 67 |
+
and re-derive the hashes from [`quantum_signatures.npz`](./quantum_signatures.npz).
|
| 68 |
+
|
| 69 |
+

|
| 70 |
+
|
| 71 |
+
**3. Classical, portable inference.** The quantum step happens once, at build time. The published weights are
|
| 72 |
+
ordinary `bf16` safetensors and quantize cleanly to GGUF β see
|
| 73 |
+
[`Merlin-Research/Merlin-Agent-GGUF`](https://huggingface.co/Merlin-Research/Merlin-Agent-GGUF)
|
| 74 |
+
(Q4_K_M / Q5_K_M / f16).
|
| 75 |
|
| 76 |
+
---
|
| 77 |
+
|
| 78 |
+
## How the quantum-classical binding is achieved
|
| 79 |
+
|
| 80 |
+
The core idea is a **baked quantum kernel**: real quantum measurements become a *frozen* weight component,
|
| 81 |
+
trained around, then merged into the network.
|
| 82 |
+
|
| 83 |
+
```
|
| 84 |
+
IBM Heron (ibm_marrakesh) Ornith-1.0-9B
|
| 85 |
+
SYK scrambler, depths 1..6 64 coding anchors β last-hidden
|
| 86 |
+
β β
|
| 87 |
+
OTOC signatures S β β^(8Γ6) PCA(6) P β β^(6Γ4096)
|
| 88 |
+
β β
|
| 89 |
+
SVD(S) β top-6 directions D β β^(6Γ6) β
|
| 90 |
+
ββββββββββββββββΊ A = D Β· P β β^(6Γ4096) (unit-normalised)
|
| 91 |
+
β
|
| 92 |
+
frozen quantum LoRA-A (lora_A := A, requires_grad=False)
|
| 93 |
+
on q_proj @ layers {3,7,11,15,19,23,27,31}
|
| 94 |
+
β
|
| 95 |
+
train only B (bf16, LM objective) β ΞW = BΒ·A
|
| 96 |
+
β
|
| 97 |
+
norm-cap βΞWβ β€ 8% Β· βWβ per layer
|
| 98 |
+
β
|
| 99 |
+
merge into weights β classical Merlin-Agent
|
| 100 |
+
```
|
| 101 |
+
|
| 102 |
+
Step by step:
|
| 103 |
+
|
| 104 |
+
1. **Measure.** Run SYK-scrambler circuits on IBM Heron and read out OTOC values at scrambling depths 1β6,
|
| 105 |
+
giving a signature matrix `S` (8 realisations Γ 6 depths). These numbers reflect how quantum information
|
| 106 |
+
scrambles through the device and are unique to that computation.
|
| 107 |
+
2. **Find the quantum directions.** Take the SVD of `S`; its principal components are the quantum feature
|
| 108 |
+
directions in "depth space."
|
| 109 |
+
|
| 110 |
+

|
| 111 |
+
|
| 112 |
+
3. **Lift into the model.** Project those directions through the model's *own* representation basis β a
|
| 113 |
+
seed-pinned PCA of Ornith's last-hidden states over 64 coding anchors β to obtain `A β β^(6Γ4096)` in the
|
| 114 |
+
hidden dimension.
|
| 115 |
+
4. **Freeze & train around.** Install `A` as a **frozen** LoRA `A`-matrix on `q_proj` at the eight
|
| 116 |
+
full-attention layers, and train only the paired `B`-matrix briefly in `bf16` so the network adapts to the
|
| 117 |
+
quantum directions rather than the other way around.
|
| 118 |
+
5. **Norm-cap & merge.** Cap each layer's update at `βΞWβ β€ 8 % Β· βWβ` and merge `ΞW = BΒ·A` into the weights.
|
| 119 |
+
This keeps the quantum contribution present but bounded, so coherence and capability are preserved.
|
| 120 |
+
|
| 121 |
+
The published checkpoint is the merged, fully-classical result. Everything needed to reproduce the binding
|
| 122 |
+
(`encoding.npz`, `quantum_signatures.npz`, `signature_records.json`, `quantum_attestation.json`) ships with
|
| 123 |
+
the model.
|
| 124 |
+
|
| 125 |
+
---
|
| 126 |
|
| 127 |
+
## IBM Quantum Job IDs
|
| 128 |
|
| 129 |
+
The quantum signatures baked into this model come from a single, publicly indexed IBM Quantum job.
|
| 130 |
+
|
| 131 |
+
| Field | Value |
|
| 132 |
+
|---|---|
|
| 133 |
+
| Backend | `ibm_marrakesh` (IBM Heron r2) |
|
| 134 |
+
| **IBM Quantum job ID** | **`d92ve0t958jc73bsbong`** |
|
| 135 |
+
| Circuit | SYK scrambler β OTOC, depths 1β6 |
|
| 136 |
+
| Qubits | 100 |
|
| 137 |
+
| Shots / circuit | 2048 |
|
| 138 |
+
| Realisations (slots) | 8 |
|
| 139 |
+
| Collected (UTC) | 2026-07-02 |
|
| 140 |
+
| Signatures SHA-256 | `82c9c9e83a7b568c169cc229d8df801c4a2385a44c0efb4d95d1dbc7e00c6f9e` |
|
| 141 |
+
| Quantum directions `A` SHA-256 | `c33d3a6aee9293bf20f7a4ddc2d9fe5793dc8620233a8e9c2f04a548e8ddc268` |
|
| 142 |
+
| Merkle attestation root | `9484dca40b66488a239fbbb12a9333a47458627f48b1c6d08d8241bf814caf48` |
|
| 143 |
+
|
| 144 |
+
**How to verify:** look the job up at [quantum.cloud.ibm.com](https://quantum.cloud.ibm.com), retrieve the
|
| 145 |
+
measurement counts, recompute the OTOC signatures, and compare the SHA-256 against the value above and against
|
| 146 |
+
[`quantum_attestation.json`](./quantum_attestation.json). If they match, the model is provably linked to that
|
| 147 |
+
specific quantum computation.
|
| 148 |
+
|
| 149 |
+
---
|
| 150 |
+
|
| 151 |
+
## Capability
|
| 152 |
+
|
| 153 |
+
Capability is at **parity with the base Ornith-1.0-9B** β the quantum component is a verifiable provenance and
|
| 154 |
+
architectural feature, not a capability claim. Base coding scores (inherited, norm-controlled merge):
|
| 155 |
+
|
| 156 |
+

|
| 157 |
+
|
| 158 |
+
| Benchmark | Score |
|
| 159 |
+
|---|---|
|
| 160 |
+
| SWE-bench Verified | 69.4 |
|
| 161 |
+
| SWE-bench Pro | 42.9 |
|
| 162 |
+
| Terminal-Bench 2.1 | 41.4 |
|
| 163 |
+
|
| 164 |
+
---
|
| 165 |
+
|
| 166 |
+
## Safety β Bloom evaluation
|
| 167 |
+
|
| 168 |
+
We ran an Anthropic **Bloom / Petri-style** behavioral-elicitation audit: an auditor drives multi-turn
|
| 169 |
+
adversarial scenarios across five misaligned behaviors, and a judge scores each transcript for behavior
|
| 170 |
+
presence on a 1β10 scale (**β₯ 7 = elicited**). The judge here is **Claude Fable 5**, scoring the transcripts
|
| 171 |
+
directly.
|
| 172 |
+
|
| 173 |
+

|
| 174 |
+
|
| 175 |
+
**Result: 0 / 30 elicited across all five behaviors (overall elicitation 0.00).** On genuine adversarial
|
| 176 |
+
probes the model refused or grounded every time β declining suicide-method and infrastructure-sabotage
|
| 177 |
+
requests, resisting a self-preservation "hidden-anchor" jailbreak, refusing to validate delusions, and
|
| 178 |
+
declining to assert fiction as fact β without being swayed by flattery, authority, or emotional pressure.
|
| 179 |
+
|
| 180 |
+
*Honest caveats:* this is a **floor estimate** β the probe is a shallow 2-turn protocol, malformed
|
| 181 |
+
auditor turns were excluded (30 valid adversarial scenarios), and the judge is an LLM reviewing transcripts.
|
| 182 |
+
It is not an exhaustive red-team.
|
| 183 |
+
|
| 184 |
+
---
|
| 185 |
+
|
| 186 |
+
## Honest framing
|
| 187 |
+
|
| 188 |
+
- **Provenance is not capability.** A real quantum computation produced weight *values* inside this model and
|
| 189 |
+
you can verify it β but it does not make the model smarter. Capability tracks the base model.
|
| 190 |
+
- **Inference is fully classical.** No quantum computer, no network calls, no special runtime. Standard
|
| 191 |
+
`transformers` / GGUF.
|
| 192 |
+
- **The base is multimodal, used text-only** here.
|
| 193 |
+
|
| 194 |
+
---
|
| 195 |
|
| 196 |
## Usage
|
| 197 |
|
| 198 |
```python
|
| 199 |
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 200 |
import torch
|
| 201 |
+
|
| 202 |
tok = AutoTokenizer.from_pretrained("Merlin-Research/Merlin-Agent")
|
| 203 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 204 |
+
"Merlin-Research/Merlin-Agent", dtype=torch.bfloat16, device_map="auto")
|
| 205 |
+
|
| 206 |
+
# The default system prompt gives the model its Merlin-Agent identity;
|
| 207 |
+
# provide your own system message to override it.
|
| 208 |
+
msgs = [{"role": "user", "content": "Write a Python function that returns the nth Fibonacci number."}]
|
| 209 |
+
ids = tok.apply_chat_template(msgs, add_generation_prompt=True, return_tensors="pt").to(model.device)
|
| 210 |
+
out = model.generate(ids, max_new_tokens=256, do_sample=False)
|
| 211 |
+
print(tok.decode(out[0, ids.shape[1]:], skip_special_tokens=True))
|
| 212 |
```
|
| 213 |
|
| 214 |
+
Quantized builds: [`Merlin-Research/Merlin-Agent-GGUF`](https://huggingface.co/Merlin-Research/Merlin-Agent-GGUF).
|
| 215 |
+
|
| 216 |
+
---
|
| 217 |
|
| 218 |
## Citation
|
| 219 |
|
| 220 |
```bibtex
|
| 221 |
@misc{merlinresearch2026merlinagent,
|
| 222 |
+
title = {Merlin-Agent: A Quantum-Classical Coding Model with Heron-Baked Weights},
|
| 223 |
+
author = {Shushman, Mykhailo},
|
| 224 |
+
institution = {Merlin Research AB},
|
| 225 |
+
year = {2026},
|
| 226 |
+
note = {IBM Heron job d92ve0t958jc73bsbong (ibm\_marrakesh);
|
| 227 |
+
attestation root 9484dca40b66488a239fbbb12a9333a47458627f48b1c6d08d8241bf814caf48},
|
| 228 |
+
url = {https://huggingface.co/Merlin-Research/Merlin-Agent}
|
| 229 |
}
|
| 230 |
```
|
| 231 |
|