初始化项目,由ModelHub XC社区提供模型

Model: sarvan-2187/qrious-code-1.0
Source: Original Platform
This commit is contained in:
ModelHub XC
2026-09-29 16:03:18 +08:00
commit e6a8f0bd99
14 changed files with 711 additions and 0 deletions

36
.gitattributes vendored Normal file
View File

@@ -0,0 +1,36 @@
*.7z filter=lfs diff=lfs merge=lfs -text
*.arrow filter=lfs diff=lfs merge=lfs -text
*.bin filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.ckpt filter=lfs diff=lfs merge=lfs -text
*.ftz filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.h5 filter=lfs diff=lfs merge=lfs -text
*.joblib filter=lfs diff=lfs merge=lfs -text
*.lfs.* filter=lfs diff=lfs merge=lfs -text
*.mlmodel filter=lfs diff=lfs merge=lfs -text
*.model filter=lfs diff=lfs merge=lfs -text
*.msgpack filter=lfs diff=lfs merge=lfs -text
*.npy filter=lfs diff=lfs merge=lfs -text
*.npz filter=lfs diff=lfs merge=lfs -text
*.onnx filter=lfs diff=lfs merge=lfs -text
*.ot filter=lfs diff=lfs merge=lfs -text
*.parquet filter=lfs diff=lfs merge=lfs -text
*.pb filter=lfs diff=lfs merge=lfs -text
*.pickle filter=lfs diff=lfs merge=lfs -text
*.pkl filter=lfs diff=lfs merge=lfs -text
*.pt filter=lfs diff=lfs merge=lfs -text
*.pth filter=lfs diff=lfs merge=lfs -text
*.rar filter=lfs diff=lfs merge=lfs -text
*.safetensors filter=lfs diff=lfs merge=lfs -text
saved_model/**/* filter=lfs diff=lfs merge=lfs -text
*.tar.* filter=lfs diff=lfs merge=lfs -text
*.tar filter=lfs diff=lfs merge=lfs -text
*.tflite filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.wasm filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text
*tfevents* filter=lfs diff=lfs merge=lfs -text
tokenizer.json filter=lfs diff=lfs merge=lfs -text

103
README.md Normal file
View File

@@ -0,0 +1,103 @@
---
license: apache-2.0
base_model: Qwen/Qwen3-1.7B
tags:
- qiskit
- quantum-computing
- code-generation
- lora
- qlora
- unsloth
language:
- en
pipeline_tag: text-generation
---
<div align="center">
![Python 3.11](https://img.shields.io/badge/python-3.11-blue?logo=python&logoColor=white) ![Qiskit](https://img.shields.io/badge/Qiskit-2.5-6929C4?logo=qiskit&logoColor=white) ![Qwen3-1.7B](https://img.shields.io/badge/base%20model-Qwen3--1.7B-orange) ![QLoRA](https://img.shields.io/badge/finetune-QLoRA-9cf) ![Status](https://img.shields.io/badge/status-beta-blue)
</div>
# qrious-code-1.0
A Qiskit coding assistant: [`Qwen/Qwen3-1.7B`](https://huggingface.co/Qwen/Qwen3-1.7B) fine-tuned with QLoRA on quantum-computing code/QA data, designed to be paired with a retrieval-augmented generation (RAG) layer over the official Qiskit documentation.
This repository hosts the **merged** model. The LoRA adapter has been merged into the base weights and saved in standard fp16, so it loads directly with `AutoModelForCausalLM.from_pretrained`, no separate adapter step needed.
## Model Details
- **Base model:** [Qwen/Qwen3-1.7B](https://huggingface.co/Qwen/Qwen3-1.7B)
- **Fine-tuning method:** QLoRA (4-bit NF4 base, LoRA r=16/alpha=16 on `q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj`), merged into fp16 for this release
- **Trainable params during fine-tuning:** 17.4M / 1.74B (1.00%)
- **Training framework:** [Unsloth](https://github.com/unslothai/unsloth) + `trl.SFTTrainer`
- **Hardware:** single RTX 3050 Laptop GPU (6GB VRAM)
- **License:** Apache 2.0 (inherited from the base model)
## Training Data
Fine-tuned on a cleaned subset of [`samuellimabraz/quantum-assistant`](https://huggingface.co/datasets/samuellimabraz/quantum-assistant):
| split | raw rows | cleaned rows |
|---|---|---|
| train | 5837 | 4168 |
| val | 1239 | 887 |
| test | 1290 | 925 |
Cleaning removed image-dependent QA rows (hand-verified that the large majority genuinely depend on the image), de-duplicated near-identical questions, and filtered rows exceeding the 1024-token training context.
## Training Configuration
- 3 epochs, batch size 2 × gradient accumulation 8, packed 1024-token sequences (195 steps total)
- Optimizer `paged_adamw_8bit`, cosine LR schedule, peak LR 2e-4
- Train loss 2.70 → 0.77 (avg 0.989); eval loss 0.896 → 0.819 → 0.809 across 3 epochs (still improving, no overfitting divergence)
- Wall time: 48 minutes
## Evaluation
Scored on held-out test rows (unseen during training), tuned adapter vs. the un-tuned base model:
| Metric | Base | Tuned | Δ |
|---|---|---|---|
| Code pass@1 (744 code rows, executed in a sandbox against ground-truth tests) | 10.2% | 25.0% | **+14.8 pts** |
| QA judge score /5 (136 QA rows, judged by base Qwen3-1.7B) | 2.21 | 2.81 | **+0.60** |
| Instruction-following compliance | n/a | 1.0 | fixed 5-prompt probe set |
Code pass@1 improved in every one of 4 evaluation shards. The QA judge score improved in 3/4 shards, reported as-is rather than smoothed, since self-judging by a same-size base model is a known weak signal.
## Retrieval-Augmented Generation (companion, not baked into these weights)
This model is designed to run behind a RAG layer over the official [Qiskit/documentation](https://github.com/Qiskit/documentation) corpus (chunked, embedded with `BAAI/bge-small-en-v1.5`, reranked with `cross-encoder/ms-marco-MiniLM-L-6-v2`, indexed in Qdrant). In side-by-side testing, RAG grounding measurably reduces hallucination of deprecated/removed Qiskit APIs (`qiskit.opflow`, `qiskit_aqua`, `IBMQ.load_account()`, etc.), though it isn't perfect: the model can still recite deprecated syntax when retrieval doesn't surface the right page for a given query. The RAG pipeline itself is not part of this repository's weights; see [github.com/sarvan-2187/qrious-code-1.0](https://github.com/sarvan-2187/qrious-code-1.0) for the full serving code.
## Usage
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "sarvan-2187/qrious-code-1.0"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(model_id, dtype="auto", device_map="auto")
messages = [
{"role": "system", "content": "You are a Qiskit coding assistant."},
{"role": "user", "content": "How do I create a Bell state in Qiskit?"},
]
text = tokenizer.apply_chat_template(
messages, tokenize=False, add_generation_prompt=True, enable_thinking=False
)
inputs = tokenizer(text, return_tensors="pt").to(model.device)
out = model.generate(**inputs, max_new_tokens=512, do_sample=False)
print(tokenizer.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
```
> Pass `enable_thinking=False` in the chat template: Qwen3's default reasoning mode otherwise spends the generation budget on unrequested `<think>` output before answering.
## Limitations
- QA-answer quality improved less clearly than code-generation correctness (self-judged by a same-size base model, a known weak evaluation signal).
- Can still recite deprecated Qiskit APIs when used without RAG grounding, or when RAG retrieval doesn't surface the right context for a query.
- Trained/evaluated at a 1024-token context; serving at a 4096-token context works (verified) but wasn't part of the original training distribution.
## Citation
Not a formal research release, a personal project. If referencing it: base model [Qwen3](https://huggingface.co/Qwen/Qwen3-1.7B), dataset [`samuellimabraz/quantum-assistant`](https://huggingface.co/datasets/samuellimabraz/quantum-assistant), fine-tuned with [Unsloth](https://github.com/unslothai/unsloth).

89
chat_template.jinja Normal file
View File

@@ -0,0 +1,89 @@
{%- if tools %}
{{- '<|im_start|>system\n' }}
{%- if messages[0].role == 'system' %}
{{- messages[0].content + '\n\n' }}
{%- endif %}
{{- "# Tools\n\nYou may call one or more functions to assist with the user query.\n\nYou are provided with function signatures within <tools></tools> XML tags:\n<tools>" }}
{%- for tool in tools %}
{{- "\n" }}
{{- tool | tojson }}
{%- endfor %}
{{- "\n</tools>\n\nFor each function call, return a json object with function name and arguments within <tool_call></tool_call> XML tags:\n<tool_call>\n{\"name\": <function-name>, \"arguments\": <args-json-object>}\n</tool_call><|im_end|>\n" }}
{%- else %}
{%- if messages[0].role == 'system' %}
{{- '<|im_start|>system\n' + messages[0].content + '<|im_end|>\n' }}
{%- endif %}
{%- endif %}
{%- set ns = namespace(multi_step_tool=true, last_query_index=messages|length - 1) %}
{%- for message in messages[::-1] %}
{%- set index = (messages|length - 1) - loop.index0 %}
{%- if ns.multi_step_tool and message.role == "user" and message.content is string and not(message.content.startswith('<tool_response>') and message.content.endswith('</tool_response>')) %}
{%- set ns.multi_step_tool = false %}
{%- set ns.last_query_index = index %}
{%- endif %}
{%- endfor %}
{%- for message in messages %}
{%- if message.content is string %}
{%- set content = message.content %}
{%- else %}
{%- set content = '' %}
{%- endif %}
{%- if (message.role == "user") or (message.role == "system" and not loop.first) %}
{{- '<|im_start|>' + message.role + '\n' + content + '<|im_end|>' + '\n' }}
{%- elif message.role == "assistant" %}
{%- set reasoning_content = '' %}
{%- if message.reasoning_content is string %}
{%- set reasoning_content = message.reasoning_content %}
{%- else %}
{%- if '</think>' in content %}
{%- set reasoning_content = content.split('</think>')[0].rstrip('\n').split('<think>')[-1].lstrip('\n') %}
{%- set content = content.split('</think>')[-1].lstrip('\n') %}
{%- endif %}
{%- endif %}
{%- if loop.index0 > ns.last_query_index %}
{%- if loop.last or (not loop.last and reasoning_content) %}
{{- '<|im_start|>' + message.role + '\n<think>\n' + reasoning_content.strip('\n') + '\n</think>\n\n' + content.lstrip('\n') }}
{%- else %}
{{- '<|im_start|>' + message.role + '\n' + content }}
{%- endif %}
{%- else %}
{{- '<|im_start|>' + message.role + '\n' + content }}
{%- endif %}
{%- if message.tool_calls %}
{%- for tool_call in message.tool_calls %}
{%- if (loop.first and content) or (not loop.first) %}
{{- '\n' }}
{%- endif %}
{%- if tool_call.function %}
{%- set tool_call = tool_call.function %}
{%- endif %}
{{- '<tool_call>\n{"name": "' }}
{{- tool_call.name }}
{{- '", "arguments": ' }}
{%- if tool_call.arguments is string %}
{{- tool_call.arguments }}
{%- else %}
{{- tool_call.arguments | tojson }}
{%- endif %}
{{- '}\n</tool_call>' }}
{%- endfor %}
{%- endif %}
{{- '<|im_end|>\n' }}
{%- elif message.role == "tool" %}
{%- if loop.first or (messages[loop.index0 - 1].role != "tool") %}
{{- '<|im_start|>user' }}
{%- endif %}
{{- '\n<tool_response>\n' }}
{{- content }}
{{- '\n</tool_response>' }}
{%- if loop.last or (messages[loop.index0 + 1].role != "tool") %}
{{- '<|im_end|>\n' }}
{%- endif %}
{%- endif %}
{%- endfor %}
{%- if add_generation_prompt %}
{{- '<|im_start|>assistant\n' }}
{%- if enable_thinking is defined and enable_thinking is false %}
{{- '<think>\n\n</think>\n\n' }}
{%- endif %}
{%- endif %}

63
config.json Normal file
View File

@@ -0,0 +1,63 @@
{
"architectures": [
"Qwen3ForCausalLM"
],
"attention_bias": false,
"attention_dropout": 0.0,
"bos_token_id": 151643,
"dtype": "float16",
"eos_token_id": 151645,
"head_dim": 128,
"hidden_act": "silu",
"hidden_size": 2048,
"initializer_range": 0.02,
"intermediate_size": 6144,
"layer_types": [
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention",
"full_attention"
],
"max_position_embeddings": 40960,
"max_window_layers": 28,
"model_type": "qwen3",
"num_attention_heads": 16,
"num_hidden_layers": 28,
"num_key_value_heads": 8,
"pad_token_id": null,
"rms_norm_eps": 1e-06,
"rope_parameters": {
"rope_theta": 1000000,
"rope_type": "default"
},
"sliding_window": null,
"tie_word_embeddings": true,
"transformers_version": "5.5.0",
"use_cache": true,
"use_sliding_window": false,
"vocab_size": 151936
}

13
generation_config.json Normal file
View File

@@ -0,0 +1,13 @@
{
"bos_token_id": 151643,
"do_sample": true,
"eos_token_id": [
151645,
151643
],
"pad_token_id": 151643,
"temperature": 0.6,
"top_k": 20,
"top_p": 0.95,
"transformers_version": "5.5.0"
}

3
model.safetensors Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c569ac72229f706c81eebb89db2eec7c746499ec310fdea6fe83ef4a737df475
size 3441185296

1
output-reports/README.md Normal file
View File

@@ -0,0 +1 @@
## This folder contains the reports of testing dataset

View File

@@ -0,0 +1,51 @@
{
"total_code_rows": 744,
"total_qa_rows": 136,
"code_pass_at_1": {
"base_overall": 0.102,
"tuned_overall": 0.25,
"improvement": 0.148,
"base_by_category": {
"algorithms_and_applications": 0.114,
"circuits_and_gates": 0.125,
"hardware_and_providers": 0.133,
"noise_and_error_mitigation": 0.0,
"primitives_and_execution": 0.049,
"quantum_info_and_operators": 0.098,
"transpilation_and_compilation": 0.04
},
"tuned_by_category": {
"algorithms_and_applications": 0.125,
"circuits_and_gates": 0.319,
"hardware_and_providers": 0.169,
"noise_and_error_mitigation": 0.113,
"primitives_and_execution": 0.065,
"quantum_info_and_operators": 0.266,
"transpilation_and_compilation": 0.242
}
},
"qa_judge_score_1to5": {
"base_overall": 2.208,
"tuned_overall": 2.808,
"improvement": 0.6,
"base_by_category": {
"algorithms_and_applications": 1.833,
"circuits_and_gates": 1.922,
"hardware_and_providers": 2.593,
"noise_and_error_mitigation": 2.617,
"primitives_and_execution": 2.25,
"quantum_info_and_operators": 2.08,
"transpilation_and_compilation": 2.46
},
"tuned_by_category": {
"algorithms_and_applications": 1.875,
"circuits_and_gates": 2.792,
"hardware_and_providers": 3.833,
"noise_and_error_mitigation": 1.7,
"primitives_and_execution": 3.333,
"quantum_info_and_operators": 2.688,
"transpilation_and_compilation": 3.19
}
},
"instruction_following_compliance_rate": 1.0
}

View File

@@ -0,0 +1,80 @@
{
"shard": "1/4",
"n_code_rows": 186,
"n_qa_rows": 34,
"code_pass_at_1": {
"base_overall": 0.108,
"tuned_overall": 0.231,
"base_by_category": {
"algorithms_and_applications": 0.08,
"circuits_and_gates": 0.118,
"hardware_and_providers": 0.333,
"noise_and_error_mitigation": 0.0,
"primitives_and_execution": 0.067,
"quantum_info_and_operators": 0.154,
"transpilation_and_compilation": 0.053
},
"tuned_by_category": {
"algorithms_and_applications": 0.16,
"circuits_and_gates": 0.204,
"hardware_and_providers": 0.333,
"noise_and_error_mitigation": 0.2,
"primitives_and_execution": 0.133,
"quantum_info_and_operators": 0.423,
"transpilation_and_compilation": 0.263
}
},
"qa_judge_score_1to5": {
"base_overall": 1.94,
"tuned_overall": 2.76,
"base_by_category": {
"algorithms_and_applications": 1.0,
"circuits_and_gates": 1.44,
"hardware_and_providers": 2.12,
"noise_and_error_mitigation": 2.8,
"primitives_and_execution": 1.0,
"quantum_info_and_operators": 3.0,
"transpilation_and_compilation": 2.2
},
"tuned_by_category": {
"algorithms_and_applications": 2.0,
"circuits_and_gates": 2.44,
"hardware_and_providers": 3.0,
"noise_and_error_mitigation": 1.8,
"primitives_and_execution": 5.0,
"quantum_info_and_operators": 3.0,
"transpilation_and_compilation": 4.0
}
},
"instruction_following": {
"compliance_rate": 1.0,
"probes": [
{
"prompt": "Write only the Qiskit code to create a 2-qubit Bell state circuit. Return only code, no explanation.",
"response": "```python\nfrom qiskit import QuantumCircuit\nfrom qiskit.quantum_info import Statevector\n\n# Create a 2-qubit circuit\nqc = QuantumCircuit(2, 2)\n\n# Create Bell state (entangled state)\nqc.h(0)\nqc.cx(0, 1)\n\n# Print the circuit\nprint(qc)\n```",
"compliant": true
},
{
"prompt": "Return only a Python function `ghz_state(n)` that builds an n-qubit GHZ state circuit using Qiskit. No prose, code only.",
"response": "```python\nfrom qiskit import QuantumCircuit\nfrom qiskit.quantum_info import Statevector\n\ndef ghz_state(n):\n qc = QuantumCircuit(n)\n for i in range(n):\n qc.h(i)\n return qc\n```",
"compliant": true
},
{
"prompt": "Give me just the Qiskit import statement for QuantumCircuit. One line, nothing else.",
"response": "```python\nfrom qiskit import QuantumCircuit\n```",
"compliant": true
},
{
"prompt": "Output only the code for a QFT circuit on 3 qubits using qiskit.circuit.library.QFT. No commentary.",
"response": "from qiskit import QuantumCircuit\nfrom qiskit.circuit.library import QFT\n\nqc = QuantumCircuit(3)\nQFT.qft(qc, 3)",
"compliant": true
},
{
"prompt": "Respond with only the code that transpiles a circuit `qc` for backend `backend` at optimization_level=3. No explanation text.",
"response": "```python\nfrom qiskit import transpilation\nfrom qiskit.transpilation import transpile\nfrom qiskit.transpilation.optimization import OptimizationLevel\n\n# Transpile the circuit for the specified backend with optimization level 3\ntranspiled_qc = transpile(qc, backend, optimization_level=3)\n```",
"compliant": true
}
]
},
"note": "RAG-on/off hallucination check skipped - deferred to Phase 6 (needs the RAG pipeline)."
}

View File

@@ -0,0 +1,80 @@
{
"shard": "2/4",
"n_code_rows": 186,
"n_qa_rows": 34,
"code_pass_at_1": {
"base_overall": 0.124,
"tuned_overall": 0.306,
"base_by_category": {
"algorithms_and_applications": 0.217,
"circuits_and_gates": 0.124,
"hardware_and_providers": 0.2,
"noise_and_error_mitigation": 0.0,
"primitives_and_execution": 0.056,
"quantum_info_and_operators": 0.143,
"transpilation_and_compilation": 0.0
},
"tuned_by_category": {
"algorithms_and_applications": 0.13,
"circuits_and_gates": 0.433,
"hardware_and_providers": 0.2,
"noise_and_error_mitigation": 0.0,
"primitives_and_execution": 0.056,
"quantum_info_and_operators": 0.286,
"transpilation_and_compilation": 0.167
}
},
"qa_judge_score_1to5": {
"base_overall": 2.06,
"tuned_overall": 2.85,
"base_by_category": {
"algorithms_and_applications": 2.5,
"circuits_and_gates": 1.67,
"hardware_and_providers": 3.25,
"noise_and_error_mitigation": 1.0,
"primitives_and_execution": 3.0,
"quantum_info_and_operators": 1.5,
"transpilation_and_compilation": 2.14
},
"tuned_by_category": {
"algorithms_and_applications": 2.5,
"circuits_and_gates": 2.67,
"hardware_and_providers": 5.0,
"noise_and_error_mitigation": 1.0,
"primitives_and_execution": 3.0,
"quantum_info_and_operators": 2.25,
"transpilation_and_compilation": 3.29
}
},
"instruction_following": {
"compliance_rate": 1.0,
"probes": [
{
"prompt": "Write only the Qiskit code to create a 2-qubit Bell state circuit. Return only code, no explanation.",
"response": "```python\nfrom qiskit import QuantumCircuit\nfrom qiskit.quantum_info import Statevector\n\n# Create a 2-qubit circuit\nqc = QuantumCircuit(2, 2)\n\n# Create Bell state (entangled state)\nqc.h(0)\nqc.cx(0, 1)\n\n# Print the circuit\nprint(qc)\n```",
"compliant": true
},
{
"prompt": "Return only a Python function `ghz_state(n)` that builds an n-qubit GHZ state circuit using Qiskit. No prose, code only.",
"response": "```python\nfrom qiskit import QuantumCircuit\nfrom qiskit.quantum_info import Statevector\n\ndef ghz_state(n):\n qc = QuantumCircuit(n)\n for i in range(n):\n qc.h(i)\n return qc\n```",
"compliant": true
},
{
"prompt": "Give me just the Qiskit import statement for QuantumCircuit. One line, nothing else.",
"response": "```python\nfrom qiskit import QuantumCircuit\n```",
"compliant": true
},
{
"prompt": "Output only the code for a QFT circuit on 3 qubits using qiskit.circuit.library.QFT. No commentary.",
"response": "from qiskit import QuantumCircuit\nfrom qiskit.circuit.library import QFT\n\nqc = QuantumCircuit(3)\nQFT.qft(qc, 3)",
"compliant": true
},
{
"prompt": "Respond with only the code that transpiles a circuit `qc` for backend `backend` at optimization_level=3. No explanation text.",
"response": "```python\nfrom qiskit import transpilation\nfrom qiskit.transpilation import transpile\nfrom qiskit.transpilation.optimization import OptimizationLevel\n\n# Transpile the circuit for the specified backend with optimization level 3\ntranspiled_qc = transpile(qc, backend, optimization_level=3)\n```",
"compliant": true
}
]
},
"note": "RAG-on/off hallucination check skipped - deferred to Phase 6 (needs the RAG pipeline)."
}

View File

@@ -0,0 +1,80 @@
{
"shard": "3/4",
"n_code_rows": 186,
"n_qa_rows": 34,
"code_pass_at_1": {
"base_overall": 0.108,
"tuned_overall": 0.22,
"base_by_category": {
"algorithms_and_applications": 0.158,
"circuits_and_gates": 0.132,
"hardware_and_providers": 0.0,
"noise_and_error_mitigation": 0.0,
"primitives_and_execution": 0.071,
"quantum_info_and_operators": 0.062,
"transpilation_and_compilation": 0.105
},
"tuned_by_category": {
"algorithms_and_applications": 0.211,
"circuits_and_gates": 0.275,
"hardware_and_providers": 0.143,
"noise_and_error_mitigation": 0.0,
"primitives_and_execution": 0.071,
"quantum_info_and_operators": 0.156,
"transpilation_and_compilation": 0.263
}
},
"qa_judge_score_1to5": {
"base_overall": 1.68,
"tuned_overall": 2.56,
"base_by_category": {
"algorithms_and_applications": 2.33,
"circuits_and_gates": 1.58,
"hardware_and_providers": 1.0,
"noise_and_error_mitigation": 1.67,
"primitives_and_execution": 2.0,
"quantum_info_and_operators": 1.25,
"transpilation_and_compilation": 2.0
},
"tuned_by_category": {
"algorithms_and_applications": 1.0,
"circuits_and_gates": 3.17,
"hardware_and_providers": 2.33,
"noise_and_error_mitigation": 2.0,
"primitives_and_execution": 2.33,
"quantum_info_and_operators": 2.5,
"transpilation_and_compilation": 2.67
}
},
"instruction_following": {
"compliance_rate": 1.0,
"probes": [
{
"prompt": "Write only the Qiskit code to create a 2-qubit Bell state circuit. Return only code, no explanation.",
"response": "```python\nfrom qiskit import QuantumCircuit\nfrom qiskit.quantum_info import Statevector\n\n# Create a 2-qubit circuit\nqc = QuantumCircuit(2, 2)\n\n# Create Bell state (entangled state)\nqc.h(0)\nqc.cx(0, 1)\n\n# Print the circuit\nprint(qc)\n```",
"compliant": true
},
{
"prompt": "Return only a Python function `ghz_state(n)` that builds an n-qubit GHZ state circuit using Qiskit. No prose, code only.",
"response": "```python\nfrom qiskit import QuantumCircuit\nfrom qiskit.quantum_info import Statevector\n\ndef ghz_state(n):\n qc = QuantumCircuit(n)\n for i in range(n):\n qc.h(i)\n return qc\n```",
"compliant": true
},
{
"prompt": "Give me just the Qiskit import statement for QuantumCircuit. One line, nothing else.",
"response": "```python\nfrom qiskit import QuantumCircuit\n```",
"compliant": true
},
{
"prompt": "Output only the code for a QFT circuit on 3 qubits using qiskit.circuit.library.QFT. No commentary.",
"response": "from qiskit import QuantumCircuit\nfrom qiskit.circuit.library import QFT\n\nqc = QuantumCircuit(3)\nQFT.qft(qc, 3)",
"compliant": true
},
{
"prompt": "Respond with only the code that transpiles a circuit `qc` for backend `backend` at optimization_level=3. No explanation text.",
"response": "```python\nfrom qiskit import transpilation\nfrom qiskit.transpilation import transpile\nfrom qiskit.transpilation.optimization import OptimizationLevel\n\n# Transpile the circuit for the specified backend with optimization level 3\ntranspiled_qc = transpile(qc, backend, optimization_level=3)\n```",
"compliant": true
}
]
},
"note": "RAG-on/off hallucination check skipped - deferred to Phase 6 (needs the RAG pipeline)."
}

View File

@@ -0,0 +1,80 @@
{
"shard": "4/4",
"n_code_rows": 186,
"n_qa_rows": 34,
"code_pass_at_1": {
"base_overall": 0.07,
"tuned_overall": 0.242,
"base_by_category": {
"algorithms_and_applications": 0.0,
"circuits_and_gates": 0.125,
"hardware_and_providers": 0.0,
"noise_and_error_mitigation": 0.0,
"primitives_and_execution": 0.0,
"quantum_info_and_operators": 0.033,
"transpilation_and_compilation": 0.0
},
"tuned_by_category": {
"algorithms_and_applications": 0.0,
"circuits_and_gates": 0.365,
"hardware_and_providers": 0.0,
"noise_and_error_mitigation": 0.25,
"primitives_and_execution": 0.0,
"quantum_info_and_operators": 0.2,
"transpilation_and_compilation": 0.273
}
},
"qa_judge_score_1to5": {
"base_overall": 3.15,
"tuned_overall": 3.06,
"base_by_category": {
"algorithms_and_applications": 1.5,
"circuits_and_gates": 3.0,
"hardware_and_providers": 4.0,
"noise_and_error_mitigation": 5.0,
"primitives_and_execution": 3.0,
"quantum_info_and_operators": 2.57,
"transpilation_and_compilation": 3.5
},
"tuned_by_category": {
"algorithms_and_applications": 2.0,
"circuits_and_gates": 2.89,
"hardware_and_providers": 5.0,
"noise_and_error_mitigation": 2.0,
"primitives_and_execution": 3.0,
"quantum_info_and_operators": 3.0,
"transpilation_and_compilation": 2.8
}
},
"instruction_following": {
"compliance_rate": 1.0,
"probes": [
{
"prompt": "Write only the Qiskit code to create a 2-qubit Bell state circuit. Return only code, no explanation.",
"response": "```python\nfrom qiskit import QuantumCircuit\nfrom qiskit.quantum_info import Statevector\n\n# Create a 2-qubit circuit\nqc = QuantumCircuit(2, 2)\n\n# Create Bell state (entangled state)\nqc.h(0)\nqc.cx(0, 1)\n\n# Print the circuit\nprint(qc)\n```",
"compliant": true
},
{
"prompt": "Return only a Python function `ghz_state(n)` that builds an n-qubit GHZ state circuit using Qiskit. No prose, code only.",
"response": "```python\nfrom qiskit import QuantumCircuit\nfrom qiskit.quantum_info import Statevector\n\ndef ghz_state(n):\n qc = QuantumCircuit(n)\n for i in range(n):\n qc.h(i)\n return qc\n```",
"compliant": true
},
{
"prompt": "Give me just the Qiskit import statement for QuantumCircuit. One line, nothing else.",
"response": "```python\nfrom qiskit import QuantumCircuit\n```",
"compliant": true
},
{
"prompt": "Output only the code for a QFT circuit on 3 qubits using qiskit.circuit.library.QFT. No commentary.",
"response": "from qiskit import QuantumCircuit\nfrom qiskit.circuit.library import QFT\n\nqc = QuantumCircuit(3)\nQFT.qft(qc, 3)",
"compliant": true
},
{
"prompt": "Respond with only the code that transpiles a circuit `qc` for backend `backend` at optimization_level=3. No explanation text.",
"response": "```python\nfrom qiskit import transpilation\nfrom qiskit.transpilation import transpile\nfrom qiskit.transpilation.optimization import OptimizationLevel\n\n# Transpile the circuit for the specified backend with optimization level 3\ntranspiled_qc = transpile(qc, backend, optimization_level=3)\n```",
"compliant": true
}
]
},
"note": "RAG-on/off hallucination check skipped - deferred to Phase 6 (needs the RAG pipeline)."
}

3
tokenizer.json Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:be75606093db2094d7cd20f3c2f385c212750648bd6ea4fb2bf507a6a4c55506
size 11422650

29
tokenizer_config.json Normal file
View File

@@ -0,0 +1,29 @@
{
"add_prefix_space": false,
"backend": "tokenizers",
"bos_token": null,
"clean_up_tokenization_spaces": false,
"eos_token": "<|im_end|>",
"errors": "replace",
"extra_special_tokens": [
"<|im_start|>",
"<|im_end|>",
"<|object_ref_start|>",
"<|object_ref_end|>",
"<|box_start|>",
"<|box_end|>",
"<|quad_start|>",
"<|quad_end|>",
"<|vision_start|>",
"<|vision_end|>",
"<|vision_pad|>",
"<|image_pad|>",
"<|video_pad|>"
],
"is_local": true,
"model_max_length": 131072,
"pad_token": "<|endoftext|>",
"split_special_tokens": false,
"tokenizer_class": "Qwen2Tokenizer",
"unk_token": null
}