ZQN-12B (ZAQERIS/ZQN-12B)
48-Layer Bilingual Text Model Compressed with ZAQERIS M3-GPTQ
Official Model Name: ZQN-12B | Repository: ZAQERIS/ZQN-12B | Model Family: ZQN
Base Model: deepseek-ai/DeepSeek-R1-Distill-Qwen-14B (MIT), which is itself derived from Qwen/Qwen2.5-14B (Apache-2.0)
Name note: The 12B in the name is historical. The dense core has 14.77B parameters (14,770,033,664), identical to the base model, plus about 0.78B of added ZAQERIS adapter parameters.
Developed by: ZAQERIS AI (Independent AI Research Group, Cairo, Egypt)
Predecessor: ZAQERIS-AXIOM (79.43B total / 12.39B active Sparse MoE, 36 layers, M3 3.16 bpp)
Training Origin: Not trained from scratch. ZQN-12B is DeepSeek-R1-Distill-Qwen-14B with ZAQERIS AI additions: DVMU low-rank adapter blocks, an LTBDD residual block before lm_head, a rule-based prompt pre-normalizer, and ZAQERIS M3-GPTQ compression. An earlier version of this card said the model was trained from scratch. That was incorrect and has been corrected.
Tokenizer: The upstream DeepSeek-R1-Distill-Qwen tokenizer (Qwen2 BPE, vocab_size = 152,064, <|User|>, <|Assistant|>, <think>, </think>, <|end▁of▁sentence|>), not built by ZAQERIS AI.
License: Apache 2.0 for ZAQERIS additions; upstream MIT (DeepSeek) and Apache-2.0 (Qwen) terms continue to apply (see the Attribution section below)
Total Physical Parameters: 15,546,031,104 (15.55B: 14.77B base-model dense core [13.21B 48-layer backbone + 1.56B embed/head] + 0.75B DVMU adapters + 21.02M LTBDD, the last two added by ZAQERIS AI)
Quantization: ZAQERIS M3-GPTQ (3x8b 8D RVQ + Block-Hadamard $g=128$ + OBQ salience 0.5% (0.4% lm_head) + Block-8 Cholesky + row normalization, 3.2484 bpw)
Compressed Disk Footprint: 6.479 GiB (6,957,289,320 bytes across 5 Safetensors shards)
Context Window: 131,072 tokens Native (128K) / 262,144 tokens Extended via YaRN (256K, $m_{\text{scale}} = 1.069315$)
Quickstart Notebook: Quickstart & Verification Notebook
Quantization Paper: ZAQERIS M3-GPTQ Technical Paper
نبذة عن النموذج والشفافية التقنية (Overview in Arabic)
ZQN-12B هو النموذج الثاني من مجموعة ZAQERIS AI البحثية المستقلة (القاهرة، مصر) بعد الإصدار الأول ZAQERIS-AXIOM:
- الأصل: نموذج ZQN-12B ليس مُدرَّباً من الصفر. هو مبني على نموذج DeepSeek-R1-Distill-Qwen-14B (رخصة MIT)، المشتق بدوره من Qwen2.5-14B (رخصة Apache-2.0)، مع إضافات من ZAQERIS AI: محوّلات DVMU، وكتلة LTBDD، ومصحّح مدخلات قائم على القواعد، وضغط ZAQERIS M3-GPTQ. النسخة السابقة من البطاقة وصفته خطأً بأنه مُدرَّب من الصفر، وتم تصحيح ذلك.
- الاسم: رقم
12Bفي الاسم تاريخي؛ النواة الكثيفة فيها14.77Bمعامل، مطابقة للنموذج الأساسي. - التوكنايزر: توكنايزر النموذج الأساسي DeepSeek-R1-Distill-Qwen (Qwen2 BPE)، وليس من تطويرنا (
vocab_size = 152,064) ورموزه الخاصة القياسية (<|User|>,<|Assistant|>,<think>,</think>,<|end▁of▁sentence|>) لضمان التوافق البرمجي فقط. - الهيكلة والحجم الفعلي: تضم النسخة الحالية 48 طبقة (نفس هيكلة Qwen2.5-14B) (
d_model = 5120,intermediate_size = 13824,40رأس استعلام /8رؤوس KV،head_dim = 128) بإجمالي15,546,031,104معامل (14.77Bنواة كثيفة +0.75BDVMU +21.02MLTBDD =15.55B)، مضغوطة عبر ZAQERIS M3-GPTQ (3.2484 bpw) إلى6.479 GiBعلى القرص.
1. Actual Capabilities & Known Limitations (ما يفعله النموذج فعلياً وحدوده)
Designed Capabilities (Text-Only Causal LM):
- Bilingual Arabic & English Reasoning + Dialogue: Supports step-by-step
<think>...</think>reasoning formatting and direct answers in Arabic and English. - ZAQERIS M3-GPTQ compression: Compressed with ZAQERIS M3-GPTQ (
3.2484 bpwlinear projections + CPU-offloadedINT8embed_tokens+INT4 G64DVMU adapters). - Structured Compact Tool Markup (
<call .../>/<plan ...>): Can emit structured XML-style tool calls that an external host or the bundled local agent toolbox can parse. The standalone toolbox implements opt-in localsh,linux_diag,read_file,write_file, andsearchonly; browser, email/outbox, web search, and media tools require an external host orchestrator. - Deterministic Lightweight Helpers Included in Modeling Code:
- Self-correction engine: a lightweight rule/lookup pre-normalizer (
COMMON_CORRECTIONStable + trailingخ->كrule + mash-string rejection triggers), tested10/10on its specific 10-case unit file. - Deliberation engine (
LTBDD): a21.02M-parameter residual bottleneck block prior tolm_head.
- Self-correction engine: a lightweight rule/lookup pre-normalizer (
Current Limitations (Realistic Scope):
- Early Checkpoint / Modest Academic Benchmark Scores: Stage-3
40-layer reference benchmarks achieved15.24%on HumanEval,19.00%on GSM8K (100tasks),45.50%on MMLU (200tasks),55.50%on ARC-Challenge (200tasks), and58.33%(7/12) on tool selection. It is not a frontier SOTA model. - Stage-4 Quantitative Coverage: Stage-4 (
48-layer) weights have been verified for compression (3.2484 bpw,mean_cos = 0.9731,calib_ppl = 10.6807), held-out perplexity (35.5500vs43.6063in Stage-3), and2/5tool-tag emission onlive_eval_report.jsonagent prompts; the full 5-suite benchmark sweep (HumanEval/GSM8K/MMLU/ARC/Agent) has not yet been re-run on Stage-4. - No Built-In Web Search, Vision, or Audio Generation: Standalone
ZQN-12Bweights are text-only causal weights (search_enabled: false). - No Hardware Power Metering Recorded:
config.jsonsets"power_metering_recorded": false; no fabricated J/token or USD/1M cost metrics are claimed.
2. Architecture & Parameter Accounting (verify_parameter_count_and_m4_expansion.py)
| Component | Exact Parameters | Precision / Packing |
|---|---|---|
48-Layer Dense Backbone (layers.0..47 attn + MLP) | 13,212,893,184 (~13.21B) | M3-GPTQ 3x8b (0.5% OBQ, normalize_rows) |
Embeddings (embed_tokens) + Output Head (lm_head) | 1,557,140,480 (~1.56B) | INT8 per-row (embed_tokens) + M3-GPTQ 3x8b (lm_head, 0.4% OBQ) |
DVMU Virtual Manifold Experts (layers.0..47) | 754,974,720 (~0.75B) | Group-64 Symmetric INT4 |
| LTBDD Tri-Branch Deliberation Engine | 21,022,720 (~21.02M) | float16 |
| Total Physical Unfolded Parameters | 15,546,031,104 (15.55B) | Total Disk Size: 6.479 GiB (5 Safetensors shards) |
Shard Layout (6.479 GiB / 6,957,289,320 Bytes Total)
model-00001-of-00005.safetensors:1,618,173,454bytes (1.51 GiB)model-00002-of-00005.safetensors:1,616,174,450bytes (1.51 GiB)model-00003-of-00005.safetensors:1,611,934,110bytes (1.50 GiB)model-00004-of-00005.safetensors:1,628,396,864bytes (1.52 GiB)model-00005-of-00005.safetensors:482,610,442bytes (0.45 GiB)
3. Empirical Measurements & Offline Benchmarks (Verified Locally — Zero Synthetic Numbers)
Evaluated locally with Python 3.12.10 and PyTorch 2.11.0+cu128:
| Metric | Observed Result | Notes & Provenance |
|---|---|---|
| M3-GPTQ Effective Bitrate (Stage-4) | 3.2484 bpw | m3_compression_report.json (0.5% OBQ, damp=0.02, 16 RVQ iters) |
| Mean Matrix Weight Cosine (Stage-4) | 0.9731 | Across 48 layers + lm_head (32,768 calib tokens; calib_ppl=10.6807) |
| Held-Out Perplexity (M3-GPTQ Stage-4) | 35.5500 | Improved from 43.6063 (Stage-3) on 148-token held-out sequence |
HumanEval (164/164 Stage-3 reference) | 15.24% (25/164) | Greedy pass@1 in isolated 5s subprocess (benchmark_report.json; Stage-4 sweep pending) |
GSM8K (100/1,319 Stage-3 reference) | 19.00% (19/100) | Exact numeric match (benchmark_report.json; Stage-4 sweep pending) |
MMLU (200/14,042 Stage-3 reference) | 45.50% (91/200) | Deterministic 1-pass A/B/C/D log-prob (benchmark_report.json; Stage-4 sweep pending) |
AI2 ARC-Challenge (200/1,172 Stage-3 reference) | 55.50% (111/200) | Deterministic 1-pass log-prob (benchmark_report.json; Stage-4 sweep pending) |
Arabic/English Agent Tool Suite (12 tasks, Stage-3) | 58.33% (7/12) / 100% JSON | Unseen multi-tool calling (benchmark_report.json; Stage-4 live emitted calls on 2/5 agent prompts) |
| ASSC Rule Normalizer Unit Suite | 10 / 10 (100%) | evaluation_evidence/self_correction_typo_benchmark.jsonl |
| RoPE KV-Cache Position Consistency | 0.0e+00 drift | scripts/test_rope_kv_cache_consistency.py |
| YaRN 256K Frequency Stability | Verified (mscale = 1.069315) | scripts/test_yarn_long_context.py |
| DVMU Active Tensor Divergence | Verified | scripts/test_dvmu_real_forward_pass.py |
(Note: generation_config.json sets repetition_penalty = 1.05, do_sample = False, and eos_token_id = [151645, 151643]. Full ablation details are in EVALUATION_BENCHMARK_COMPARISON.md.)
4. Quickstart Usage
import sys
import torch
from transformers import AutoTokenizer
from huggingface_hub import snapshot_download
local_dir = snapshot_download("ZAQERIS/ZQN-12B")
sys.path.insert(0, local_dir)
from modeling_zaqeris_zaqion_12b import ZaqionDialecticForCausalLM
# Upstream DeepSeek-R1-Distill-Qwen tokenizer (152,064-vocab Qwen2 BPE)
tokenizer = AutoTokenizer.from_pretrained(local_dir, trust_remote_code=True)
model = ZaqionDialecticForCausalLM.from_m3_pretrained(
local_dir,
device="cuda" if torch.cuda.is_available() else "cpu",
).eval()
# Optional deterministic pre-normalizer
noisy_prompt = "ما قدراتخ وما هو اسم النموذج؟"
correction = model.correct_prompt(noisy_prompt)
print("Normalized Prompt:", correction["corrected_prompt"])
# Generate response using ZQN-12B chat template (preventing duplicate BOS)
messages = [{"role": "user", "content": correction["corrected_prompt"]}]
formatted = tokenizer.apply_chat_template(
messages,
tokenize=False,
add_generation_prompt=True,
)
inputs = tokenizer(formatted, return_tensors="pt", add_special_tokens=False).to(model.device)
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=192,
do_sample=False,
repetition_penalty=1.05,
eos_token_id=[151645, 151643],
)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))
5. Technical Documentation & Verification Suite
- Paper: ZAQERIS M3-GPTQ Compression
- Paper 01: Latent Tri-Branch Deliberation Block (LTBDD)
- Paper 03: Compact Tool Parsing & Sandbox Toolbox
- Paper 04: Lineage & Foundations of ZAQERIS AI (AXIOM & ZQN-12B)
- Paper 05: Deterministic Rule Self-Correction Pre-Processor (ASSC)
- Dialectical Deliberation Specification
- Inference Compatibility & Runtime Guide
- Training Provenance & Privacy Policy
- Evaluation Methodology & Environment
- Evaluation Benchmarks & Ablation Tables
- Hardware Footprint & Throughput Report
- Self-Correction Unit Suite Report
Executable Verification Suite:
python scripts/verify_parameter_count_and_m4_expansion.py
python scripts/test_rope_kv_cache_consistency.py
python scripts/test_yarn_long_context.py
python scripts/test_dvmu_real_forward_pass.py
python evaluation_evidence/reproduce_m3_benchmarks.py --model Qwen/Qwen2.5-Coder-1.5B
6. License and Attribution
ZQN-12B is a derivative of deepseek-ai/DeepSeek-R1-Distill-Qwen-14B (MIT License, Copyright (c) 2023 DeepSeek), which is itself fine-tuned from Qwen/Qwen2.5-14B (Apache License 2.0, Copyright Alibaba Cloud, Qwen team). Those upstream terms continue to apply to the base weights. The ZAQERIS AI additions (DVMU adapters, LTBDD block, pre-normalizer, M3-GPTQ packing, modeling code and documentation) are released under the Apache License 2.0.
Upstream MIT notice (DeepSeek-R1-Distill-Qwen-14B):
MIT License
Copyright (c) 2023 DeepSeek
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
Please also cite DeepSeek-R1 (DeepSeek-AI, 2025, arXiv:2501.12948) and Qwen2.5 (Qwen Team, 2024, arXiv:2412.15115).