Downloads · 30 days
0
Havoc1904/Qwen3.8-27B-1Bit-YaRN-1M
Qwen3.8-27B-1Bit-YaRN-1M is a machine learning model from Havoc1904. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as apache-2.0.
Reproducible pipeline that takes Qwen3.8-27B (native 256K context) from HF safetensors and produces 1-bit (IQ1) GGUFs with YaRN 1M-token context scaling, plus an abliterated/uncensored variant.
Downloads · 30 days
0
Access
Public
Updated Aug 17, 2026
Repo size
—
Likes
3
Public
Click a slice to open those files.
.md15.4 KB · 69%
From the Hugging Face model README
Reproducible pipeline that takes Qwen3.8-27B (native 256K context) from HF safetensors and produces 1-bit (IQ1) GGUFs with YaRN 1M-token context scaling, plus an abliterated/uncensored variant.
This repo is a reusable recipe: swap MODEL_DIR for any future Qwen3-style model and rerun.
All four variants are published and usable directly via ollama run:
| Model | Quant | Size | URL |
|---|---|---|---|
venkataparswanadh/qwen3.8-27b:iq1_s | IQ1_S | 8.7 GB | https://ollama.com/venkataparswanadh/qwen3.8-27b:iq1_s |
venkataparswanadh/qwen3.8-27b:iq1_m | IQ1_M | 9.2 GB | https://ollama.com/venkataparswanadh/qwen3.8-27b:iq1_m |
venkataparswanadh/qwen3.8-27b:ud-iq1_m | UD-IQ1_M (dynamic) | 10 GB | https://ollama.com/venkataparswanadh/qwen3.8-27b:ud-iq1_m |
venkataparswanadh/qwen3.8-27b-uncensored:iq1_m | IQ1_M (abliterated) | 9.2 GB | https://ollama.com/venkataparswanadh/qwen3.8-27b-uncensored:iq1_m |
All four carry the YaRN 4x bake (native 262144 → 1M context) in their GGUF metadata, and
num_ctx 1048576 is set in their Ollama Modelfiles.
File (in gguf/) | Description | Actual size |
|---|---|---|
imatrix-qwen3.8-27b.gguf | Importance matrix for quantization | ~14 MB |
qwen3.8-27b-IQ1_M-yarn.gguf | Base, IQ1_M 1-bit | 9.2 GB |
qwen3.8-27b-IQ1_S-yarn.gguf | Base, IQ1_S 1-bit | 8.7 GB |
qwen3.8-27b-UD-IQ1_M-yarn.gguf | Base, UD (dynamic) IQ1_M | 10 GB |
qwen3.8-27b-ablit-IQ1_M-yarn.gguf | Abliterated, IQ1_M 1-bit | 9.2 GB |
Sizes include the high-precision MTP head (blk.64.*, q8_0), embedding (q8_0) and output
(q6_k) tensors, which account for ~5.7 GB of each file. The GGUF files are published through
Ollama (above); this repo documents the pipeline.
HF safetensors (Qwen3.8-27B, arch = qwen35)
│
│ 1. convert_hf.sh convert_hf_to_gguf.py --outtype f16
▼
F16 GGUF (qwen3.8-27b-f16.gguf)
│
│ 2. run_imatrix.sh llama-imatrix (CUDA build), ~500MB+ corpus
▼
imatrix GGUF
│
│ 3. quant_base.sh llama-quantize → IQ1_M / IQ1_S / UD-IQ1_M
▼
1-bit GGUFs, YaRN 1M baked in
Four stages:
convert_hf_to_gguf.py turns the HF safetensors into an F16 GGUF.
Qwen3.8-27B uses architecture Qwen3_5ForConditionalGeneration, which llama.cpp maps to
GGUF arch qwen35 (this is why the override keys are qwen35.*).llama-imatrix computes per-tensor importance from a text corpus.
Needs a CUDA build of llama.cpp. The imatrix GGUF is fed to llama-quantize via --imatrix.llama-quantize with IQ1_M/IQ1_S and the imatrix.--override-kv flags embed YaRN 1M scaling directly into the GGUF
metadata at quantization time, so no runtime flags are needed.llama-imatrix; quantization itself is CPU-friendly but the
imatrix stage wants a GPU):
cmake -B build -DGGML_CUDA=ON && cmake --build build --config Release -j
llama.cpp uses
--chunks N --ctx-size 4096 --batch-size 2048). This repo uses ~818MB (wikitext-103-raw +
two Parquet dumps concatenated into corpus/corpus.txt).-ngl 99), so a 24GB+ GPU is
effectively required (26GB F16 + KV). CUDA must be available.torch/transformers present in the llama.cpp env for the converter.export HF_TOKEN=$(cat ~/.cache/huggingface/token) # or set your token
./convert_hf.sh /workspace/parshu/model /workspace/parshu/gguf/qwen3.8-27b-f16.gguf
./convert_hf.sh /workspace/parshu/model_ablit /workspace/parshu/gguf/qwen3.8-27b-ablit-f16.gguf
Equivalent to:
python3 /workspace/parshu/llama.cpp/convert_hf_to_gguf.py /workspace/parshu/model \
--outtype f16 --outfile /workspace/parshu/gguf/qwen3.8-27b-f16.gguf
/workspace/parshu/llama.cpp/build/bin/llama-imatrix \
-m /workspace/parshu/gguf/qwen3.8-27b-f16.gguf \
-f /workspace/parshu/corpus/corpus.txt \
-o /workspace/parshu/gguf/imatrix-qwen3.8-27b.gguf \
--output-format gguf --chunks 512 --ctx-size 4096 --batch-size 2048 \
-ngl 99 --no-ppl
Base variants:
LL=/workspace/parshu/llama.cpp/build/bin/llama-quantize
IM=/workspace/parshu/gguf/imatrix-qwen3.8-27b.gguf
IN=/workspace/parshu/gguf/qwen3.8-27b-f16.gguf
Y="--override-kv qwen35.rope.scaling.type=str:yarn --override-kv qwen35.rope.scaling.factor=float:4.0 --override-kv qwen35.rope.scaling.original_context_length=int:262144 --override-kv qwen35.rope.scaling.finetuned=bool:true"
# IQ1_M
$LL --imatrix $IM $Y --token-embedding-type q8_0 --output-tensor-type q6_k \
--tensor-type 'blk\.64\..*weight$=q8_0' \
$IN /workspace/parshu/gguf/qwen3.8-27b-IQ1_M-yarn.gguf IQ1_M 16
# IQ1_S
$LL --imatrix $IM $Y --token-embedding-type q8_0 --output-tensor-type q6_k \
--tensor-type 'blk\.64\..*weight$=q8_0' \
$IN /workspace/parshu/gguf/qwen3.8-27b-IQ1_S-yarn.gguf IQ1_S 16
# UD-IQ1_M (dynamic: attn q/k/v = Q6_K, attn_output = Q4_K, MLP = IQ1_M)
$LL --imatrix $IM $Y --token-embedding-type q8_0 --output-tensor-type q6_k \
--tensor-type 'blk\.64\..*weight$=q8_0' \
--tensor-type '.*\.attn_q\.weight$=q6_k' \
--tensor-type '.*\.attn_k\.weight$=q6_k' \
--tensor-type '.*\.attn_v\.weight$=q6_k' \
--tensor-type '.*\.attn_output\.weight$=q4_k' \
$IN /workspace/parshu/gguf/qwen3.8-27b-UD-IQ1_M-yarn.gguf IQ1_M 16
Abliterated variant:
$LL --imatrix $IM $Y --token-embedding-type q8_0 --output-tensor-type q6_k \
--tensor-type 'blk\.64\..*weight$=q8_0' \
/workspace/parshu/gguf/qwen3.8-27b-ablit-f16.gguf \
/workspace/parshu/gguf/qwen3.8-27b-ablit-IQ1_M-yarn.gguf IQ1_M 16
All four runs happen in parallel (see quant_base.sh / quant_ablit.sh).
blk.64.* tensor-type override is requiredQwen3.8-27B ships a Multi-Token-Prediction (MTP) head at block 64. The F16 GGUF includes its
tensors, but the imatrix contains no entries for them (they are not exercised by
llama-imatrix). Without a manual --tensor-type override, llama-quantize fails for the
IQ1 codebooks because IQ1 requires imatrix statistics for every tensor.
Workaround (attribution: bartowski):
--tensor-type 'blk\.64\..*weight$=q8_0'
This pins the MTP head weights to q8_0 so the quantizer skips them and never touches the
missing imatrix entries. IQ1 quantization then succeeds.
--override-kv keys)Qwen3.8-27B is native 256K. Qwen's official long-context recipe applies 4x YaRN scaling to reach 1M tokens — the same setting used in Qwen's own 1M-context models. These four keys are baked into each quantized GGUF at quantization time:
| Key | Value | Meaning |
|---|---|---|
qwen35.rope.scaling.type | str:yarn | YaRN scaling |
qwen35.rope.scaling.factor | float:4.0 | 4x length extension (256K → 1M) |
qwen35.rope.scaling.original_context_length | int:262144 | Native context (256K) |
qwen35.rope.scaling.finetuned | bool:true | Matches Qwen's finetuned YaRN params |
Because the values are baked into the GGUF metadata, no --override-kv or runtime flags are
needed at inference — llama.cpp reads the scaling directly from the file.
Verify after quantization:
/workspace/parshu/llama.cpp/build/bin/llama-quantize --help # or inspect with gguf-tools
Unsloth's "UD" approach keeps attention projection tensors at higher precision because they are much more sensitive to quantization error, while dropping MLP weights to 1-bit. This variant uses:
| Tensor group | Type |
|---|---|
attn_q / attn_k / attn_v | Q6_K |
attn_output | Q4_K |
| everything else (MLP, etc.) | IQ1_M |
blk.64.* (MTP head) | q8_0 |
| embeddings / output | q8_0 / q6_k |
Net effect: ~6.8 GB, slightly larger than plain IQ1_M, with better attention fidelity.
Any recent llama.cpp build (llama-cli, llama-server, llama.cpp bindings). Context length is
baked in; just set -c (e.g. -c 1000000) and optionally -fa/flash attention:
llama-cli -m qwen3.8-27b-IQ1_M-yarn.gguf -c 1000000 -fa -p "Long prompt…"
convert_hf.sh — HF safetensors → F16 GGUFrun_imatrix.sh — imatrix generation (CUDA llama.cpp)quant_base.sh — IQ1_M, IQ1_S, UD-IQ1_M from base F16 (YaRN baked)quant_ablit.sh — IQ1_M from abliterated F16 (YaRN baked)auto_pipeline.sh — watches quant completion → hash → blob → ollama create → pushREADME.md — this documentMODELCARD.md — per-variant model cards + quality disclaimerCREDITS.md — attribution