Parameter-Efficient Fine-Tuning of Large Language Models for Unit Test Generation: An Empirical Study
Paper • 2411.02462 • Published • 10
Fine-tuned Qwen2.5-Coder-7B-Instruct model specialized in writing comprehensive end-to-end test plans and test cases for mobile games.
Given a mobile game feature description, the model generates professional QA test plans including:
| Parameter | Value |
|---|---|
| Base model | Qwen/Qwen2.5-Coder-7B-Instruct |
| Method | Supervised Fine-Tuning (SFT) with LoRA |
| LoRA rank | 16 |
| LoRA alpha | 32 |
| LoRA dropout | 0.1 |
| Target modules | q_proj, k_proj, v_proj, o_proj, gate_proj, up_proj, down_proj |
| Learning rate | 3e-4 |
| Epochs | 3 |
| Batch size | 1 (effective = 8 via gradient accumulation) |
| Max sequence length | 4096 |
| Packing | True |
| Loss on assistant only | True |
messages with user / assistant roles)pip install transformers trl peft accelerate datasets
python train.py
from transformers import AutoModelForCausalLM, AutoTokenizer, pipeline
model_id = "randomtravellerai/mobile-game-test-plans-qwen2.5-coder-7b-lora"
model = AutoModelForCausalLM.from_pretrained(model_id, device_map="auto")
tokenizer = AutoTokenizer.from_pretrained(model_id)
messages = [
{"role": "user", "content": "Write an end-to-end test plan for this mobile RPG game feature:\nFeature: Player opens the shop from the main hub, browses weapon skins, previews them on their character, and purchases using in-game currency."}
]
pipe = pipeline("text-generation", model=model, tokenizer=tokenizer)
result = pipe(messages, max_new_tokens=1024)
print(result[0]["generated_text"])
Training recipe adapted from:
Apache-2.0 (matching base model)
This model repository was generated by ML Intern, an agent for machine learning research and development on the Hugging Face Hub.