Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,96 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
language:
|
| 4 |
+
- en
|
| 5 |
+
library_name: transformers
|
| 6 |
+
pipeline_tag: text-generation
|
| 7 |
+
base_model: ByteDance-Seed/Seed-Coder-8B-Reasoning
|
| 8 |
+
tags:
|
| 9 |
+
- code
|
| 10 |
+
- structural-engineering
|
| 11 |
+
- openseespy
|
| 12 |
+
- scientific-modeling
|
| 13 |
+
- reinforcement-learning
|
| 14 |
+
- grpo
|
| 15 |
+
- autobm
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
+
# AutoBM-Seed-Coder-8B-R
|
| 19 |
+
|
| 20 |
+
Official model release for the paper *Rethinking Scientific Modeling: Toward Physically Consistent and Simulation-Executable Programmatic Generation*.
|
| 21 |
+
|
| 22 |
+
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:
|
| 23 |
+
|
| 24 |
+
- **Stage I — Domain Instruction Fine-Tuning (SFT)** on the CivilInstruct dataset (10,912 samples).
|
| 25 |
+
- **Stage II — Self-Play Constraint GRPO (SPC-GRPO)** with the Multi-Granularity Hybrid Reward (MGHR), combining format, AST, and OpenSeesPy execution rewards.
|
| 26 |
+
|
| 27 |
+
The resulting model generates **executable, physically consistent OpenSeesPy structural modeling code** from natural language building specifications.
|
| 28 |
+
|
| 29 |
+
## BMEval Results
|
| 30 |
+
|
| 31 |
+
| Model | Pass@1 | Pass@5 | Pass@5_period | Pass@5_compliance | Pass@5_strict | Overall Avg |
|
| 32 |
+
|-------|--------|--------|---------------|-------------------|---------------|-------------|
|
| 33 |
+
| Seed-Coder-8B-R (baseline) | 11.72 | 21.09 | 0.78 | 3.13 | 0.78 | 6.51 |
|
| 34 |
+
| **AutoBM-Seed-Coder-8B-R (this model)** | **64.18** | **97.28** | **78.05** | **92.47** | **77.14** | **81.95** |
|
| 35 |
+
|
| 36 |
+
## Usage
|
| 37 |
+
|
| 38 |
+
```python
|
| 39 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 40 |
+
import torch
|
| 41 |
+
|
| 42 |
+
model_id = "yongqiqng/AutoBM-Seed-Coder-8B-R"
|
| 43 |
+
tokenizer = AutoTokenizer.from_pretrained(model_id)
|
| 44 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 45 |
+
model_id,
|
| 46 |
+
torch_dtype=torch.bfloat16,
|
| 47 |
+
device_map="auto",
|
| 48 |
+
)
|
| 49 |
+
|
| 50 |
+
prompt = '''Generate OpenSeesPy code to model a 5-story reinforced concrete frame building:
|
| 51 |
+
- Floor height: 3.5 m
|
| 52 |
+
- Bay width: 6 m (3 bays in X, 2 bays in Y)
|
| 53 |
+
- Seismic intensity: 0.2g
|
| 54 |
+
Compute the fundamental period.'''
|
| 55 |
+
|
| 56 |
+
messages = [{"role": "user", "content": prompt}]
|
| 57 |
+
inputs = tokenizer.apply_chat_template(messages, return_tensors="pt", add_generation_prompt=True).to(model.device)
|
| 58 |
+
outputs = model.generate(inputs, max_new_tokens=4096, temperature=0.6, top_p=0.95, do_sample=True)
|
| 59 |
+
print(tokenizer.decode(outputs[0][inputs.shape[1]:], skip_special_tokens=True))
|
| 60 |
+
```
|
| 61 |
+
|
| 62 |
+
## Training Details
|
| 63 |
+
|
| 64 |
+
| Stage | Method | Data |
|
| 65 |
+
|-------|--------|------|
|
| 66 |
+
| Stage I | Supervised Fine-Tuning | CivilInstruct SFT (9,894 train + 202 val) |
|
| 67 |
+
| Stage II | SPC-GRPO with MGHR | CivilInstruct RL (455 train + 57 test) |
|
| 68 |
+
|
| 69 |
+
The MGHR reward function combines:
|
| 70 |
+
- `r_fmt` (Format, weight 0.05) — `<think>...</think><answer>...</answer>` structure
|
| 71 |
+
- `r_ast` (AST, weight 0.25) — three-tiered OpenSeesPy API coverage
|
| 72 |
+
- `r_exec` (Execution, weight 0.70) — sandboxed OpenSeesPy execution + period error grading
|
| 73 |
+
|
| 74 |
+
See the [paper](https://arxiv.org/abs/2602.07083) and [training code](https://github.com/Jovanqing/AutoBM) for details.
|
| 75 |
+
|
| 76 |
+
## Related
|
| 77 |
+
|
| 78 |
+
- Paper: [arXiv:2602.07083](https://arxiv.org/abs/2602.07083)
|
| 79 |
+
- Code: [github.com/Jovanqing/AutoBM](https://github.com/Jovanqing/AutoBM)
|
| 80 |
+
- Sample data: [yongqiqng/CivilInstruct-Sample](https://huggingface.co/datasets/yongqiqng/CivilInstruct-Sample)
|
| 81 |
+
- Base model: [ByteDance-Seed/Seed-Coder-8B-Reasoning](https://huggingface.co/ByteDance-Seed/Seed-Coder-8B-Reasoning)
|
| 82 |
+
|
| 83 |
+
## Citation
|
| 84 |
+
|
| 85 |
+
```bibtex
|
| 86 |
+
@article{jiang2026rethinking,
|
| 87 |
+
title={Rethinking Scientific Modeling: Toward Physically Consistent and Simulation-Executable Programmatic Generation},
|
| 88 |
+
author={Jiang, Yongqing and Wang, Jianze and Shen, Zhiqi and Lin, Zhenghong and Wang, Jiayuan and Yang, Yijian and Dai, Kaoshan and Luo, Haoran},
|
| 89 |
+
journal={arXiv preprint arXiv:2602.07083},
|
| 90 |
+
year={2026}
|
| 91 |
+
}
|
| 92 |
+
```
|
| 93 |
+
|
| 94 |
+
## License
|
| 95 |
+
|
| 96 |
+
Released under the Apache 2.0 License, consistent with the base Seed-Coder-8B-Reasoning model.
|