Views
No views yet
Re:Form pipeline focuses on reducing human priors in complex programming tasks through an automatic and scalable data curation pipeline. It integrates careful Reinforcement Learning (RL) designs with feedback from a formal language verifier. This methodology allows even small models (e.g., 0.5B) to generate syntactically valid and verifiable Dafny code, surpassing proprietary models and demonstrating stronger generalization to out-of-domain tasks, including on the challenging DafnyComp benchmark.
Re:Form models with the Hugging Face transformers library. The model uses the Qwen2ForCausalLM architecture.1from transformers import AutoModelForCausalLM, AutoTokenizer
2import torch
3
4# Replace "Veri-Code/sft_7B" with the specific model checkpoint you want to load
5# e.g., "Veri-Code/sft_0.5B", "Veri-Code/sft_1.5B", "Veri-Code/sft_3B", "Veri-Code/sft_14B", or "Veri-Code/14B-RL-entropy"
6model_id = "Veri-Code/sft_7B"
7
8tokenizer = AutoTokenizer.from_pretrained(model_id)
9model = AutoModelForCausalLM.from_pretrained(
10 model_id,
11 torch_dtype=torch.bfloat16, # Adjust dtype based on your hardware (e.g., torch.float16 for GPUs without bfloat16 support)
12 device_map="auto"
13)
14
15# Example: Generate Dafny code for a function that returns the absolute value
16dafny_prompt = """function Abs(x: int): int
17ensures Abs(x) >= 0
18{
19"""
20
21inputs = tokenizer.apply_chat_template([{"role": "user", "content": dafny_prompt}], return_tensors="pt", add_generation_prompt=True)
22outputs = model.generate(inputs.to(model.device), max_new_tokens=100)
23generated_text = tokenizer.decode(outputs[0], skip_special_tokens=True)
24
25print(generated_text)1@misc{yan2025reformreducinghuman,
2 title={Re:Form -- Reducing Human Priors in Scalable Formal Software Verification with RL in LLMs: A Preliminary Study on Dafny},
3 author={Chuanhao Yan and Fengdi Che and Xuhan Huang and Xu Xu and Xin Li and Yizhi Li and Xingwei Qu and Jingzhe Shi and Zhuangzhuang He and Chenghua Lin and Yaodong Yang and Binhang Yuan and Hang Zhao and Yu Qiao and Bowen Zhou and Jie Fu},
4 year={2025},
5 eprint={2507.16331},
6 archivePrefix={arXiv},
7 primaryClass={cs.CL},
8 url={https://arxiv.org/abs/2507.16331},
9}