Run this model with HF Jobs
Run chienhsinlin/DiracLM-4B-preview on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/chienhsinlin/DiracLM-4B-preview. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/chienhsinlin/DiracLM-4B-preview on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use chienhsinlin/DiracLM-4B-preview with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use chienhsinlin/DiracLM-4B-preview with Transformers:
# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("chienhsinlin/DiracLM-4B-preview", device_map="auto") - Notebooks
- Google Colab
- Kaggle
DiracLM-4B-preview (v0.1-preview)
DiracLM is an open line of quantum-inspired LLM methods from bitstar Inc (Taiwan): classical algorithms borrowed from quantum physics, run on ordinary GPUs. A method ships only if it passes a pre-set gate against its own baseline, and we publish the methods that fail too.
This preview is a runtime release. It uses the unchanged weights of Qwen/Qwen3-4B (with YaRN for 128K context) and adds QSA, a block-sparse attention for long-prompt prefill. There are no new weights, and answers to prompts under 64K tokens are exactly Qwen3-4B's.
Result: 64K-token prompts, 1x H100, batch 1
| Prefill of a 64K-token prompt | Time | QSA speedup |
|---|---|---|
| Hugging Face transformers, SDPA (FlashAttention) | 3.39 s | 1.48x |
| vLLM 0.34, dense | 2.93 s | 1.28x |
| DiracLM QSA (top-64), transformers | 2.29 s |
Quality cost: window perplexity on WikiText-103 rises by 0.69 % at 64K, and the first generated token matched dense attention in our check.
What we did not find:
- At 32K and below there is no useful gain at under 1 % perplexity cost, so QSA stays off there.
- At 128K, QSA is 2.1x faster than vLLM, but perplexity rises 1.9 %, over our 1 % limit, so we do not claim it.
- These are single runs. Accuracy on long-context tasks (RULER, LongBench) has not been measured yet.
Use
pip install torch transformers "git+https://github.com/tonythetiger168/qweave@claude/g1-prefill"
from phase4_llm.release.loader import load_diraclm
model, tok = load_diraclm("chienhsinlin/DiracLM-4B-preview") # Qwen3-4B + YaRN + QSA for prompts >= 64K tokens
QSA runs in Hugging Face transformers for a single, unpadded prompt's prefill. Decoding and shorter prompts use dense attention. vLLM support is not available yet.
Also open: a fast GRPO training loop
On the same recipe (Qwen3-0.6B-Base, GSM8K, 200 steps), the qweave GRPO loop reached 68.8 vs 67.9 on GSM8K using 0.39 vs 1.18 H100-hours compared with TRL's GRPOTrainer. This is ordinary engineering, not a quantum method, and it is one seed.
Negative results we publish
Tensor-network compression at -20 % parameters lost 8.7 MMLU points; a low-rank decode path was slower than
dense; QUBO-based RL data selection could not reach 0.75x GPU-hours. See diraclm_config.json and the repo.
Reproduce
G1_ARGS="--lens 32768 65536 130048 --yarn 4 --topks 16 32 64 --ppl-tokens 262144" bash scripts/runpod_g1.sh
on one H100 (about 45 minutes). Raw timings and perplexities are in eval/.
License
Apache-2.0, same as Qwen3-4B (by the Qwen team, Alibaba Cloud). "Quantum-inspired" means classical algorithms inspired by quantum physics: no quantum hardware is used and no quantum advantage is claimed.