File size: 2,090 Bytes
cea4e21
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1ddf864
 
 
 
 
 
 
 
 
 
 
 
cea4e21
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
---
license: apache-2.0
base_model: Qwen/Qwen2.5-Coder-1.5B-Instruct
tags:
- code
- function-calling
- tool-use
- small-language-model
- small-code
datasets:
- NousResearch/hermes-function-calling-v1
language:
- en
pipeline_tag: text-generation
---

# small-code-coder-1.5b-tools

A LoRA fine-tune of **Qwen2.5-Coder-1.5B-Instruct** that teaches the model to emit
**native `<tool_call>` function calls**, so a ≤2B *coder* model can drive an agentic
coding loop.

Built for [**small-code**](https://github.com/seanpoyner/small-code) — an SLM-optimized
agentic coding assistant — for the Hugging Face **Build Small** hackathon.

## Why
Out of the box, small Qwen-Coder models describe tool calls as plain-text JSON
instead of emitting the native `<tool_call>` format that runtimes (Ollama,
llama.cpp) parse — which breaks agentic tool-use loops. This fine-tune closes
that gap on a tiny (≤2B, Tiny-Titan-class) model.

## Training
- **Base:** Qwen/Qwen2.5-Coder-1.5B-Instruct
- **Method:** bf16 LoRA (r=16, α=32) on attention + MLP projections, via TRL SFT
- **Data:** NousResearch/hermes-function-calling-v1 (rendered to Qwen ChatML so the
  target is native `<tools>`/`<tool_call>`)
- **Hardware:** NVIDIA DGX Spark (GB10)

## Use
Standard Qwen2.5 chat template with `tools=`. The model responds with
`<tool_call>{"name": ..., "arguments": ...}</tool_call>` when a tool is warranted.

## Status — experimental v1 ⚠️
This first pass (1 epoch, `max_length=1024`, ~3.7k examples) **does not yet
reliably emit `<tool_call>`** in free generation: teacher-forced token accuracy
was 0.92, but greedy decoding is degenerate and sensitive to the prompt template
(it was trained on the Hermes ChatML rendering, not Qwen's `apply_chat_template`
output — a train/inference mismatch). Treat as a proof-of-pipeline, not a
production tool-caller.

Known fixes for v2: align train and inference templates (use
`apply_chat_template(tools=...)` for both), more epochs, full sequence length,
and a held-out eval on tool-call emission.

## License
Apache-2.0 (inherits from the base model).