Views
No views yet
| Metric | Score |
|---|---|
| Overall accuracy | 92.5% (37/40) |
| Targeted CLI tools | 93.3% (28/30) |
| General tool-call (xLAM-style) | 90.0% (9/10) |
| Average latency | 2.73 s/case |
| Total generation time | 109.04 s |
| Tool | Accuracy | Avg latency |
|---|---|---|
ask_user_question | 5/5 (100%) | 4.25 s |
todo_write | 5/5 (100%) | 4.19 s |
glob | 5/5 (100%) | 1.59 s |
run_shell_command | 5/5 (100%) | 2.08 s |
grep_search | 4/5 (80%) | 1.95 s |
edit | 4/5 (80%) | 2.65 s |
get_weather | 1/1 (100%) | 1.34 s |
search_flights | 1/1 (100%) | 2.45 s |
calculate_mortgage | 1/1 (100%) | 3.02 s |
send_email | 1/1 (100%) | 2.74 s |
book_restaurant | 1/1 (100%) | 3.59 s |
get_stock_price | 1/1 (100%) | 1.39 s |
create_event | 0/1 (0%) | 3.30 s |
translate_text | 1/1 (100%) | 2.65 s |
get_directions | 1/1 (100%) | 2.90 s |
set_reminder | 1/1 (100%) | 2.10 s |
| Case | Expected | Got | Error |
|---|---|---|---|
| 16 | grep_search | search_code | Wrong function selected |
| 24 | edit | read_file | Wrong function selected |
| 37 | create_event | create_event | Missing title parameter |
<tool_call>
<function=FUNCTION_NAME>
<parameter=KEY>VALUE</parameter>
<parameter=KEY>VALUE</parameter>
</function>
</tool_call><tool_call>
<function=glob>
<parameter=pattern>**/*.py</parameter>
</function>
</tool_call>1import re
2
3FUNCTION_RE = re.compile(
4 r"<tool_call>\s*<function=([A-Za-z_][A-Za-z0-9_]*)>\s*"
5 r"(.*?)\s*</function>\s*</tool_call>",
6 flags=re.DOTALL,
7)
8PARAMETER_RE = re.compile(
9 r"<parameter=([A-Za-z_][A-Za-z0-9_]*)>\s*"
10 r"(.*?)\s*</parameter>",
11 flags=re.DOTALL,
12)
13
14def parse_tool_calls(text):
15 calls = []
16 for match in FUNCTION_RE.finditer(text):
17 function_name = match.group(1)
18 body = match.group(2)
19 params = {}
20 for key, value in PARAMETER_RE.findall(body):
21 value = value.strip()
22 if value.startswith("[") or value.startswith("{"):
23 import json
24 params[key] = json.loads(value)
25 else:
26 params[key] = value
27 calls.append({"function": function_name, "parameters": params})
28 return calls| Property | Value |
|---|---|
| Base model | TaimoorSiddiqui/Hopcoder-Mini-9B |
| Architecture | Qwen3.5ForConditionalGeneration (multimodal) |
| Model loader | AutoModelForImageTextToText |
| Precision | BF16 |
| PEFT type | LoRA |
| LoRA rank (r) | 16 |
| LoRA alpha | 32 |
| LoRA dropout | 0.05 |
| Target modules | q_proj, k_proj, v_proj, o_proj, in_proj_qkv, in_proj_z, in_proj_b, out_proj (excludes vision tower) |
| Trainable parameters | 0.12% of total (LoRA only) |
| Max sequence length | 1024 tokens |
| Property | Value |
|---|---|
| GPU | NVIDIA H200 (Modal cloud) |
| CPU | 16 physical cores |
| RAM | 64 GiB |
| Training time | ~45 min (453 steps) |
| Dataset | Source | Samples |
|---|---|---|
| xLAM function-calling | Salesforce/xlam-function-calling-60k | 3,500 |
| Hermes function-calling | NousResearch/hermes-function-calling-v1 (config: func_calling_singleturn) | 1,900 |
| Targeted CLI examples | 8 tools x 240 examples x 2 repeats | 3,840 |
| Total training examples | ~5,400+ |
ask_user_question — Show interactive questions in the CLItodo_write — Create or update a structured task listread_file — Read a UTF-8 text filesearch_code — Search source files for a text or regex patternglob — Find files by glob patterngrep_search — Search file contents for a regex patternedit — Replace text in a file with new contentrun_shell_command — Execute a shell command and return output| Parameter | Value |
|---|---|
| Learning rate | 1e-4 |
| Epochs | 1.0 |
| Train batch size | 4 |
| Eval batch size | 4 |
| Gradient accumulation | 4 |
| Effective batch size | 16 |
| LR scheduler | Cosine |
| Warmup ratio | 0.05 |
| Weight decay | 0.01 |
| Max grad norm | 1.0 |
| Optimizer | AdamW (fused) |
| Precision | BF16 + TF32 |
| Gradient checkpointing | Disabled |
| Dataloader workers | 16 |
| Seed | 42 |
| Metric | Value |
|---|---|
| Total steps | 453 |
| Train loss | 0.0034 |
| Eval loss | 0.0237 |
1<available_tools>
2<tool name="glob" args="pattern:path, path?">Find files by glob pattern (e.g., **/*.py).</tool>
3<tool name="grep_search" args="pattern:path, path?, glob?">Search file contents for a regex pattern.</tool>
4</available_tools>?array[object{label,description}])pip install torch transformers peft1import torch
2from transformers import AutoModelForImageTextToText, AutoProcessor
3from peft import PeftModel
4
5MODEL_ID = "TaimoorSiddiqui/Hopcoder-Mini-9B"
6ADAPTER_ID = "TaimoorSiddiqui/Hopcoder-Mini-9B-Native-ToolCall-LoRA-H200"
7
8processor = AutoProcessor.from_pretrained(MODEL_ID, trust_remote_code=True)
9tokenizer = processor.tokenizer
10if tokenizer.pad_token_id is None:
11 tokenizer.pad_token = tokenizer.eos_token
12
13model = AutoModelForImageTextToText.from_pretrained(
14 MODEL_ID,
15 trust_remote_code=True,
16 dtype=torch.bfloat16,
17 device_map="auto",
18)
19model = PeftModel.from_pretrained(model, ADAPTER_ID)
20model.eval()1SYSTEM_PROMPT = (
2 "Use the provided tools whenever the request requires one.\n\n"
3 "For a tool request, emit only complete native tool-call blocks. "
4 "Never emit a function name as a top-level tag. Never leave unmatched "
5 "parameter, function, or tool_call tags. Arrays and objects inside "
6 "parameter blocks must be valid JSON. Do not use Markdown fences.\n\n"
7)
8
9TOOLS_XML = (
10 "<available_tools>\n"
11 "<tool name=\"glob\" args=\"pattern:path, path?\">"
12 "Find files by glob pattern (e.g., **/*.py).</tool>\n"
13 "</available_tools>"
14)
15
16messages = [
17 {"role": "system", "content": SYSTEM_PROMPT + TOOLS_XML},
18 {"role": "user", "content": "Find all Python files in the project."},
19]
20
21prompt = processor.apply_chat_template(
22 messages,
23 tokenize=False,
24 add_generation_prompt=True,
25 enable_thinking=False,
26)
27
28inputs = tokenizer(prompt, return_tensors="pt", add_special_tokens=False).to(model.device)
29
30with torch.inference_mode():
31 outputs = model.generate(
32 **inputs,
33 max_new_tokens=384,
34 do_sample=False,
35 repetition_penalty=1.05,
36 eos_token_id=tokenizer.eos_token_id,
37 pad_token_id=tokenizer.pad_token_id,
38 )
39
40generated = outputs[0, inputs["input_ids"].shape[1]:]
41print(tokenizer.decode(generated, skip_special_tokens=True).strip())| Parameter | Value |
|---|---|
max_new_tokens | 384 |
do_sample | False (greedy) |
repetition_penalty | 1.05 |
enable_thinking | False |
tool_call, function, and parameterpython -m modal run --detach hopcoder_benchmark.pyhopcoder_benchmark.py) is included in this repository.search_code vs grep_search, read_file vs edit)| Component | Value |
|---|---|
| Platform | Modal |
| GPU | NVIDIA H200 |
| Image | Debian slim (Python 3.12) |
| Key libraries | torch 2.10.0, transformers 5.12.1, peft 0.19.1, datasets 5.0.0, accelerate 1.14.0 |
| HF cache | Modal volume (hopcoder-hf-cache) |
| Training output | Modal volume (hopcoder-training) |
| File | Description |
|---|---|
adapter_config.json | LoRA configuration (r=16, alpha=32, dropout=0.05) |
adapter_model.safetensors | Trained LoRA weights |
chat_template.jinja | Chat template for the base model |
processor_config.json | Processor configuration |
tokenizer.json | Tokenizer data |
tokenizer_config.json | Tokenizer configuration |
hopcoder_benchmark.py | Benchmark script (40 cases, 6 targeted + 10 general tools) |
1@misc{hopcoder-mini-9b-native-toolcall-lora-h200,
2 author = {Taimoor Siddiqui},
3 title = {HopCoder-Mini-9B Native Tool-Call LoRA Adapter (H200)},
4 year = {2026},
5 publisher = {HuggingFace},
6 url = {https://huggingface.co/TaimoorSiddiqui/Hopcoder-Mini-9B-Native-ToolCall-LoRA-H200}
7}