File size: 3,853 Bytes
55e8e2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
---
license: apache-2.0
language:
  - en
library_name: transformers
pipeline_tag: text-generation
base_model: ByteDance-Seed/Seed-Coder-8B-Reasoning
tags:
  - code
  - structural-engineering
  - openseespy
  - scientific-modeling
  - reinforcement-learning
  - grpo
  - autobm
---

# AutoBM-Seed-Coder-8B-R

Official model release for the paper *Rethinking Scientific Modeling: Toward Physically Consistent and Simulation-Executable Programmatic Generation*.

This model is trained from [`ByteDance-Seed/Seed-Coder-8B-Reasoning`](https://huggingface.co/ByteDance-Seed/Seed-Coder-8B-Reasoning) via the **RLA-SPC** two-stage alignment strategy:

- **Stage I — Domain Instruction Fine-Tuning (SFT)** on the CivilInstruct dataset (10,912 samples).
- **Stage II — Self-Play Constraint GRPO (SPC-GRPO)** with the Multi-Granularity Hybrid Reward (MGHR), combining format, AST, and OpenSeesPy execution rewards.

The resulting model generates **executable, physically consistent OpenSeesPy structural modeling code** from natural language building specifications.

## BMEval Results

| Model | Pass@1 | Pass@5 | Pass@5_period | Pass@5_compliance | Pass@5_strict | Overall Avg |
|-------|--------|--------|---------------|-------------------|---------------|-------------|
| Seed-Coder-8B-R (baseline) | 11.72 | 21.09 | 0.78 | 3.13 | 0.78 | 6.51 |
| **AutoBM-Seed-Coder-8B-R (this model)** | **64.18** | **97.28** | **78.05** | **92.47** | **77.14** | **81.95** |

## Usage

```python
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch

model_id = "yongqiqng/AutoBM-Seed-Coder-8B-R"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
    model_id,
    torch_dtype=torch.bfloat16,
    device_map="auto",
)

prompt = '''Generate OpenSeesPy code to model a 5-story reinforced concrete frame building:
- Floor height: 3.5 m
- Bay width: 6 m (3 bays in X, 2 bays in Y)
- Seismic intensity: 0.2g
Compute the fundamental period.'''

messages = [{"role": "user", "content": prompt}]
inputs = tokenizer.apply_chat_template(messages, return_tensors="pt", add_generation_prompt=True).to(model.device)
outputs = model.generate(inputs, max_new_tokens=4096, temperature=0.6, top_p=0.95, do_sample=True)
print(tokenizer.decode(outputs[0][inputs.shape[1]:], skip_special_tokens=True))
```

## Training Details

| Stage | Method | Data |
|-------|--------|------|
| Stage I | Supervised Fine-Tuning | CivilInstruct SFT (9,894 train + 202 val) |
| Stage II | SPC-GRPO with MGHR | CivilInstruct RL (455 train + 57 test) |

The MGHR reward function combines:
- `r_fmt` (Format, weight 0.05) — `<think>...</think><answer>...</answer>` structure
- `r_ast` (AST, weight 0.25) — three-tiered OpenSeesPy API coverage
- `r_exec` (Execution, weight 0.70) — sandboxed OpenSeesPy execution + period error grading

See the [paper](https://arxiv.org/abs/2602.07083) and [training code](https://github.com/Jovanqing/AutoBM) for details.

## Related

- Paper: [arXiv:2602.07083](https://arxiv.org/abs/2602.07083)
- Code: [github.com/Jovanqing/AutoBM](https://github.com/Jovanqing/AutoBM)
- Sample data: [yongqiqng/CivilInstruct-Sample](https://huggingface.co/datasets/yongqiqng/CivilInstruct-Sample)
- Base model: [ByteDance-Seed/Seed-Coder-8B-Reasoning](https://huggingface.co/ByteDance-Seed/Seed-Coder-8B-Reasoning)

## Citation

```bibtex
@article{jiang2026rethinking,
  title={Rethinking Scientific Modeling: Toward Physically Consistent and Simulation-Executable Programmatic Generation},
  author={Jiang, Yongqing and Wang, Jianze and Shen, Zhiqi and Lin, Zhenghong and Wang, Jiayuan and Yang, Yijian and Dai, Kaoshan and Luo, Haoran},
  journal={arXiv preprint arXiv:2602.07083},
  year={2026}
}
```

## License

Released under the Apache 2.0 License, consistent with the base Seed-Coder-8B-Reasoning model.