chaoscodes commited on
Commit
e0a4bcc
·
verified ·
1 Parent(s): 94391ba

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +460 -1
README.md CHANGED
@@ -2,4 +2,463 @@
2
  license: apache-2.0
3
  base_model:
4
  - Satori-reasoning/Satori-SWE-SFT-32B
5
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  license: apache-2.0
3
  base_model:
4
  - Satori-reasoning/Satori-SWE-SFT-32B
5
+ ---
6
+
7
+ # Satori‑SWE‑RL‑32B
8
+
9
+ ## Overview
10
+
11
+ 🚀 **Satori-SWE-RL-32B** is trained specifically to resolve software engineering tasks efficiently, using our proposed [**EvoScale**](https://arxiv.org/pdf/2505.23604) test-time scaling technique, and a novel training framework: two-stage SFT and RL. The model can iteratively self-improve its own generation to progressively write a better patch.
12
+
13
+
14
+ ## Training Data
15
+
16
+ - **SFT Dataset**: [Satori SFT Dataset](https://huggingface.co/datasets/Satori-reasoning/Satori-SWE-two-stage-SFT-data)
17
+ - **RL Dataset**: [Satori RL Dataset](https://huggingface.co/datasets/Satori-reasoning/Satori-SWE-RL-data)
18
+
19
+
20
+ ## Resources
21
+
22
+ 🔗 **GitHub Repository**: [Satori-SWE](https://github.com/Satori-Reasoning/Satori-SWE)
23
+
24
+ 🔗 **Blog Post**: [Blog](https://satori-reasoning.github.io/blog/satori-swe/)
25
+
26
+ 🔗 **Research Paper**: [Paper](https://arxiv.org/abs/2505.23604)
27
+
28
+
29
+ ## Prompt Template
30
+ ````python
31
+ classical_sft_prompt = """You are an expert software engineer and seasoned code reviewer, specializing in bug localization and code optimization within real-world code repositories. Your strengths lie in understanding complex codebase structures and precisely identifying and modifying the relevant parts of the code to resolve issues. You also excel at articulating your reasoning process in a coherent, step-by-step manner that leads to efficient and correct bug fixes.
32
+
33
+ You will be provided with a codebase and an issue description. Your task is to simulate a complete reasoning process—step-by-step—as if solving the issue from scratch, followed by the code modifications to resolve the issue.
34
+
35
+ ---
36
+
37
+ # Issue Statement
38
+ {problem_statement}
39
+
40
+ ---
41
+
42
+ # Files to be Modified
43
+ Below are some code files that might be relevant to the issue above. One or more of these files may contain bugs.
44
+
45
+ {files}
46
+
47
+ ---
48
+
49
+ # Reasoning Guidelines
50
+ Your reasoning process should generally follow these steps, with flexibility to adjust as needed for clarity and accuracy:
51
+
52
+ 1. **Issue Analysis**: Start by thoroughly analyzing the issue. Explain what the problem is, why it matters, and what the intended behavior should be. Identify the key goals and constraints that must be addressed in your solution.
53
+
54
+ 2. **Task Decomposition**: Break down the issue into smaller, manageable sub-tasks. Describe the purpose of each sub-task and how it contributes to solving the overall problem.
55
+
56
+ 3. **Code Localization and Editing**: For each sub-task:
57
+ - Identify relevant code snippets by file path and code location.
58
+ - Explain how each snippet relates to the sub-task.
59
+ - Describe how the code should be changed and justify your reasoning.
60
+ - After thorough explanation, provide the corresponding edited code.
61
+
62
+ ---
63
+
64
+ # General Requirements
65
+ 1. **Clear and Evidence-Based Reasoning**: Provide clear and precise reasoning for each step, strictly based on the provided issue and code without inferring information not explicitly stated.
66
+ 2. **Comprehensive and Concise**: Address all relevant aspects of the issue comprehensively while being concise. Justify the exclusion of any sections that are not relevant.
67
+ 3. **Detailed Guidance**: Ensure the reasoning steps are detailed enough to allow someone unfamiliar with the solution to infer and implement the necessary code modifications.
68
+
69
+ ---
70
+
71
+ # Response Format
72
+ 1. The reasoning process should be enclosed in <think> ... </think>.
73
+ 2. The final patch should be output in a standalone Python code block *after* the </think> block.
74
+ 3. Do not include any commentary or justification after the </think> block.
75
+
76
+ ---
77
+
78
+ # Patch Format
79
+ Please generate *SEARCH/REPLACE* edits to fix the issue. Every *SEARCH/REPLACE* edit must use this format:
80
+ 1. The file path
81
+ 2. The start of search block: <<<<<<< SEARCH
82
+ 3. A contiguous chunk of lines to search for in the existing source code
83
+ 4. The dividing line: =======
84
+ 5. The lines to replace into the source code
85
+ 6. The end of the replace block: >>>>>>> REPLACE
86
+
87
+ If, in `Files to be Modified` part, there are multiple files or multiple locations in a single file require changes. You should provide separate patches for each modification, clearly indicating the file name and the specific location of the modification.
88
+
89
+ Please note that the *SEARCH/REPLACE* edit REQUIRES PROPER INDENTATION. For example, if you would like to add the line ' print(x)', you must fully write that out, with all those spaces before the code! And remember to wrap the *SEARCH/REPLACE* edit in blocks ```python...```
90
+
91
+ # Example Response
92
+ <think>
93
+ 1. Analyze the issue...
94
+ 2. Locate the relevant code...
95
+ 3. Apply necessary changes...
96
+ </think>
97
+
98
+ ```python
99
+ ### mathweb/flask/app.py
100
+ <<<<<<< SEARCH
101
+ from flask import Flask
102
+ =======
103
+ import math
104
+ from flask import Flask
105
+ >>>>>>> REPLACE
106
+ ```
107
+
108
+ ```python
109
+ ### mathweb/utils/calc.py
110
+ <<<<<<< SEARCH
111
+ def calculate_area(radius):
112
+ return 3.14 * radius * radius
113
+ =======
114
+ def calculate_area(radius):
115
+ return math.pi * radius ** 2
116
+ >>>>>>> REPLACE
117
+ ```
118
+
119
+ ---
120
+
121
+ Please provide your response below.
122
+
123
+ """
124
+ ````
125
+
126
+ ````python
127
+ mutation_sft_prompt = """You are an expert software engineer and seasoned code reviewer, specializing in bug localization and code optimization, with a particular talent for critically evaluating teammates' patches and synthesizing high-quality, precise solutions from collaborative efforts.
128
+
129
+ You will be presented with a GitHub issue, the relevant source code files, and five *candidate patches* submitted by your teammates. Your task is twofold:
130
+
131
+ 1. **Patch Review**: Carefully evaluate each of the five candidate patches **individually**. Identify whether each patch resolves the issue correctly, partially, or incorrectly. If you identify any issues (e.g., logical errors, misunderstandings of the bug, overlooked edge cases, or incomplete fixes), explain them clearly and suggest what could be improved or corrected.
132
+
133
+ Even if a patch appears mostly correct, you should still analyze its strengths and limitations in detail. Treat this as a collaborative peer-review process: constructive, technical, and focused on improving code quality.
134
+
135
+ 2. **Patch Synthesis**: After analyzing all five candidate patches, synthesize your understanding to produce your **own final code patch** that fully resolves the issue. Your patch should:
136
+ - Be grounded solely in the issue description and provided source code.
137
+ - Be informed by your peer review, but not copy any one patch outright.
138
+
139
+ ---
140
+
141
+ # Issue Statement
142
+ {problem_statement}
143
+
144
+ ---
145
+
146
+ # Files to be Modified
147
+ Below are some code files that might be relevant to the issue above. One or more of these files may contain bugs.
148
+
149
+ {files}
150
+
151
+ ---
152
+
153
+ # Candidate Patches (From Collaborators)
154
+ Below are five proposed patches submitted by your teammates. You will evaluate them individually.
155
+ {candidate_patches}
156
+
157
+ ---
158
+
159
+ # Reasoning and Review Guidelines
160
+
161
+ Your response should be structured into two parts:
162
+
163
+ ## Part 1: Peer Patch Review
164
+ For each of the five candidate patches:
165
+ - Analyze the candidate patch's intent and correctness.
166
+ - Identify what it does well, what it gets wrong (if anything), and how it could be improved.
167
+ - Use precise references to the provided issue and source code files to justify your evaluation.
168
+
169
+ ## Part 2: Final Patch Synthesis
170
+ After completing all five reviews, your reasoning process should generally follow these steps, with flexibility to adjust as needed for clarity and accuracy:
171
+
172
+ 1. **Issue Analysis**: Start by thoroughly analyzing the issue. Explain what the problem is, why it matters, and what the intended behavior should be. Identify the key goals and constraints that must be addressed in your solution.
173
+
174
+ 2. **Task Decomposition**: Break down the issue into smaller, manageable sub-tasks. Describe the purpose of each sub-task and how it contributes to solving the overall problem.
175
+
176
+ 3. **Code Localization and Editing**: For each sub-task:
177
+ - Identify relevant code snippets by file path and code location.
178
+ - Explain how each snippet relates to the sub-task.
179
+ - Describe how the code should be changed and justify your reasoning.
180
+ - After thorough explanation, provide the corresponding edited code.
181
+
182
+ ---
183
+
184
+ # General Requirements
185
+ 1. **Clear and Evidence-Based Reasoning**: Provide clear and precise reasoning for each step, strictly based on the provided issue and code without inferring information not explicitly stated.
186
+ 2. **Comprehensive and Concise**: Address all relevant aspects of the issue comprehensively while being concise. Justify the exclusion of any sections that are not relevant.
187
+ 3. **Detailed Guidance**: Ensure the reasoning steps are detailed enough to allow someone unfamiliar with the solution to infer and implement the necessary code modifications.
188
+
189
+ ---
190
+
191
+ # Response Format
192
+ 1. The reasoning process should be enclosed in <think> ... </think>.
193
+ 2. The final patch should be output in a standalone Python code block *after* the </think> block.
194
+ 3. Do not include any commentary or justification after the </think> block.
195
+
196
+ ---
197
+
198
+ # Patch Format
199
+ Please generate *SEARCH/REPLACE* edits to fix the issue. Every *SEARCH/REPLACE* edit must use this format:
200
+ 1. The file path
201
+ 2. The start of search block: <<<<<<< SEARCH
202
+ 3. A contiguous chunk of lines to search for in the existing source code
203
+ 4. The dividing line: =======
204
+ 5. The lines to replace into the source code
205
+ 6. The end of the replace block: >>>>>>> REPLACE
206
+
207
+ If, in `Files to be Modified` part, there are multiple files or multiple locations in a single file require changes. You should provide separate patches for each modification, clearly indicating the file name and the specific location of the modification.
208
+
209
+ Please note that the *SEARCH/REPLACE* edit REQUIRES PROPER INDENTATION. For example, if you would like to add the line ' print(x)', you must fully write that out, with all those spaces before the code! And remember to wrap the *SEARCH/REPLACE* edit in blocks ```python...```
210
+
211
+ # Example Response
212
+ <think>
213
+ 1. Review of candidate patch:
214
+ - Review of patch-1: This patch attempts to fix X by modifying function Y. However, it fails to consider Z...
215
+ - Review of patch-2: ...
216
+ - Review of patch-3: ...
217
+ - Review of patch-4: ...
218
+ - Review of patch-5: ...
219
+ 2. Analyze the issue by myself...
220
+ 3. Locate the relevant code...
221
+ 4. Apply necessary changes...
222
+ </think>
223
+
224
+ ```python
225
+ ### mathweb/flask/app.py
226
+ <<<<<<< SEARCH
227
+ from flask import Flask
228
+ =======
229
+ import math
230
+ from flask import Flask
231
+ >>>>>>> REPLACE
232
+ ```
233
+
234
+ ```python
235
+ ### mathweb/utils/calc.py
236
+ <<<<<<< SEARCH
237
+ def calculate_area(radius):
238
+ return 3.14 * radius * radius
239
+ =======
240
+ def calculate_area(radius):
241
+ return math.pi * radius ** 2
242
+ >>>>>>> REPLACE
243
+ ```
244
+
245
+ ---
246
+
247
+ Please provide your response below.
248
+
249
+ """
250
+ ````
251
+
252
+
253
+
254
+ ## Usage: Toy Example
255
+
256
+ ````python
257
+ from vllm import LLM, SamplingParams
258
+
259
+ def generate(question, model_path):
260
+ llm = LLM(
261
+ model=model_path,
262
+ trust_remote_code=True,
263
+ tensor_parallel_size=8,
264
+ )
265
+
266
+ sampling_params = SamplingParams(
267
+ max_tokens=8192,
268
+ temperature=1.2,
269
+ n=1,
270
+ )
271
+ outputs = llm.generate([question], sampling_params, use_tqdm=True)
272
+ completions = [[output.text for output in output_item.outputs] for output_item in outputs]
273
+
274
+ return completions
275
+
276
+ # Classical Inference
277
+ model_path = "Satori-reasoning/Satori-SWE-RL-32B"
278
+ problem_statement = """I'm running `missing_colon.py` as follows:
279
+
280
+ ```python
281
+ division(23, 0)
282
+ ```
283
+
284
+ but I get the following error:
285
+
286
+ ```
287
+ File "/Users/fuchur/Documents/24/git_sync/swe-agent-test-repo/tests/./missing_colon.py", line 4
288
+ def division(a: float, b: float) -> float
289
+ ^
290
+ SyntaxError: invalid syntax
291
+ ```"""
292
+ file_str_concat = """```python
293
+ ### src/testpkg/missing_colon.py
294
+ #!/usr/bin/env python3
295
+
296
+ def division(a: float, b: float) -> float
297
+ return a/b
298
+
299
+
300
+ if __name__ == "__main__":
301
+ print(division(123, 15))
302
+ ```"""
303
+
304
+ completions = generate(
305
+ classical_sft_prompt.format(
306
+ problem_statement=problem_statement,
307
+ files=file_str_concat
308
+ ),
309
+ model_path
310
+ )
311
+
312
+ for completion in completions:
313
+ print(completion[0])
314
+
315
+
316
+
317
+ # Mutation inference
318
+
319
+ candidate_patches = """<patch>
320
+ ```python
321
+ ### src/testpkg/missing_colon.py
322
+ <<<<<<< SEARCH
323
+
324
+ def division(a: float, b: float) -> float
325
+ return a/b
326
+
327
+
328
+ if __name__ == "__main__":
329
+ print(division(123, 15))
330
+ =======
331
+
332
+ def division(a: float, b: float) -> float:
333
+ return a/b
334
+
335
+
336
+ if __name__ == "__main__":
337
+ print(division(123, 15))
338
+ >>>>>>> REPLACE
339
+ ```
340
+ </patch>
341
+
342
+ <patch>
343
+ ```python
344
+ ### src/testpkg/missing_colon.py
345
+ <<<<<<< SEARCH
346
+
347
+ def division(a: float, b: float) -> float
348
+ return a/b
349
+
350
+
351
+ if __name__ == "__main__":
352
+ print(division(123, 15))
353
+ =======
354
+
355
+ def division(a: float, b: float) -> float:
356
+ return a/b
357
+
358
+
359
+ if __name__ == "__main__":
360
+ print(division(123, 15))
361
+ >>>>>>> REPLACE
362
+ ```
363
+ </patch>
364
+
365
+ <patch>
366
+ ```python
367
+ ### src/testpkg/missing_colon.py
368
+ <<<<<<< SEARCH
369
+
370
+ def division(a: float, b: float) -> float
371
+ return a/b
372
+
373
+
374
+ if __name__ == "__main__":
375
+ print(division(123, 15))
376
+ =======
377
+
378
+ def division(a: float, b: float) -> float:
379
+ return a/b
380
+
381
+
382
+ if __name__ == "__main__":
383
+ print(division(123, 15))
384
+ >>>>>>> REPLACE
385
+ ```
386
+ </patch>
387
+
388
+ <patch>
389
+ ```python
390
+ ### src/testpkg/missing_colon.py
391
+ <<<<<<< SEARCH
392
+
393
+ def division(a: float, b: float) -> float
394
+ return a/b
395
+
396
+
397
+ if __name__ == "__main__":
398
+ print(division(123, 15))
399
+ =======
400
+
401
+ def division(a: float, b: float) -> float:
402
+ return a/b
403
+
404
+
405
+ if __name__ == "__main__":
406
+ print(division(123, 15))
407
+ >>>>>>> REPLACE
408
+ ```
409
+ </patch>
410
+
411
+ <patch>
412
+ ```python
413
+ ### src/testpkg/missing_colon.py
414
+ <<<<<<< SEARCH
415
+
416
+ def division(a: float, b: float) -> float
417
+ return a/b
418
+
419
+
420
+ if __name__ == "__main__":
421
+ print(division(123, 15))
422
+ =======
423
+
424
+ def division(a: float, b: float) -> float:
425
+ return a/b
426
+
427
+
428
+ if __name__ == "__main__":
429
+ print(division(123, 15))
430
+ >>>>>>> REPLACE
431
+ ```
432
+ </patch>"""
433
+
434
+ mutation_completions = generate(
435
+ mutation_sft_prompt.format(
436
+ problem_statement=problem_statement,
437
+ files=file_str_concat,
438
+ candidate_patches,candidate_patches
439
+ ),
440
+ model_path
441
+ )
442
+
443
+ for mutation_completion in mutation_completions:
444
+ print(mutation_completion[0])
445
+
446
+ ````
447
+
448
+
449
+
450
+ ## Citation
451
+
452
+ If you find this model useful, please cite our paper:
453
+
454
+ ```bibtex
455
+ @misc{zeng2025satorisweevolutionarytesttimescaling,
456
+ title={Satori-SWE: Evolutionary Test-Time Scaling for Sample-Efficient Software Engineering},
457
+ author={Guangtao Zeng and Maohao Shen and Delin Chen and Zhenting Qi and Subhro Das and Dan Gutfreund and David Cox and Gregory Wornell and Wei Lu and Zhang-Wei Hong and Chuang Gan},
458
+ year={2025},
459
+ eprint={2505.23604},
460
+ archivePrefix={arXiv},
461
+ primaryClass={cs.CL},
462
+ url={https://arxiv.org/abs/2505.23604},
463
+ }
464
+ ```