re-func-namer-qwen2.5-coder-1.5b

LoRA fine-tune of Qwen/Qwen2.5-Coder-1.5B-Instruct that suggests a name for a function from its assembly. The function name in the input is masked as <FUNC>.

Output format: {"name": "snake_case_name"}

Files

  • adapter/ : LoRA adapter (requires the base model)
  • model-Q4_K_M.gguf : merged and quantized model for llama.cpp / Ollama
  • history.csv, curves.png : training history

Results

Held-out part of the validation set (444 functions, projects disjoint from train, not used for checkpoint selection):

F1 (name tokens) Exact match Valid JSON
Base model, no training 0.003 0.000 1.00
This adapter (step 400) 0.124 0.000 0.98

Not tested yet on other datasets or on real game binaries.

curves

Prompt format

Apply the model's chat template with this system prompt:

You are a reverse engineering assistant. Given an assembly function whose name is masked as <FUNC>, reply with JSON: {"name": "<snake_case_name>"}.

The user message is the assembly text with the function name replaced by <FUNC>.

Usage (adapter)

from transformers import AutoTokenizer, AutoModelForCausalLM
from peft import PeftModel

SYSTEM = 'You are a reverse engineering assistant. Given an assembly function whose name is masked as <FUNC>, reply with JSON: {"name": "<snake_case_name>"}.'
tok = AutoTokenizer.from_pretrained("Qwen/Qwen2.5-Coder-1.5B-Instruct")
base = AutoModelForCausalLM.from_pretrained("Qwen/Qwen2.5-Coder-1.5B-Instruct", torch_dtype="auto", device_map="auto")
model = PeftModel.from_pretrained(base, "AtesiT/re-func-namer-qwen2.5-coder-1.5b", subfolder="adapter")

asm = open("func.asm").read()   # replace the function name with <FUNC>
msgs = [{"role": "system", "content": SYSTEM}, {"role": "user", "content": asm}]
text = tok.apply_chat_template(msgs, tokenize=False, add_generation_prompt=True)
inputs = tok(text, return_tensors="pt", add_special_tokens=False).to(model.device)
out = model.generate(**inputs, max_new_tokens=32, do_sample=False)
print(tok.decode(out[0][inputs["input_ids"].shape[1]:], skip_special_tokens=True))

Usage (GGUF)

Run llama-server -m model-Q4_K_M.gguf -c 2048 and send chat requests to /v1/chat/completions with the system prompt above, so the chat template is applied.

Training

  • Data: subset of LLM4Binary/decompile-bench (21434 train examples after filtering); duplicates and name leaks removed; train/val split by source group.
  • QLoRA (4-bit NF4), r=32, lr=0.0001, fp16, max length 1024 tokens.
  • Best checkpoint chosen by F1 on a separate selection subset.

Limitations

  • The data is mostly GCC/Linux code; quality on MSVC/Windows game binaries is likely lower.
  • Names are suggestions, not ground truth: one function can have several good names.
  • Functions longer than about 1024 tokens were not seen in training.
  • The adapter was trained on a 4-bit base; the GGUF comes from an fp16 merge, so small quality differences are possible.

Intended use and disclaimer

For research, modding of single-player games, interoperability and learning. Do not use it to cheat in online games: this violates their terms of service and anti-cheat systems may ban you. Check the licenses of the base model and of the training data before reuse.

Downloads last month
44
GGUF
Model size
2B params
Architecture
qwen2
Hardware compatibility
Log In to add your hardware

4-bit

Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for AtesiT/re-func-namer-qwen2.5-coder-1.5b

Adapter
(237)
this model

Dataset used to train AtesiT/re-func-namer-qwen2.5-coder-1.5b