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 Qwen4ExpTextPLELayer Math 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-aware eos_token_id masking, 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 over 40.96M <think> reasoning tokens using Top-64 + FP32 tail-mass Forward KL (HybridMuonAdamW).
  • Measured PLE & Upcycle Gains on Held-Out <think> Validation (231,281 Assistant Tokens):
    • Held-out Student CE (PLE ON): 0.611721 (vs unpruned Qwen3.8-27B Teacher 0.702417, ΔCE = -0.090696).
    • Direct PLE Causal Gain (CE_ple_off - CE_ple_on): +0.042844 nats (0.654564 → 0.611721).
    • 4-Stream HC Dependence (CE_hc_off - CE_ple_on): +0.011497 nats.
    • Teacher Top-1 / Top-32 Agreement: 91.00% / 75.07%.
  • Lossless PLE + GatedDeltaNet Speculative Rollback (k = 1..4 Shared MTP):
    • DenseQwen4HybridCache tracks 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.720 mean 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
-
Safetensors
Model size
27B params
Tensor type
BF16
·
F32
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for gxunda/Qwen4-27B-Upcycle-PLE

Base model

Qwen/Qwen3.8-27B
Finetuned
(1,045)
this model

Datasets used to train gxunda/Qwen4-27B-Upcycle-PLE