Instructions to use SkyAsl/QLean-Qwen3.5-4B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use SkyAsl/QLean-Qwen3.5-4B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="SkyAsl/QLean-Qwen3.5-4B", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModel model = AutoModel.from_pretrained("SkyAsl/QLean-Qwen3.5-4B", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use SkyAsl/QLean-Qwen3.5-4B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "SkyAsl/QLean-Qwen3.5-4B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "SkyAsl/QLean-Qwen3.5-4B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/SkyAsl/QLean-Qwen3.5-4B
- SGLang
How to use SkyAsl/QLean-Qwen3.5-4B 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 "SkyAsl/QLean-Qwen3.5-4B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "SkyAsl/QLean-Qwen3.5-4B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "SkyAsl/QLean-Qwen3.5-4B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "SkyAsl/QLean-Qwen3.5-4B", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use SkyAsl/QLean-Qwen3.5-4B with Docker Model Runner:
docker model run hf.co/SkyAsl/QLean-Qwen3.5-4B
QLean-Qwen3.5-4B
QLean attaches a deterministic RV32IM Lean proof checker to the original Qwen3.5-4B checkpoint. Qwenputer’s P3 circuit runs the checker in compiled weights. The Python runtime frames proof bytes, schedules the two paths, and routes the guest verdict into Qwen’s text cache.
This repository distributes compiled overlays and runtime code. The loader obtains the original Qwen checkpoint at its pinned revision, then verifies its 738 tensor payloads against tensor-sha256.json. It loads the stock model at its original dtype and width. The stock checkpoint carries its Apache-2.0 license.
Usage
from transformers import AutoModel
model = AutoModel.from_pretrained("SkyAsl/QLean-Qwen3.5-4B", trust_remote_code=True)
result = model.prove("Submit only the bare Lean term fun P h => h.",
structured=True, thinking=False, temperature=0, max_attempts=1)
print(result["attempts"])
The loader executes the repository’s Python code and needs CUDA with BF16 and Triton support. The release uses PyTorch, Transformers 5.19.0, Accelerate and Safetensors. Use model.prove to run proof transport. The standard forward and generate methods delegate to stock Qwen. Choose a shipped goal-bound overlay with overlay="...". Its manifest identifies the exact theorem accepted by the firmware. In bare-verdict mode (structured=False), Qwen must generate the proof frame itself and may stop or close it empty.
Benchmarks and Verification
The guest accepts a strict Lean 4 subset. benchmarks.json records the L4 benchmark results, idle parity, and the original checkpoint shard digests.
The L4 run matched all 18 idle-logit comparisons and preserved every stock tensor. In the composition demo, Qwen repaired a real type error on the same text cache after the guest diagnostic and a generic Try again. chat turn. Lean 4.36.0 accepted the sampled proof with zero axiom dependencies. The bare-verdict trials did not produce a semantic repair across the three theorem candidates tested.
Code & Reproducibility
Source code, C kernel, strace traces, and Colab reproduction scripts are available on GitHub: GoktugAslanoglu/QLean.
Citation
@misc{aslanoglu2026qlean,
author = {Aslano{\u{g}}lu, G{\"o}ktu{\u{g}}},
title = {{QLean: Compiling a Lean 4 Proof Checker into Qwen3.5-4B's Weights}},
year = {2026},
url = {https://github.com/GoktugAslanoglu/QLean}
}
- Downloads last month
- 50