Skip to content

sixticket/reactor_design_optimization

Repository files navigation

ReactorFold

Language models discover non-intuitive reactor core designs through emergent physical reasoning


Overview

ReactorFold reformulates pressurized-water-reactor (PWR) fuel assembly design as a sequence modeling problem for language models. The model learns to generate candidate 17×17 fuel assembly layouts that satisfy neutronic constraints directly in the discrete design space.

Key Features

  • Sequence-based reactor design: 2D fuel assembly → 1D token sequence
  • Curriculum learning: Base FFT → LoRA fine-tuning → Online DPO
  • Physics-in-the-loop: OpenMC Monte Carlo validation at every step
  • Emergent behavior: Model autonomously expands Gd inventory beyond training distribution

Repository Structure

ReactorFold/
├── data_generation_100K.py    # Low-fidelity dataset (100k samples)
├── data_generation_10K.py     # High-fidelity dataset (10k samples)
├── sequence_length_check.py   # Token length validation
├── train_base.py              # Full fine-tuning on 100k dataset
├── train_lora.py              # LoRA fine-tuning on 10k dataset
├── dpo_10K_with_grid.py       # Online DPO with OpenMC-in-the-loop
├── ga_benchmark_hifi.py       # Genetic Algorithm baseline
└── symmetry_validation.py     # Symmetric benchmark generation

Installation

Requirements

  • Python ≥ 3.10
  • GPU with bfloat16 support (recommended)
  • OpenMC with cross-section library

Python Dependencies

pip install numpy pandas tqdm datasets deap \
            torch transformers accelerate peft openmc

Environment Setup

import os
os.environ["OPENMC_CROSS_SECTIONS"] = "/path/to/your/cross_sections.xml"

Usage

1. Data Generation

Low-fidelity dataset (100k samples)

python data_generation_100K.py
# Output: reactor_100k_final.csv

High-fidelity dataset (10k samples)

python data_generation_10K.py
# Output: reactor_10k_final.csv

2. Model Training

Stage 1: Base model (Full Fine-Tuning)

python train_base.py
# Output: reactor_base_training_output/final_model/

Stage 2: LoRA Fine-Tuning

python train_lora.py
# Output: reactor_lora_training_output/final_model/

Stage 3: Online DPO

python dpo_10K_with_grid.py
# Output: dpo_results.csv, dpo_optimized_model/

3. Baselines

Genetic Algorithm

python ga_benchmark_hifi.py
# Output: ga_results.csv, ga_best_grid.txt

Symmetric Benchmarks

python symmetry_validation.py
# Output: symmetry_results_full.csv

Method

Training Pipeline

Stage Data Method Output
1 100k low-fidelity Full Fine-Tuning Base model
2 10k high-fidelity LoRA (r=32) LoRA adapter
3 Online generation DPO + OpenMC Aligned model

Input Format

Reactor Core Design (k=1.05000, fq=1.0000, fdh=1.0000):
f f f g f f f f c f f f f g f f f
f f f f f f f f f f f f f f f f f
...
  • f: Fuel rod (UO₂)
  • g: Gadolinium burnable absorber (UO₂-Gd₂O₃)
  • c: Guide tube / Instrument tube

Fitness Function

fitness = 0.6 × Fq + 0.4 × F_ΔH + P(k_eff)

where P(k_eff) penalizes deviations from target range [1.02, 1.08].


Results

ReactorFold achieves 6× improvement in fitness over GA baseline within the same computational budget (1,000 high-fidelity evaluations).

Method Fitness k_eff Fq F_ΔH Gd Count
GA (fixed) 9.32 1.157 1.42 1.28 16
Sym-16 10.1 1.162 1.45 1.30 16
Sym-24 3.82 1.068 1.38 1.25 24
ReactorFold 1.55 1.052 1.32 1.21 29

Citation

@article{lee2025reactorfold,
  title={Language models discover non-intuitive reactor core designs 
         through emergent physical reasoning},
  author={Lee, Yoonpyo},
  journal={arXiv preprint},
  year={2025}
}

Data & Model Availability


License

License information will be added later.


Contact

Yoonpyo Lee
Department of Nuclear Engineering, Hanyang University
📧 lukeyounpyo@hanyang.ac.kr

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages