Model details
Table with columns: Item, Value| Item | Value |
|---|
| Base model | Qwen/Qwen3.5-4B |
| PEFT type | LoRA (rank 16, α 32, dropout 0.05) |
| Target modules | q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj |
| Task | CAUSAL_LM (tool-call text generation) |
| Training data | data/splits/train.jsonl of Yhyu13/UE5_Training_MCP (a small UE5 corpus bundled with the training repo; not published as a separate HF dataset) (108 examples) |
| Eval data | data/splits/val.jsonl (13 examples) |
| Max seq length | 512 |
| Epochs | 3 |
| Effective batch size | 8 (per_device 4 × grad_accum 2) |
| Learning rate | 3e-4 |
| Wall-clock training | 592.3s on 1×CUDA 12.1 |
| Train framework | PEFT 0.19.1 · Transformers 5.14.1 · TRL 0.26.2 · Torch 2.5.1+cu121 |
| Adapter size | 81.0 MB (adapter_model.safetensors) |
| Eval loss (val) | 0.5216 |
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-4B"
ADAPTER = "Yhyu13/Qwen3.5-4B-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()
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-4B-UE5-LoRA"
tok = AutoTokenizer.from_pretrained(ADAPTER, trust_remote_code=True)
print(tok.chat_template[:200], "...")
Training 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-4B \
--train data/splits/train.jsonl \
--val data/splits/val.jsonl \
--out outputs/models/qwen3.5-4b-ue5-lora
Hyperparameters 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 bundled
config/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.