Instructions to use itsalissonsilva/QuantumCoder-9B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- PEFT
How to use itsalissonsilva/QuantumCoder-9B with PEFT:
from peft import PeftModel from transformers import AutoModelForCausalLM base_model = AutoModelForCausalLM.from_pretrained("Qwen/Qwen3.5-9B") model = PeftModel.from_pretrained(base_model, "itsalissonsilva/QuantumCoder-9B") - Notebooks
- Google Colab
- Kaggle
Explain model applications and add concrete examples; apply requested names
Browse files
README.md
CHANGED
|
@@ -9,11 +9,34 @@ tags:
|
|
| 9 |
- lora
|
| 10 |
- synthetic-data
|
| 11 |
---
|
|
|
|
| 12 |
# QuantumCoder-9B
|
| 13 |
|
| 14 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 15 |
|
| 16 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
|
| 18 |
## Results
|
| 19 |
|
|
@@ -37,24 +60,6 @@ Training uses 2–4 qubits, adjacent CNOTs and 6–13 gates. Stress uses 5–6 q
|
|
| 37 |
|
| 38 |
Base [Qwen3.5-9B](https://huggingface.co/Qwen/Qwen3.5-9B), revision `c202236235762e1c871ad0ccb60c8ee5ba337b9a`. One fixed epoch from the base, 648 examples, rank 16/alpha 32 on q_proj/v_proj/in_proj_qkv, AdamW learning rate 2e−5, gradient accumulation 8, seed 20261101, max training sequence 2,048. No test checkpoint selection. Training code, original programs, model outputs and audits remain in this repository.
|
| 39 |
|
| 40 |
-
## Inference
|
| 41 |
-
|
| 42 |
-
Download this repository and install `requirements-inference.txt` in a CUDA environment with enough memory for 9B weights (the checked configuration used an A100). From the downloaded repository:
|
| 43 |
-
|
| 44 |
-
```python
|
| 45 |
-
from quantum import QuantumCoder
|
| 46 |
-
coder = QuantumCoder()
|
| 47 |
-
result = coder.generate([{
|
| 48 |
-
"framework": "cirq", "qubits": 2,
|
| 49 |
-
"operations": [["h", [0], 0.0], ["ry", [1], 0.31],
|
| 50 |
-
["rz", [0], 0.67], ["cx", [0, 1], 0.0],
|
| 51 |
-
["h", [1], 0.0], ["z", [0], 0.0]]
|
| 52 |
-
}])[0]
|
| 53 |
-
print(result["program"])
|
| 54 |
-
```
|
| 55 |
-
|
| 56 |
-
The helper returns fallible source text and never executes it. `operations` follows [gate,qubit_indices,angle_in_radians]; non-rotation angles are 0. The measured limits are 2–6 qubits and at most 24 gates. Prompts beyond 2,048 tokens are rejected rather than truncated. Generation matches the frozen greedy 768-token protocol in batches of eight.
|
| 57 |
-
|
| 58 |
## Reproduce execution
|
| 59 |
|
| 60 |
Use an isolated Linux environment with Python 3.11, `libseccomp2` and `requirements-evaluation.txt`. The parent must run as root so workers can drop to UID/GID 65534. From a full repository snapshot, run `python reproduce_execution.py`. It first verifies the frozen sandbox/data hashes, isolation and every selected reference, then re-scores all 1,440 base/adapted programs and checks the published counts. This public reproducer was run successfully before release. Do not substitute direct host execution for the provided runner.
|
|
|
|
| 9 |
- lora
|
| 10 |
- synthetic-data
|
| 11 |
---
|
| 12 |
+
|
| 13 |
# QuantumCoder-9B
|
| 14 |
|
| 15 |
+
Translate an explicit quantum-circuit specification into Python for Qiskit, Cirq or PennyLane. Give this Qwen3.5-9B adapter the framework, qubit count and ordered gate list; it returns source code that can be inspected and checked in the supplied isolated evaluator.
|
| 16 |
+
|
| 17 |
+
The practical use is a quantum-programming teaching notebook or a framework-translation benchmark: the same circuit can be expressed in three APIs and compared against a reference statevector. The published adapter passes 288/288 held-out framework cases and 282/288 stress cases in its restricted executor. A deterministic renderer already solves the fully specified task; these results do not establish algorithm discovery or repair of arbitrary quantum programs.
|
| 18 |
+
|
| 19 |
+
## Application example
|
| 20 |
+
|
| 21 |
+
**Show one circuit in three frameworks.** Represent a circuit as `framework`, `qubits` and `operations`, request one framework at a time, and compare how its gates and wire ordering are expressed. For example, H on qubit 0 followed by CX(0,1) prepares a Bell state from the all-zero input. The longer example below uses the measured operation schema. Inspect generated text before passing it to the isolated evaluator; the inference helper itself executes no code.
|
| 22 |
+
|
| 23 |
+
## Inference
|
| 24 |
+
|
| 25 |
+
Download this repository and install `requirements-inference.txt` in a CUDA environment with enough memory for 9B weights (the checked configuration used an A100). From the downloaded repository:
|
| 26 |
|
| 27 |
+
```python
|
| 28 |
+
from quantum import QuantumCoder
|
| 29 |
+
coder = QuantumCoder()
|
| 30 |
+
result = coder.generate([{
|
| 31 |
+
"framework": "cirq", "qubits": 2,
|
| 32 |
+
"operations": [["h", [0], 0.0], ["ry", [1], 0.31],
|
| 33 |
+
["rz", [0], 0.67], ["cx", [0, 1], 0.0],
|
| 34 |
+
["h", [1], 0.0], ["z", [0], 0.0]]
|
| 35 |
+
}])[0]
|
| 36 |
+
print(result["program"])
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
The helper returns fallible source text and never executes it. `operations` follows [gate,qubit_indices,angle_in_radians]; non-rotation angles are 0. The measured limits are 2–6 qubits and at most 24 gates. Prompts beyond 2,048 tokens are rejected rather than truncated. Generation matches the frozen greedy 768-token protocol in batches of eight.
|
| 40 |
|
| 41 |
## Results
|
| 42 |
|
|
|
|
| 60 |
|
| 61 |
Base [Qwen3.5-9B](https://huggingface.co/Qwen/Qwen3.5-9B), revision `c202236235762e1c871ad0ccb60c8ee5ba337b9a`. One fixed epoch from the base, 648 examples, rank 16/alpha 32 on q_proj/v_proj/in_proj_qkv, AdamW learning rate 2e−5, gradient accumulation 8, seed 20261101, max training sequence 2,048. No test checkpoint selection. Training code, original programs, model outputs and audits remain in this repository.
|
| 62 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
## Reproduce execution
|
| 64 |
|
| 65 |
Use an isolated Linux environment with Python 3.11, `libseccomp2` and `requirements-evaluation.txt`. The parent must run as root so workers can drop to UID/GID 65534. From a full repository snapshot, run `python reproduce_execution.py`. It first verifies the frozen sandbox/data hashes, isolation and every selected reference, then re-scores all 1,440 base/adapted programs and checks the published counts. This public reproducer was run successfully before release. Do not substitute direct host execution for the provided runner.
|