File size: 2,850 Bytes
457ff84
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3f21c41
457ff84
3f21c41
457ff84
3f21c41
 
457ff84
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3f21c41
 
457ff84
 
3f21c41
 
457ff84
 
 
 
3f21c41
457ff84
3f21c41
457ff84
 
3f21c41
457ff84
3f21c41
 
 
 
 
 
 
 
 
 
457ff84
 
3f21c41
457ff84
3f21c41
457ff84
 
 
 
3f21c41
457ff84
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
license: bsd-3-clause
library_name: braindecode
pipeline_tag: feature-extraction
tags:
  - eeg
  - biosignal
  - pytorch
  - neuroscience
  - braindecode
  - foundation-model
  - convolutional
---

# LUNA

LUNA from Döner et al [LUNA].

> **Architecture-only repository.** Documents the
> `braindecode.models.LUNA` class. **No pretrained weights are
> distributed here.** Instantiate the model and train it on your own
> data.

## Quick start

```bash
pip install braindecode
```

```python
from braindecode.models import LUNA

model = LUNA(
    n_chans=22,
    sfreq=250,
    input_window_seconds=4.0,
    n_outputs=4,
)
```

The signal-shape arguments above are illustrative defaults — adjust to
match your recording.

## Documentation
- Full API reference: <https://braindecode.org/stable/generated/braindecode.models.LUNA.html>
- Interactive browser (live instantiation, parameter counts):
  <https://huggingface.co/spaces/braindecode/model-explorer>
- Source on GitHub: <https://github.com/braindecode/braindecode/blob/master/braindecode/models/luna.py#L30>


## Architecture

![LUNA architecture](https://arxiv.org/html/2510.22257v1/x1.png)


## Parameters

| Parameter | Type | Description |
|---|---|---|
| `patch_size` | int | Number of time samples per patch. Default: 40. |
| `num_queries` | int | Number of learned queries for channel unification. Paper uses: 4 (Base), 6 (Large), 8 (Huge). Default: 4. |
| `embed_dim` | int | Embedding dimension for patch features. Paper uses: 64 (Base), 96 (Large), 128 (Huge). Default: 64. |
| `depth` | int | Number of transformer encoder blocks. Paper uses: 8 (Base), 10 (Large), 24 (Huge). Default: 8. |
| `num_heads` | int | Number of attention heads in channel unification. Default: 2. |
| `mlp_ratio` | float | Ratio of MLP hidden dimension to embedding dimension. Default: 4.0. |
| `norm_layer` | nn.Module | Normalization layer class. Default: nn.LayerNorm. |
| `drop_path` | float | Stochastic depth rate. Default: 0.0. |


## References

1. Döner, B., Ingolfsson, T. M., Benini, L., & Li, Y. (2025). LUNA: Efficient and Topology-Agnostic Foundation Model for EEG Signal Analysis. The Thirty-Ninth Annual Conference on Neural Information Processing Systems - NeurIPS. Retrieved from https://openreview.net/forum?id=uazfjnFL0G


## Citation

Cite the original architecture paper (see *References* above) and braindecode:

```bibtex
@article{aristimunha2025braindecode,
  title   = {Braindecode: a deep learning library for raw electrophysiological data},
  author  = {Aristimunha, Bruno and others},
  journal = {Zenodo},
  year    = {2025},
  doi     = {10.5281/zenodo.17699192},
}
```

## License

BSD-3-Clause for the model code (matching braindecode).
Pretraining-derived weights, if you fine-tune from a checkpoint,
inherit the licence of that checkpoint and its training corpus.