A comparative study of transformer models and recurrent neural networks for path-dependent composite materials
Organizations: Department of Physics, University of Gothenburg, Origovägen 6B, 41296 Gothenburg, Sweden
Abstract
Accurate modeling of Short Fiber Reinforced Composites (SFRCs) remains computationally expensive for full-field simulations. Data-driven surrogate models using Artificial Neural Networks (ANNs) have been proposed as an efficient alternative to numerical modeling, where Recurrent Neural Networks (RNNs) are increasingly being used for path-dependent multiscale modeling by predicting the homogenized response of a Representative Volume Element (RVE). However, recently, transformer models have been developed and they offer scalability and efficient parallelization, yet have not been systematically compared with RNNs in this field. In this study, we perform a systematic comparison between RNNs and transformer models trained on sequences of homogenized response of SFRC RVEs. We study the effect on two types of hyperparameters, namely architectural hyperparameters (such as the number of GRU layers, hidden size, number of attention heads, and encoder blocks) and training hyperparameters (such as learning rate and batch size). Both sets of hyperparameters are tuned using Bayesian optimization. We then analyze scaling laws with respect to dataset size and inference accuracy in interpolation and extrapolation regimes. The results show that while transformer models remain competitive in terms of accuracy on large datasets, the RNNs demonstrate better accuracy on small datasets and show better extrapolation performance. Furthermore, under extrapolation, there is a clear difference, where the RNN remains accurate, while the transformer model performs poorly. On the other hand, the transformer model is 7 times faster at inference, requiring 0.5 ms per prediction compared to the 3.5 ms per prediction for the RNN model.
Figures & tables
| Hyperparameter | RNN (GRU) | Transformer |
|---|---|---|
| Architectural hyperparameters | ||
| Number of layers ( ) | – | |
| Number of encoder blocks ( ) | – | |
| Hidden size ( ) | ||
| Feed-forward size | – | |
| Masked-Attention heads ( ) | – | |
| Hyperparameter | RNN | Transformer |
|---|---|---|
| Hidden size | 817 | 56 |
| Feed-forward size | – | 343 |
| Layers ( ) / Encoder Blocks ( ) | 2 | 2 |
| Masked-Attention Heads ( ) | – | 1 |
| Dataset (R20) | Test | Validation | Training |
|---|---|---|---|
| RNN RMSE [MPa] | 3.50 | 3.32 | 2.84 |
| RNN MaE [MPa] | 7.56 | 7.04 | 5.99 |
| Transformer RMSE [MPa] | 3.64 | 3.45 | 1.98 |
| Transformer MaE [MPa] | 8.83 | 7.65 | 4.38 |
| RNN MeRE | 3.79% | 3.53% | 3.08% |
| RNN MaRE | 7.94% | 7.46% | 6.43% |
| Sample | ||||
|---|---|---|---|---|
| 1 | 0.115 | 0.79 | 0.20 | 0.02 |
| 2 | 0.132 | 0.60 | 0.35 | 0.05 |
| 3 | 0.141 | 0.89 | 0.08 | 0.03 |
| 4 | 0.114 | 0.79 | 0.17 | 0.04 |
| 5 | 0.131 | 0.65 | 0.28 | 0.07 |
| 6 | 0.125 | 0.54 | 0.27 | 0.19 |
| Dataset | Cyclic loading |
|---|---|
| RNN RMSE [MPa] | 5.74 |
| RNN MaE [MPa] | 15.09 |
| Transformer RMSE [MPa] | 13.42 |
| Transformer MaE [MPa] | 34.78 |
| RNN MeRE | 5.37% |
| RNN MaRE | 14.15% |
Neural Surrogate Modeling
Neural surrogate modeling uses learned models to approximate costly simulations, enabling faster prediction, design, control, and inference.
See all 401 papers