Downloads · 30 days
0
jmtsh21/cross-attn-fno-darcy
cross-attn-fno-darcy is a machine learning model from jmtsh21. Use it for the machine learning task on the model card, and read the license before you ship it in a product.
Novel contribution: A drop-in cross-attention input head for FNO/Geometric-DeepONet that treats the variable-coefficient field as keys and values rather than a concatenated channel. Benchmarked on shifted log-Gaussian…
Downloads · 30 days
0
Access
Public
Updated May 9, 2026
Repo size
—
Likes
0
Public
Click a slice to open those files.
.py110 KB · 58%
From the Hugging Face model README
Novel contribution: A drop-in cross-attention input head for FNO/Geometric-DeepONet that treats the variable-coefficient field as keys and values rather than a concatenated channel. Benchmarked on shifted log-Gaussian Darcy flow.
Reservoir simulation surrogates are retrained per site because permeability statistics differ across reservoirs. The standard approach concatenates the coefficient field as an extra channel. We hypothesize that explicit cross-attention conditioning — where the spatial solution queries attend over coefficient keys/values — forces the model to build a robust conditioning representation that generalizes under distribution shift.
a(x) ──[1x1 conv]──► width channels ──[FNO blocks]──► projection ──► u(x)
a(x) ──[kv_embed]──► KV
│
├──► cross-attn ◄── Q = query_proj(coordinate_grid [-1,1]²)
│
└──► bypass = coeff_bypass(a) ──┐
▼
attended + bypass ──[FNO blocks]──► projection ──► u(x)
Key design:
MoE composition with learned soft gating from global coefficient statistics.
-∇·(a(x)∇u) = 1 with zero Dirichlet BCsexp(-L²|k|²/2)| Parameter | Full | Small (CPU) |
|---|---|---|
| Resolution | 64×64 | 32×32 |
| Train samples | 1000 | 200 |
| Width | 64 | 32 |
| Depth | 4 | 3 |
| Modes | 12 | 8 |
| Epochs | 500 | 300 |
| Batch size | 16 | 8 |
| LR | 1e-3 | 1e-3 |
| LR schedule | StepLR /100 | StepLR /100 |
| Loss | Relative L2 | Relative L2 |
python train_small_v2.py
# Output: results_small.json, best_*.pt
python train_full.py
# Output: results.json, best_*.pt
python analyze_results.py results_small.json
# Output: comparison.png, degradation.png
| File | Description |
|---|---|
train_full.py | Full experiment with scipy sparse solver |
train_small_v2.py | CPU-friendly, numpy dense solver, no scipy |
analyze_results.py | Results tables + bar charts |
RESEARCH_SUMMARY.md | Literature review and design rationale |
REPORT.md | Full research report |
MIT