base_model:
- meta-llama/Llama-3.1-8B-Instruct
license: apache-2.0
tags:
- reasoning
- agent
- program
- code
pipeline_tag: text-generation
library_name: transformers
CodeARC: Benchmarking Reasoning Capabilities of LLM Agents for Inductive Program Synthesis
Inductive program synthesis, or programming by example, requires synthesizing functions from input-output examples that generalize to unseen inputs. While large language model agents have shown promise in programming tasks guided by natural language, their ability to perform inductive program synthesis is underexplored. This work proposes CodeARC, the Code Abstraction and Reasoning Challenge, a new evaluation framework where agents interact with a hidden target function by querying it with new inputs, synthesizing candidate functions, and iteratively refining their solutions using a differential testing oracle. This interactive setting encourages agents to perform function calls and self-correction based on feedback, providing a more realistic and challenging testbed for evaluating LLM-based program synthesis and inductive reasoning. The model in this repository is a fine-tuned LLaMA-3.1-8B-Instruct model optimized for these tasks.
Paper
CodeARC: Benchmarking Reasoning Capabilities of LLM Agents for Inductive Program Synthesis
Code
https://github.com/Anjiang-Wei/CodeARC
Website
https://anjiang-wei.github.io/CodeARC-Website/
Datasets
- Problems Dataset: anjiangwei/CodeARC-Problems
- 10 Input-Output examples for each problem: anjiangwei/CodeARC-Invocations
Fine-tuned models
- https://huggingface.co/LLM4Code/CodeARC_annotated_llama3.1
- https://huggingface.co/LLM4Code/CodeARC_anonymous_llama3.1
Usage
You can use this fine-tuned model with the transformers
library for text generation tasks.
import torch
from transformers import AutoModelForCausalLM, AutoTokenizer, GenerationConfig
# Ensure you replace 'your-model-id' with the actual model ID of this repository
# For example, if this model is LLM4Code/CodeARC_annotated_llama3.1, use that.
# Assuming this model is one of the fine-tuned versions based on context.
model_name = "LLM4Code/CodeARC_annotated_llama3.1" # Example, please adjust if different
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype=torch.bfloat16, # Or torch.float16 if bfloat16 is not supported
device_map="auto",
)
model.eval()
# Example prompt for inductive program synthesis
# This example asks for a Python function based on input-output pairs
prompt = """<|begin_of_text|><|start_header_id|>user<|end_header_id|>
Synthesize a Python function `sum_list` that takes a list of integers and returns their sum.
Input: [1, 2, 3]
Output: 6
Input: [5, 0, -5]
Output: 0<|eot_id|>
<|start_header_id|>assistant<|end_header_id|>
```python
def sum_list(numbers):
# Your code here
"""
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
Generate response
generation_output = model.generate( **inputs, max_new_tokens=100, do_sample=True, top_p=0.9, temperature=0.6, eos_token_id=[tokenizer.eos_token_id, tokenizer.convert_tokens_to_ids("<|eom_id|>")] ) generated_text = tokenizer.decode(generation_output[0], skip_special_tokens=True)
print(generated_text)
For more detailed usage, evaluation scripts, and setting up the full CodeARC environment, please refer to the [official GitHub repository](https://github.com/Anjiang-Wei/CodeARC).
## Citation
If you use this model or the CodeARC framework in your research, please cite the corresponding paper:
```bibtex
@article{wei2025codearc,
title={CodeARC: Benchmarking Reasoning Capabilities of LLM Agents for Inductive Program Synthesis},
author={Wei, Anjiang and Suresh, Tarun and Cao, Jiannan and Kannan, Naveen and Wu, Yuheng and Yan, Kai and Teixeira, Thiago SFX and Wang, Ke and Aiken, Alex},
journal={arXiv preprint arXiv:2503.23145},
year={2025}
}
License
This project is licensed under the Apache 2.0 License. See the LICENSE file for details.