Improve model card: Add library_name, update paper link, and expand usage info
#1
by
nielsr
HF Staff
- opened
README.md
CHANGED
|
@@ -1,9 +1,9 @@
|
|
| 1 |
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
datasets:
|
| 4 |
-
- julien31/soar_arc_train_5M
|
| 5 |
base_model:
|
| 6 |
- Qwen/Qwen2.5-Coder-7B-Instruct
|
|
|
|
|
|
|
|
|
|
| 7 |
pipeline_tag: text-generation
|
| 8 |
tags:
|
| 9 |
- text-generation
|
|
@@ -13,16 +13,18 @@ tags:
|
|
| 13 |
- arc
|
| 14 |
- arc-agi
|
| 15 |
- soar
|
|
|
|
| 16 |
---
|
|
|
|
| 17 |
# SOAR-ARC Models: Self-Improving Language Models for Program Synthesis
|
| 18 |
|
| 19 |
<p align="center">
|
| 20 |
-
🤗 <a href="https://huggingface.co/collections/julien31/soar-arc-6856d27681fce01d9af4c4a3">Hugging Face (data and model)</a>   |    📑 <a href="https://
|
| 21 |
</p>
|
| 22 |
|
| 23 |
This repository contains one of the models fine-tuned using the **SOAR** (**S**elf-improving **O**perators for **A**utomated program **R**efinements) framework, as presented in the paper:
|
| 24 |
|
| 25 |
-
> [**Self-Improving Language Models for Evolutionary Program Synthesis: A Case Study on ARC-AGI**](https://
|
| 26 |
>
|
| 27 |
> Julien Pourcel, Cédric Colas, Pierre-Yves Oudeyer.
|
| 28 |
> *Proceedings of the 42nd International Conference on Machine Learning (ICML), 2025.*
|
|
@@ -64,9 +66,95 @@ This process creates a powerful feedback loop: the fine-tuned model becomes bett
|
|
| 64 |
|
| 65 |
The primary use of this model is to generate a Python function that solves an ARC task. The input to the model should be a formatted prompt containing the training and test examples of the ARC task.
|
| 66 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
For a complete, end-to-end example of how to format the prompt, run inference, execute the generated code, and visualize the results, please refer to the official repository and notebook:
|
| 68 |
|
| 69 |
* **Official SOAR GitHub Repository**: [https://github.com/flowersteam/SOAR](https://github.com/flowersteam/SOAR)
|
| 70 |
* **Inference & Visualization Notebook**: [https://github.com/flowersteam/SOAR/blob/main/notebook/inference_visualisation.ipynb](https://github.com/flowersteam/SOAR/blob/main/notebook/inference_visualisation.ipynb)
|
| 71 |
|
| 72 |
-
<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/made with unsloth.png" width="20%" />
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
|
|
|
|
|
|
|
|
|
| 2 |
base_model:
|
| 3 |
- Qwen/Qwen2.5-Coder-7B-Instruct
|
| 4 |
+
datasets:
|
| 5 |
+
- julien31/soar_arc_train_5M
|
| 6 |
+
license: apache-2.0
|
| 7 |
pipeline_tag: text-generation
|
| 8 |
tags:
|
| 9 |
- text-generation
|
|
|
|
| 13 |
- arc
|
| 14 |
- arc-agi
|
| 15 |
- soar
|
| 16 |
+
library_name: transformers
|
| 17 |
---
|
| 18 |
+
|
| 19 |
# SOAR-ARC Models: Self-Improving Language Models for Program Synthesis
|
| 20 |
|
| 21 |
<p align="center">
|
| 22 |
+
🤗 <a href="https://huggingface.co/collections/julien31/soar-arc-6856d27681fce01d9af4c4a3">Hugging Face (data and model)</a>   |    📑 <a href="https://huggingface.co/papers/2507.14172">Paper</a>    |    📑 <a href="https://julienp.netlify.app/posts/soar/">Blog</a>
|
| 23 |
</p>
|
| 24 |
|
| 25 |
This repository contains one of the models fine-tuned using the **SOAR** (**S**elf-improving **O**perators for **A**utomated program **R**efinements) framework, as presented in the paper:
|
| 26 |
|
| 27 |
+
> [**Self-Improving Language Models for Evolutionary Program Synthesis: A Case Study on ARC-AGI**](https://huggingface.co/papers/2507.14172)
|
| 28 |
>
|
| 29 |
> Julien Pourcel, Cédric Colas, Pierre-Yves Oudeyer.
|
| 30 |
> *Proceedings of the 42nd International Conference on Machine Learning (ICML), 2025.*
|
|
|
|
| 66 |
|
| 67 |
The primary use of this model is to generate a Python function that solves an ARC task. The input to the model should be a formatted prompt containing the training and test examples of the ARC task.
|
| 68 |
|
| 69 |
+
Here's a quick example to get started:
|
| 70 |
+
|
| 71 |
+
```python
|
| 72 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 73 |
+
import torch
|
| 74 |
+
|
| 75 |
+
model_id = "julien31/Soar-qwen-7b" # or any other Soar-qwen model
|
| 76 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 77 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 78 |
+
model_id,
|
| 79 |
+
torch_dtype=torch.bfloat16, # Use torch.float16 for GPUs that don't support bfloat16
|
| 80 |
+
device_map="auto",
|
| 81 |
+
)
|
| 82 |
+
|
| 83 |
+
prompt = "def solve_arc_task(input_grid, output_grid):\
|
| 84 |
+
\\\"\\\"\\\"Given an ARC-AGI task, transform the input grid to the output grid by applying a series of operations.\
|
| 85 |
+
\\\"\\\"\\\""
|
| 86 |
+
|
| 87 |
+
messages = [
|
| 88 |
+
{"role": "user", "content": prompt}
|
| 89 |
+
]
|
| 90 |
+
|
| 91 |
+
text = tokenizer.apply_chat_template(
|
| 92 |
+
messages,
|
| 93 |
+
tokenize=False,
|
| 94 |
+
add_generation_prompt=True
|
| 95 |
+
)
|
| 96 |
+
|
| 97 |
+
model_inputs = tokenizer(text, return_tensors="pt").to(model.device)
|
| 98 |
+
|
| 99 |
+
generated_ids = model.generate(
|
| 100 |
+
model_inputs.input_ids,
|
| 101 |
+
max_new_tokens=256,
|
| 102 |
+
do_sample=True,
|
| 103 |
+
temperature=0.7,
|
| 104 |
+
top_p=0.8,
|
| 105 |
+
repetition_penalty=1.1,
|
| 106 |
+
eos_token_id=tokenizer.eos_token_id,
|
| 107 |
+
pad_token_id=tokenizer.pad_token_id, # This is often the same as eos_token_id for Qwen models
|
| 108 |
+
)
|
| 109 |
+
|
| 110 |
+
# Decode only the newly generated text
|
| 111 |
+
decoded_output = tokenizer.decode(generated_ids[0, model_inputs.input_ids.shape[1]:], skip_special_tokens=True)
|
| 112 |
+
print(decoded_output)
|
| 113 |
+
```
|
| 114 |
+
|
| 115 |
For a complete, end-to-end example of how to format the prompt, run inference, execute the generated code, and visualize the results, please refer to the official repository and notebook:
|
| 116 |
|
| 117 |
* **Official SOAR GitHub Repository**: [https://github.com/flowersteam/SOAR](https://github.com/flowersteam/SOAR)
|
| 118 |
* **Inference & Visualization Notebook**: [https://github.com/flowersteam/SOAR/blob/main/notebook/inference_visualisation.ipynb](https://github.com/flowersteam/SOAR/blob/main/notebook/inference_visualisation.ipynb)
|
| 119 |
|
| 120 |
+
<img src="https://raw.githubusercontent.com/unslothai/unsloth/main/images/made with unsloth.png" width="20%" />
|
| 121 |
+
|
| 122 |
+
## Installation
|
| 123 |
+
|
| 124 |
+
### Conda inference environment
|
| 125 |
+
```
|
| 126 |
+
pip install --upgrade pip
|
| 127 |
+
|
| 128 |
+
git clone https://github.com/flowersteam/SOAR
|
| 129 |
+
cd SOAR
|
| 130 |
+
conda create --name sglang47 \
|
| 131 |
+
python=3.11 \
|
| 132 |
+
-y
|
| 133 |
+
conda activate sglang47
|
| 134 |
+
|
| 135 |
+
pip install "sglang[all]>=0.4.7"
|
| 136 |
+
|
| 137 |
+
pip install -e .
|
| 138 |
+
pip install -r requirements
|
| 139 |
+
|
| 140 |
+
```
|
| 141 |
+
|
| 142 |
+
### Conda training environment
|
| 143 |
+
```
|
| 144 |
+
conda create --name unsloth_env \
|
| 145 |
+
python=3.11 \
|
| 146 |
+
pytorch-cuda=12.1 \
|
| 147 |
+
pytorch cudatoolkit xformers -c pytorch -c nvidia -c xformers \
|
| 148 |
+
-y
|
| 149 |
+
conda activate unsloth_env
|
| 150 |
+
|
| 151 |
+
pip install unsloth
|
| 152 |
+
cd SOAR
|
| 153 |
+
pip install -e .
|
| 154 |
+
pip install -r requirements.txt
|
| 155 |
+
```
|
| 156 |
+
|
| 157 |
+
## Run SOAR
|
| 158 |
+
To run SOAR, please refer to execution instructions located in the experience folder.
|
| 159 |
+
|
| 160 |
+
For simple instructions on running sampling and refinement with SOAR, as well as exploring the dataset, please see the Jupyter notebooks provided in the `notebook` folder. These notebooks walk through the basic SOAR step, including how to generate candidate solutions, perform refinement, and analyze results. This hands-on guide will help you get started quickly and understand each step of the SOAR process.
|