license: cc-by-4.0
base_model: xtools-at/DeepSeek-V4-Pro-Qwen3.5-9B-UNCENSORED-heretic
base_model_relation: adapter
pipeline_tag: text-generation
language:
- en
tags: - gguf
- ollama
- qwen3_5
- lora
- code
- tool-use
- apple-silicon
- metal
datasets: - HuggingFaceH4/CodeAlpaca_20K
- NousResearch/hermes-function-calling-v1
DS-V4-Pro-Qwen3.5-9B-UNCENSORED-heretic-Metal
A small experimental coding and tool-use fine-tune of
xtools-at/DeepSeek-V4-Pro-Qwen3.5-9B-UNCENSORED-heretic.
This is a Qwen3.5-9B derivative. The release contains a repaired Q4_K_M base GGUF,
a trained LoRA adapter, and an Ollama Modelfile that loads both.
Use the Modelfile below to load the fine-tune. The weights are distributed as
two files, not a merged GGUF. Importing only model-ollama.gguf, including through
an automatic hf.co/... GGUF shortcut, does not apply the coding adapter.
Use with Ollama
Install Ollama and the
Hugging Face CLI,
and start Ollama. This bundle was tested with Ollama 0.30.9 on Apple M1,
16 GB unified memory. Other versions and platforms have not been tested.
On a 16 GB Mac, apply the Metal settings before using
the default 256K context, or use the smaller context example below.
Download the complete bundle (about 5.63 GB; no Hugging Face login required):
hf download askdkc/DS-V4-Pro-Qwen3.5-9B-UNCENSORED-heretic-Metal --local-dir heretic-coder-9B
cd heretic-coder-9B
ollama create heretic-coder -f Modelfile
ollama run heretic-coder --think=false
ollama create imports both the base and adapter. It also installs the coding
system prompt and generation settings. On a new machine, allow disk space for
both the downloaded files and Ollama's imported copy. After successful import,
the download directory is no longer needed for running the registered model.
Reasoning can be enabled:
ollama run heretic-coder --think=true
The reported coding checks used --think=false. Reasoning-on quality after this
fine-tune has not been evaluated.
Context size and output limits
The supplied Modelfile defaults to 262144 tokens (256K). This is a runtime
setting, not evidence of successful training or evaluation on 256K sequences.
A short request at this setting loaded and answered successfully; a full 256K
input and long-context accuracy have not been tested. Fine-tuning used sequences
up to 768 tokens.
For a smaller working context and a separate output cap, use Ollama's native API:
curl http://localhost:11434/api/chat -d '{
"model": "heretic-coder",
"messages": [{"role": "user", "content": "Write a Python function that splits a list into chunks."}],
"think": false,
"stream": false,
"options": {"num_ctx": 32768, "num_predict": 4096}
}'
num_ctx sets the working context; num_predict caps generated tokens. An output
cap alone does not reduce context allocation. With Ollama's OpenAI-compatible
endpoint, max_tokens limits output; set context through the model configuration.
For a persistent 32K CLI model, after creating heretic-coder:
printf 'FROM heretic-coder\nPARAMETER num_ctx 32768\nPARAMETER num_predict 4096\n' > Modelfile.32k
ollama create heretic-coder-32k -f Modelfile.32k
ollama run heretic-coder-32k --think=false
Apple Silicon and Metal
Ollama uses Metal on supported Apple Silicon Macs. The settings below reduce
context-cache memory and keep only one model/request active at a time. They
apply to the Ollama server process, not just the terminal running a client.
Quit an existing Ollama app/server first, then start this server in a terminal
and leave it running:
sh serve-metal.sh
The included script runs:
OLLAMA_HOST=127.0.0.1:11434 \
OLLAMA_FLASH_ATTENTION=1 \
OLLAMA_KV_CACHE_TYPE=q8_0 \
OLLAMA_NUM_PARALLEL=1 \
OLLAMA_MAX_LOADED_MODELS=1 \
ollama serve
Use another terminal for ollama create / ollama run. While a request is loaded,ollama ps shows its context size and GPU placement. These settings affect all
models served by that process. The GGUF files themselves are not Metal-specific.
On the tested M1, Q8 cache reduced Ollama's reported GPU allocation at 32K from
6.88 GB to 6.38 GB. Across five interleaved runs per setting, median generation
speed was 9.76 tokens/s with F16 cache and 9.59 tokens/s with Q8 cache. This was a
memory improvement, with a small speed tradeoff. At 256K with Q8 cache, a short
request used about 10.03 GB reported GPU allocation and all layers were on GPU.
These numbers exclude other applications and do not establish full-window performance.
Tool use
Pass tool definitions through Ollama's /api/chat API. Your agent application must
execute the returned tool calls and send their results back to the model; Ollama
does not execute workspace tools itself. A structured read_file request followed
by a response using the supplied file contents passed a local smoke check.
See the Ollama tool-calling guide.
Training and evaluation
The adapter was trained on the exact xtools-at source at revisionef863796ba0d5fb36aa9363bcdc6332387885f59, converted to 4-bit MLX weights with
group size 64. Training completed 200 optimizer updates on Apple M1 using MLX-LM
0.32.2 and MLX 0.32.4. Peak MLX allocation was 6.42 GB.
Only the last transformer layer's MLP projections (down_proj, gate_proj,up_proj) were trained: LoRA rank 16, scale 2, dropout 0.05, 786432 trainable
parameters, batch size 1, learning rate 0.00005, prompt masking, gradient
checkpointing, and maximum sequence length 768. The GGUF adapter uses alpha 32
to preserve the MLX scale. Checkpoint 200 was selected using all 64 validation
examples, then evaluated on a separate 64-example test split.
| Check | Repaired base | With coding adapter |
|---|---|---|
| MLX held-out test loss | 0.838 (rounded) | 0.3912 |
| Four small Python behavior checks | 0/4 | 3/4 |
| Generated functions with valid indentation in those checks | 0/4 | 4/4 |
The adapter passed chunked_items, balanced_brackets, and merge_ranges.
It failed unique_in_order by removing only adjacent duplicates. Coding checks
used Ollama, thinking disabled, seed 42, temperature 0.6, 32K context, and a
768-token output cap. F16 and Q8 caches produced the same 3/4 outcome.
This is a small smoke test, not a general coding benchmark or proof of reliable
autonomous coding. Exact prompt hashes are disjoint between data splits and
the four evaluation function names were excluded during preparation; semantic
overlap was not audited. Generated code still needs review and tests. Neither
long agent workflows nor post-fine-tune reasoning quality have been evaluated.
Public training data
Training pool: 512 examples (384 Python, 128 tool-use); validation and test:
64 examples each (48 Python, 16 tool-use). Seed: 20261107.
- HuggingFaceH4/CodeAlpaca_20K,
revision798c567f69c8f4b12fc191015e59ee34e9afe00d: filtered Python functions. - NousResearch/hermes-function-calling-v1,
revisiondae3e1d28cfbcf4b915c04ea1e072030529b4bda: normalized and schema-checked tool calls.
Raw training examples are not redistributed here. Dataset attribution and the
Hugging Face license sources used for this release are recorded in NOTICE.md.
Machine-readable details are in training-summary.json
and evaluation-summary.json.
Files and repair
| File | Role |
|---|---|
model-ollama.gguf |
Repaired Q4_K_M base, 5,629,111,264 bytes; Apache 2.0 |
coder-adapter.gguf |
Trained coding LoRA, 3,146,336 bytes; CC BY 4.0 for this release's contributions |
Modelfile |
Loads both files; 256K default, coding prompt, sampling settings |
serve-metal.sh |
Optional server launcher for Apple Silicon memory settings |
SHA256SUMS |
Checksums of the release files |
The original GGUF came from
mradermacher/DeepSeek-V4-Pro-Qwen3.5-9B-UNCENSORED-heretic-GGUF.
Its recurrent-layer metadata array had 33 entries for a 32-layer model. This
release removes the final extra entry so Ollama can import it. All 427 tensors
were verified byte-identical to the original, and the other metadata was
unchanged. The coding weight changes are entirely in the separate adapter.
License and attribution
The new adapter contributions, documentation, and configuration are published
by askdkc under CC BY 4.0, provided in
LICENSE. The bundled base model remains under Apache 2.0, provided
in LICENSES/Apache-2.0.txt. The repository's CC BY label
does not replace the base model's license.
Please credit askdkc/DS-V4-Pro-Qwen3.5-9B-UNCENSORED-heretic-Metal, link this repository and the applicable
licenses, identify further changes, and retain the upstream attributions in
NOTICE.md.