Instructions to use gxunda/Qwen4-27B-Upcycle-PLE with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use gxunda/Qwen4-27B-Upcycle-PLE with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="gxunda/Qwen4-27B-Upcycle-PLE", trust_remote_code=True) messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("gxunda/Qwen4-27B-Upcycle-PLE", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use gxunda/Qwen4-27B-Upcycle-PLE with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "gxunda/Qwen4-27B-Upcycle-PLE" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "gxunda/Qwen4-27B-Upcycle-PLE", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/gxunda/Qwen4-27B-Upcycle-PLE
- SGLang
How to use gxunda/Qwen4-27B-Upcycle-PLE 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 "gxunda/Qwen4-27B-Upcycle-PLE" \ --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": "gxunda/Qwen4-27B-Upcycle-PLE", "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 "gxunda/Qwen4-27B-Upcycle-PLE" \ --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": "gxunda/Qwen4-27B-Upcycle-PLE", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use gxunda/Qwen4-27B-Upcycle-PLE with Docker Model Runner:
docker model run hf.co/gxunda/Qwen4-27B-Upcycle-PLE
Qwen4-27B-Upcycle-PLE (DenseQwen4ExpForCausalLM with In-VRAM Per-Layer Embeddings)
Qwen4-27B-Upcycle-PLE is a 27.25B-parameter True Dense Qwen4-Exp causal language model (trust_remote_code=True) featuring 4-Layer Compact In-VRAM Per-Layer Embeddings (PLE), 4-Stream Hyper-Connections (HC), hybrid GatedDeltaNet + Attention blocks, and a 4-step shared Multi-Token Prediction (MTP) module.
Built in Round 2 atop gxunda/Qwen4-27B-Upcycle-Dev (which was surgically upcycled from Qwen/Qwen3.8-27B), this model freezes the 26.12B Round-1 backbone and distills 1.13B hashed n-gram Per-Layer Embedding parameters (2.10 GiB BF16) across balanced GatedDeltaNet layers ple_layer_ids = [13, 25, 37, 53] — fitting 100% in single-GPU VRAM with zero CPU-offload latency penalty.
Key Highlights
- Exact Upstream
Qwen4ExpTextPLELayerMath in Compact In-VRAM Form (2.10 GiB):- Uses multi-head prime-modulo SplitMix64 bigram + trigram hashing (
ngram_size=3,heads_per_ngram=4,ngram_vocab_size_base=250,000,ple_embed_dim=1024) with segment-awareeos_token_idmasking, per-stream(1 + w)RMSNorm query-key gating, and dilated depthwise causal short convolutions (kernel_size=4, dilation=3). - Initialized as a bitwise-exact Step-0 identity (
value_proj = 0, conv1d = 0→val_ce_ple_on == val_ce_ple_off == 0.654564) with unlocked Step-1 gradients, then distilled over40.96M<think>reasoning tokens using Top-64 + FP32 tail-mass Forward KL (HybridMuonAdamW).
- Uses multi-head prime-modulo SplitMix64 bigram + trigram hashing (
- Measured PLE & Upcycle Gains on Held-Out
<think>Validation (231,281Assistant Tokens):- Held-out Student CE (
PLE ON):0.611721(vs unprunedQwen3.8-27BTeacher0.702417,ΔCE = -0.090696). - Direct PLE Causal Gain (
CE_ple_off - CE_ple_on):+0.042844nats (0.654564→0.611721). - 4-Stream HC Dependence (
CE_hc_off - CE_ple_on):+0.011497nats. - Teacher Top-1 / Top-32 Agreement:
91.00%/75.07%.
- Held-out Student CE (
- Lossless PLE + GatedDeltaNet Speculative Rollback (
k = 1..4Shared MTP):DenseQwen4HybridCachetracks KV, GatedDeltaNet conv/recurrent states, PLE dilated short-conv states (len=9), and PLE n-gram token history (len=2), rewinding all states in-place on rejected draft tokens (94.34%greedy match vs autoregressive,2.720mean accepted tokens/step,1.660×TPOT speedup).
Architecture Summary
| Component | Configuration |
|---|---|
| Architecture Class | DenseQwen4ExpForCausalLM (model_type="dense_qwen4_exp") |
| Total Parameters | 27.25B (26.12B Round-1 base + 1.13B PLE across 4 layers; 50.64 GiB BF16 in 14 shards) |
| Backbone Layers | 64 (48 GatedDeltaNet linear_attention + 16 Gated GQA full_attention, 3:1 interleaved) |
Per-Layer Embeddings (ple) |
ple_layer_ids = [13, 25, 37, 53], ngram_size = 3, heads_per_ngram = 4 (8 prime-hashed heads/layer), ngram_vocab_size_base = 250,000, ple_embed_dim = 1024, ple_conv_kernel_size = 4 |
Hyper-Connections (hc) |
hc_count = 4, hc_lowrank = 320 (Qwen4ExpTextGatedResidual across all 64 layers + final mixer) |
| Dense SwiGLU FFN | intermediate_size = 14,336 (num_experts = 0, Wanda-pruned + merged LoRA from Round 1) |
| Shared MTP Head | 1 shared DenseQwen4ExpMTP layer (mtp_intermediate_size = 17,408), unrolled k = 1..4 |
Evaluation Results
1. Round-2 PLE Held-Out Validation Progression (128 × 2048 Windows)
| Step | Tokens Seen | val_ce_ple_on |
val_ce_ple_off (Round-1 Base) |
CE_ple_off - CE_ple_on |
CE_ple_on - CE_teacher |
|---|---|---|---|---|---|
| 0 | 0.00M |
0.654564 |
0.654564 |
+0.000000 |
-0.047853 |
| 250 | 4.10M |
0.629161 |
0.654564 |
+0.025403 |
-0.073256 |
| 500 | 8.19M |
0.620625 |
0.654564 |
+0.033940 |
-0.081792 |
| 750 | 12.29M |
0.617244 |
0.654564 |
+0.037320 |
-0.085173 |
| 1000 | 16.38M |
0.615101 |
0.654564 |
+0.039464 |
-0.087316 |
| 1250 | 20.48M |
0.612889 |
0.654564 |
+0.041676 |
-0.089528 |
| 1500 | 24.58M |
0.613234 |
0.654564 |
+0.041330 |
-0.089183 |
| 1750 | 28.67M |
0.612207 |
0.654564 |
+0.042358 |
-0.090210 |
| 2000 | 32.77M |
0.612111 |
0.654564 |
+0.042453 |
-0.090306 |
| 2250 | 36.86M |
0.611822 |
0.654564 |
+0.042742 |
-0.090595 |
| 2500 | 40.96M |
0.611721 |
0.654564 |
+0.042844 |
-0.090696 |
2. Standalone Benchmark Summary (final_eval_report_ple.json)
| Category | Metric | Score |
|---|---|---|
Reasoning (<think>) |
GSM8K Accuracy (25 problems, max_new_tokens=1536 / @768 cap) |
80.0% (76.0% @ 768 tok) |
Reasoning (<think>) |
MATH-500 Accuracy (25 problems, max_new_tokens=1536 / @768 cap) |
48.0% (32.0% @ 768 tok) |
Reasoning (<think>) |
Combined 50-Problem <think> Accuracy (@1536 / <think> completion rate) |
64.0% (88.0% <think> closed) |
MTP (k=1..4) |
Conditional Acceptance (k=1 / 2 / 3 / 4) |
67.72% / 73.44% / 64.89% / 68.85% |
MTP (k=1..4) |
Cumulative Acceptance (k=1 / 2 / 3 / 4) |
67.72% / 49.74% / 32.28% / 22.22% |
MTP (k=1..4) |
Mean Accepted Length / TPOT Speedup | 2.720 tok/step / 31.06 ms vs 51.57 ms (1.660×) |
| Export Integrity | AutoModelForCausalLM.from_pretrained Reload Max Diff |
0.0 |
Quickstart (transformers)
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
model_id = "gxunda/Qwen4-27B-Upcycle-PLE"
tokenizer = AutoTokenizer.from_pretrained(model_id, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
model_id,
trust_remote_code=True,
dtype=torch.bfloat16,
device_map="auto",
).eval()
messages = [{"role": "user", "content": "Find all integer solutions to x^2 - y^2 = 15."}]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True) + "<think>\n"
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
with torch.no_grad():
out = model.generate(**inputs, max_new_tokens=1024, do_sample=False, use_cache=True)
print("<think>\n" + tokenizer.decode(out[0, inputs.input_ids.shape[1]:], skip_special_tokens=True))
Ablating PLE at Inference
with model.ple_ablation_off():
# Runs exact Round-1 backbone without PLE contribution
logits_no_ple = model(**inputs, use_cache=False).logits
License
Apache-2.0 (inherits from Qwen/Qwen3.8-27B).
- Downloads last month
- -
Model tree for gxunda/Qwen4-27B-Upcycle-PLE
Base model
Qwen/Qwen3.8-27B