E2M adapters
adapters for generating machine code and C from English descriptions
2 min readupdated
A set of PEFT (small add-ons over the base model) for the AbundantFrontierInstitute research project that turns an English function description into C or x86-64 assembly code. The models are based on Qwen2.5-Coder-7B-Instruct and Qwen2.5-Coder-1.5B-Instruct using the QLoRA method. In practice, the system works best in a hybrid mode: the model writes C code, and the gcc compiler compiles it into machine code. The project will be useful for researchers and developers interested in automated code generation and compilation.
Key features
- Built on Qwen2.5-Coder models using QLoRA and DPO.
- Contain multiple sub-adapters for generating clean C or assembly.
- The main workflow uses a combination of C code generation followed by gcc compilation.
- Tested on a fixed set of 78 tasks using pass@1 and pass@5 metrics.
What you can do
- Load the
c-only-7badapter via the PEFT library to generate C code. - Use the
c-then-asmadapter to generate C followed by gcc compilation for better results. - Integrate the model into your experiments on automated low-level code generation.
- Explore the project repository to reproduce test results on the hidden task set.
Example
from transformers import AutoModelForCausalLM, AutoTokenizer
from peft import PeftModel
base_id = "Qwen/Qwen2.5-Coder-7B-Instruct"
repo_id = "AbundantFrontierInstitute/e2m"
tokenizer = AutoTokenizer.from_pretrained(base_id)
base = AutoModelForCausalLM.from_pretrained(base_id)
model = PeftModel.from_pretrained(base, repo_id, subfolder="c-only-7b")
Read more
DetailsBenchmarks (hidden set of 78 tasks): c-only-7b shows 46/78 pass@1 (56/78 pass@5) with gcc -O2; c-then-asm in hybrid mode achieves 48/78 pass@1 (61/78 pass@5).
Hardware requirements: match the base Qwen2.5-Coder-7B-Instruct model.
License: Apache-2.0.










Comments