Instructions to use m01001/Qwen3.8-27B-NInfer-Directional-Adapter with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- NInfer
How to use m01001/Qwen3.8-27B-NInfer-Directional-Adapter with NInfer:
# No code snippets available yet for this library. # To use this model, check the repository files and the library's documentation. # Want to help? PRs adding snippets are welcome at: # https://github.com/huggingface/huggingface.js
- Notebooks
- Google Colab
- Kaggle
Qwen3.8-27B NInfer Directional Adapter
This release adds request-level directional ablation to dense Qwen3.8-27B on the NInfer V100 fork. One server loads the NVFP4 checkpoint and a 20 KiB direction vector. The optional ninfer_abliteration boolean on each text Chat Completions request selects the stock or adapted forward pass. Both modes share the same resident model weights and output head.
The adapter is a raw residual-stream vector and requires the included NInfer runtime patches. The full model checkpoint is available separately from neroued/Qwen3.8-27B-nvfp4-NInfer. The vector is specific to this model's residual basis. Load it through NInfer's --abliteration-direction option.
Release files
| File | Purpose |
|---|---|
qwen38-hotdogs-direction.f32 |
A unit vector of 5,120 little-endian IEEE 754 float32 values with no header. Exactly 20,480 bytes. |
patches/01-rank-one-probe.patch through patches/04-directional-mtp2.patch |
Ordered patches for the pinned NInfer V100 source. Steps 01 and 02 are the intermediate probe changes. Step 03 replaces the probe with the directional adapter, and step 04 adds MTP target verification support. |
SHA256SUMS |
Checksums of the vector, patches, and accompanying license and notice files. |
LICENSE and NOTICE |
Apache 2.0 license and derivation record. |
The adapter vector SHA-256 is:
537f79fa1e84f2b7a1c7ef7c9baf05bec1575ee46b6db1ac160b702923f92c25
Run sha256sum --check SHA256SUMS from the release directory to check the downloaded files.
How the adapter was made
We estimated the edit direction by comparing two BF16 tensors between the official Qwen checkpoint and the Hotdogs abliterated checkpoint. We formed the two weight differences in FP32 and estimated each difference's leading left singular vector by power iteration. We aligned the signs, averaged, and normalized the results. The two estimates had an absolute cosine similarity of 0.999997020. The source revisions and tensor keys are recorded in NOTICE.
At inference time the CUDA implementation approximates the update v β v β 1.2 Γ d Γ dot(d, v) for a unit direction d and a residual contribution v. It applies the correction to token embeddings, full-attention output, Gated DeltaNet output, and FFN down-projection contributions. For fused residual writes it measures the projection before and after the write and corrects the difference at the BF16 residual boundary. The quantized forward pass and its rounding make this an approximation of Hotdogs' offline BF16 weight edit.
For multi-token prediction (MTP), the target verifies candidates using the adapted forward pass. The stock proposer receives the adapted target hidden state. With CUDA Graphs enabled, stock decode can use the captured path and adapted decode runs eagerly.
Build and run
The original run used a single Tesla V100 PCIe 32 GB, the NInfer V100 1.6.2 build line, and the source checkout below. See the NInfer V100 build instructions for CUDA, CMake, compiler, and dependency requirements. Compile the server for Volta (sm_70).
From the extracted release directory:
release_dir="$PWD"
git clone https://github.com/JimmyMax/ninfer-v100.git ninfer-v100
cd ninfer-v100
git checkout --detach ab6f496e0a7add125af621b8230bf0c709450a34
for patch in "$release_dir"/patches/0[1-4]-*.patch; do
git apply --index --check "$patch" || exit 1
git apply --index "$patch" || exit 1
done
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_CUDA_ARCHITECTURES=70
cmake --build build --target ninfer-serve -j
Download the compatible checkpoint with the Hugging Face CLI:
hf download neroued/Qwen3.8-27B-nvfp4-NInfer \
qwen3_8_27b_nvfp4.ninfer --local-dir models
printf '%s %s\n' \
'74d2c57145e6ff11d1d2faa79594477f9bc903a611af1fb20218189fbbb77d82' \
'models/qwen3_8_27b_nvfp4.ninfer' | sha256sum --check
Start the server in the tested MTP2 configuration, with both modes using eager decode:
./build/apps/ninfer-serve models/qwen3_8_27b_nvfp4.ninfer \
--host 127.0.0.1 --port 8080 --model-id qwen38-directional-adapter \
--max-context 8192 --kv-capacity 8192 --kv-dtype int8 \
--max-concurrency 1 --no-thinking --no-prefix-reuse --no-cuda-graph \
--abliteration-direction "$release_dir/qwen38-hotdogs-direction.f32" \
--spec mtp --draft-tokens 2 --lm-head-draft \
--ngram-draft-tokens 0 --lookup-ngram 0
In another shell, send OFF β ON β OFF to the same server. Omitting ninfer_abliteration selects the same stock path as false.
for enabled in false true false; do
printf '\nAdapter enabled = %s\n' "$enabled"
curl --fail --silent --show-error \
http://127.0.0.1:8080/v1/chat/completions \
-H 'Content-Type: application/json' \
--data "{
\"model\": \"qwen38-directional-adapter\",
\"messages\": [{\"role\": \"user\", \"content\": \"List the integers from 1 through 12, separated by commas.\"}],
\"temperature\": 0,
\"seed\": 42,
\"max_tokens\": 32,
\"logprobs\": true,
\"top_logprobs\": 5,
\"ninfer_abliteration\": $enabled
}" || exit 1
printf '\n'
done
Compare token scores as well as text. A short prompt can produce the same visible text even if its token scores change. To expose both modes in a model router, point both entries at the same process and inject ninfer_abliteration: true on the adapted entry.
Validation and scope
The original OFF β ON β OFF smoke test reproduced the base token scores after switching back and measured changes with the adapter enabled during prefill and decode. A separate three-task MTP2 timing check used greedy decoding, thinking off, and up to 256 generated tokens per task. Both modes used eager decode.
| Mode | Median decode | Accepted MTP drafts |
|---|---|---|
| Stock | 64.7 tok/s | 425/675 (63.0%) |
| Adapter enabled | 63.7 tok/s | 434/660 (65.8%) |
This was a local runtime and throughput check. Refusal rates, broad quality changes, multimodal behavior, and performance at longer contexts were outside that evaluation. The patched runtime supports text requests, one GPU, one active request, disabled prefix reuse, and ordinary or MTP decoding. Leave grafts and n-gram drafts disabled.
Credits and license
- Qwen released the base Qwen3.8-27B checkpoint.
- Hotdogs released the abliterated BF16 checkpoint used to recover the direction. Its model card documents the original edit and its evaluation.
- Neroued published NInfer and the NVFP4 checkpoint. JimmyMax and contributors maintain the V100 fork used here.
The derived direction and runtime patches are released under Apache 2.0. See LICENSE and NOTICE for the distribution terms and provenance.
- Downloads last month
- -
Model tree for m01001/Qwen3.8-27B-NInfer-Directional-Adapter
Base model
Qwen/Qwen3.8-27B