Yhyu13/Qwen3.5-2B-UE5-LoRA
UE5 MCP Tool-Calling LoRA — 2B
A PEFT/LoRA adapter that fine-tunes Qwen/Qwen3.5-2B to emit structured tool-calling responses for Unreal Engine 5 development tasks (function calls that conform to the UE5 MCP server's tool schema in `config/mcp_config.json`).
This is one of three adapters trained in the same recipe; the others are `Yhyu13/Qwen3.5-2B-UE5-LoRA` and `Yhyu13/Qwen3.5-4B-UE5-LoRA`. The training tooling, data and benchmark live in the parent project: [`Yhyu13/UE5_Training_MCP`](https://huggingface.co/Yhyu13/UE5_Training_MCP).
Model details
How to use
Requires peft + transformers. From the base model + adapter:
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
BASE = "Qwen/Qwen3.5-2B"
ADAPTER = "Yhyu13/Qwen3.5-2B-UE5-LoRA"
tok = AutoTokenizer.from_pretrained(BASE, trust_remote_code=True)
model = AutoModelForCausalLM.from_pretrained(
BASE, torch_dtype=torch.bfloat16, device_map="auto", trust_remote_code=True
)
model = PeftModel.from_pretrained(model, ADAPTER)
model.eval()
# See Yhyu13/UE5_Training_MCP/eval/benchmark_questions.jsonl for prompt format.
prompt = open("eval/example_prompt.txt").read()
inputs = tok(prompt, return_tensors="pt").to(model.device)
out = model.generate(**inputs, max_new_tokens=256, do_sample=False)
print(tok.decode(out[0], skip_special_tokens=True))Or, with the bundled chat template baked in:
ADAPTER = "Yhyu13/Qwen3.5-2B-UE5-LoRA"
tok = AutoTokenizer.from_pretrained(ADAPTER, trust_remote_code=True)
print(tok.chat_template[:200], "...") # matches the adapter's training chat templateTraining procedure
Reproduce with the scripts in `Yhyu13/UE5_Training_MCP`:
git clone https://huggingface.co/Yhyu13/UE5_Training_MCP
cd UE5_Training_MCP
python -m venv .venv && . .venv/bin/activate
pip install -r requirements.txt
python scripts/train_qwen35.py \
--base_model Qwen/Qwen3.5-2B \
--train data/splits/train.jsonl \
--val data/splits/val.jsonl \
--out outputs/models/qwen3.5-2b-ue5-loraHyperparameters come from train_meta.json (bundled in this repo).
Evaluation
final_eval.json records the validation loss after the third epoch. The full side-by-side benchmark (base vs. fine-tuned, tool-call exact-match rate, JSON schema conformance, and lm_eval results) lives in `Yhyu13/UE5_Training_MCP/outputs/results/`.
Limitations & intended use
- Trained on a small UE5-specific corpus (~hundreds of examples). Expect strong in-distribution behaviour on UE5 engine-API tool calls, weak generalising to non-UE5 or non-MCP tool schemas.
- Domain coverage leans to editor scripting (
cmd_*), Blueprint→Python (py_*), and the introspection tools declared in the bundledconfig/mcp_config.json. - Always validate emitted tool calls against the actual MCP server schema before executing against a running UE5 instance.
License
Apache-2.0 — same as the base Qwen3.5 model.
