CoolFace
Modelpublic

ericnunes/qwen35-4b-fable5-sft

sourceHugging Faceapache-2.0updated 3mo agoView on Hugging Face
0likes385downloads
Model Card

ericnunes/qwen35-4b-fable5-sft

Description

Fine-tuned Qwen3.5-4B model using SFT (Supervised Fine-Tuning) with Claude Fable 5 traces.

This model was trained on agentic coding traces with chain-of-thought reasoning patterns.

Training Details

Benchmark Results (HumanEval+)

Modelpass@1Passed
Baseline (Qwen3.5-4B)0.493981/164
Fine-tuned (this model)0.579395/164

Improvement: +8.54pp (+17.3%)

Note on evaluation methodology

The baseline was re-evaluated with a corrected code extraction pipeline. An initial evaluation reported 3.66% (6/164) for the baseline, but this was due to a bug in the _extract_code function that stripped indentation from generated code. After fixing the extraction to preserve indentation and properly handle explanatory text (which the base model generates before code), the baseline was re-evaluated at 49.39% (81/164).

Both baseline and fine-tuned model were evaluated with the same corrected pipeline using:

  • —AutoModelForCausalLM + AutoTokenizer (transformers direct, avoids Unsloth multimodal issues)
  • —Greedy decoding (temperature=0.0, do_sample=False)
  • —Code extraction that preserves indentation and removes markdown/explanatory text
  • —Truncation at second def block to avoid multiple function generations
  • —HumanEval+ test suite via subprocess execution (10s timeout per problem)

Training Metrics

  • —Final train loss: 0.1357
  • —Final eval loss: 0.0698 (↓51.4% from 0.1435 baseline)
  • —Steps: 3,376 (2 epochs)
  • —No overfitting: train loss (0.066) ≈ eval loss (0.070)

Usage

python
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch

model = AutoModelForCausalLM.from_pretrained(
    "ericnunes/qwen35-4b-fable5-sft",
    torch_dtype=torch.bfloat16,
    device_map="auto",
)
tokenizer = AutoTokenizer.from_pretrained("ericnunes/qwen35-4b-fable5-sft")

messages = [
    {"role": "user", "content": "Write a Python function to check if a number is prime."}
]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(text, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=512, do_sample=False, pad_token_id=tokenizer.eos_token_id)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))

GGUF Files

This model is also available in GGUF format:

  • —model-Q4_K_M.gguf (2.57 GB) — recommended for most use cases
  • —model-Q8_0.gguf (4.26 GB) — higher precision
  • —model-f16.gguf (8.03 GB) — full precision

Disclaimer

This model was trained on traces of Claude Fable 5 (Mythos), a preview model that was briefly available. The traces contain agentic coding patterns with thinking/reasoning blocks.