--- base_model: - hotdogs/Qwen3.8-27B-abliterated datasets: - hotdogs/code-analysis-sft-qwen38-v2 library_name: transformers model_type: qwen3_5 pipeline_tag: text-generation tags: - qwen3 - code-review - code-analysis - lora - sft - abliterated - multi-token-prediction - reasoning - mtp license: mit --- # Qwen3.8-27B Code Analysis Preview (v2) A **code-analysis / code-review** fine-tune of [`hotdogs/Qwen3.8-27B-abliterated`](https://huggingface.co/hotdogs/Qwen3.8-27B-abliterated), trained on the **v2 dataset** that fixes the *template-collapse* problem of v1. Given a snippet of code, it produces a **structured, multi-paragraph review** — real bugs found, line-level reasoning, severity, and a concrete fix in a code block. It is a **reasoning model**: it thinks first (separated into `reasoning_content` when served) and then answers. > **v1 → v2:** v1 was trained on a synthetic placeholder dataset (15 unique code bodies, 29–44 char answers like `## Review\n\nFound N issue(s) in L lines.`). The model faithfully reproduced the template — it answered *"No bugs found. Code is clean."* and missed real bugs. **v2** was retrained on 21,009 **real** code+bug+answer rows across 5 languages with 550–880 char detailed answers. The model now actually *finds* the bugs. ## Highlights - ✅ **Finds real bugs** — off-by-one, missing cache-hit, `fetch` not checking `res.ok`, async races, etc. - ✅ **Generalizes** — correctly analyzes bug types *not* in the training archetypes (base model supplies the code knowledge; the LoRA supplies the review structure) - ✅ **No hallucination** on clean code — says *"correct, no bugs"* instead of inventing problems - ✅ **Reasoning separated** — internal monologue goes to `reasoning_content`, user sees only the answer - ✅ **MTP preserved** — 15 multi-token-prediction tensors (`mtp.*` / `blk.64.nextn.*`) kept for speculative decoding ## How it was made | Step | Detail | |---|---| | Base | `hotdogs/Qwen3.8-27B-abliterated` (abliterated, ~27B) | | Method | Unsloth LoRA, **r=32**, 233M trainable params (0.85%) | | Dataset | [`hotdogs/code-analysis-sft-qwen38-v2`](https://huggingface.co/datasets/hotdogs/code-analysis-sft-qwen38-v2) — 21,009 train / 1,900 valid | | Languages | Python, JavaScript, Go, Rust, C | | Answer style | 550–880 chars, line numbers, severity, fix code block | | Sequence | max 2048 tokens, bf16, 5× RTX 3090 | | Early stop | step 400 / 1313 (epoch ~0.30, loss ~0.0003) — stopped before the 15 archetypes were memorized to death | | Merge | `merge_and_unload`, MTP 15 tensors recovered, no triple-nest | ## Smoke test (v2) | Case | Result | |---|---| | Off-by-one (in-archetype) | 🟢 Found it + fix + docstring note | | Async race (unseen) | 🟢 "no cache-hit fast path" + concurrency | | Clean code (hallucination test) | 🟢 "correct, no bugs" + minor float/bool note | ## Usage (transformers) ```python from transformers import AutoModelForImageTextToText, AutoTokenizer import torch MODEL = "hotdogs/Qwen3.8-27B-abliterated-code-analysis-preview" tok = AutoTokenizer.from_pretrained(MODEL, trust_remote_code=True) model = AutoModelForImageTextToText.from_pretrained( MODEL, torch_dtype=torch.bfloat16, device_map="auto", trust_remote_code=True, attn_implementation="sdpa") model.eval() def review(code, max_new=600): text = tok.apply_chat_template( [{"role": "user", "content": "Review this code and report any bugs you find.\n\n```python\n" + code + "\n```"}], tokenize=False, add_generation_prompt=True) inputs = tok(text, return_tensors="pt").to(model.device) with torch.no_grad(): out = model.generate(input_ids=inputs["input_ids"], attention_mask=inputs["attention_mask"], max_new_tokens=max_new, do_sample=False, repetition_penalty=1.05) new = out[0][inputs["input_ids"].shape[1]:] return tok.decode(new, skip_special_tokens=True) ``` ## Usage (GGUF) See the GGUF repo → [`hotdogs/Qwen3.8-27B-abliterated-code-analysis-preview-mtp-GGUF`](https://huggingface.co/hotdogs/Qwen3.8-27B-abliterated-code-analysis-preview-mtp-GGUF) ## Files 12 safetensors shards (~52 GB, bf16) + tokenizer, processor, config, chat template, generation config. 1,199 tensors incl. 15 MTP. ## License MIT (inherits the abliterated base).