longtable Ginwidth=,height=,keepaspectratio

# Alternatives to the Scaled Dot Product for Attention in the Transformer
Neural Network Architecture

James Bernhard

University of Puget Sound

<EMAIL_ADDRESS>0009-0001-0762-2035

###### Abstract

The transformer neural network architecture uses a form of attention in which
the dot product of query and key is divided by the square root of the key
dimension before applying softmax. This scaling of the dot product is designed
to avoid the absolute value of the dot products becoming so large that
applying softmax leads to vanishing gradients.

In this paper, we propose some alternative scalings, including dividing the
dot product instead by the sum of the key lengths before applying softmax. We
use simulated keys and queries to show that in many situations this appears to
be more effective at avoiding regions where applying softmax leads to
vanishing gradients.

Attention plays a prominent role in the transformer neural network
architecture, as indicated by the title of the landmark paper introducing the
architecture, “Attention Is All You Need” [1], by Vaswani et al. The way that
attention is used in the transformer architecture builds on the way attention
was introduced by Bahdanau et al. [2] and further developed by Luong et al.
[3].

In this paper, to explore how attention is used in the transformer
architecture we first describe attention in abstract terms. We then discuss
the problem that inspired the introduction of the scaled dot product in
“Attention Is All You Need” [1], which leads us to a shift in perspective that
suggests other possible ways of addressing that problem. Next we propose
dividing by the sum of the key lengths instead of the square root of the key
dimension, and we generate some simulated queries and keys with independent
standard normally distributed components in order to compare the two methods.
We also briefly discuss some other possible scalings that might also help
avoid vanishing gradients.

##  1 Defining attention

A _scalar attention function_ is a function
$a:\mathbb{R}^{d}\times\mathbb{R}^{d}\to\mathbb{R}$ for some $d$. The first
argument of $a$ is called a $query$ and the second argument a $key$. For
$q,k\in\mathbb{R}^{d}$, we will call the real number $a(q,k)$ the _scalar
attention_ of $q$ on $k$.

Given an attention function
$a:\mathbb{R}^{d}\times\mathbb{R}^{d}\to\mathbb{R}$ and a finite ordered set
$\mathcal{K}$ of keys $k_{1},\ldots,k_{n}\in\mathbb{R}^{d}$, we can define a
function $a_{\mathcal{K}}:\mathbb{R}^{d}\to\mathbb{R}^{n}$, which we will call
the _vector attention function_ associated with $\mathcal{K}$ and based on
$a$, by:

$a_{\mathcal{K}}(q)=\begin{bmatrix}a(q,k_{1})\\\ a(q,k_{2})\\\ \vdots\\\
a(q,k_{n})\end{bmatrix}.$

We will call $a_{\mathcal{K}}(q)$ the _vector attention_ of $q$ on
$\mathcal{K}$.

Suppose that, for this set $\mathcal{K}$ of $n$ keys, we have a function
$s_{\mathcal{K}}:\mathbb{R}^{n}\to\Delta^{n-1}$, where $\Delta^{n-1}$ is the
standard $(n-1)$-simplex in $\mathbb{R}^{n}$:

$\Delta^{n-1}=\\{\begin{bmatrix}x_{1}\\\ x_{2}\\\ \vdots\\\
x_{n}\end{bmatrix}\in\mathbb{R}^{n}\ |\ \sum_{i=1}^{n}x_{i}=1\ \text{and}\
\forall i\ x_{i}\geq 0\\}.$

We will call such a function $s_{\mathcal{K}}$ a _rescaling function_.

With a rescaling function, we can then define the _rescaled vector attention
function_ $A_{\mathcal{K}}:\mathbb{R}^{d}\to\Delta^{n-1}$ based on $a$,
$\mathcal{K}$, and $s_{\mathcal{K}}$ by:

$A_{\mathcal{K}}=s_{\mathcal{K}}\circ a_{\mathcal{K}}.$

In the context of “Attention Is All You Need” [1], the authors describe what
we have termed their scalar attention function as a “scaled dot product”:

$a(q,k)=\frac{q\cdot k}{\sqrt{d}}.$

For each set $\mathcal{K}$ of keys $k_{1},\ldots,k_{n}$, they use
$\text{softmax}_{n}:\mathbb{R}^{n}\to\Delta^{n-1}$ as what we have called a
rescaling function, defined by:

$\text{softmax}_{n}(\begin{bmatrix}x_{1}\\\ x_{2}\\\ \vdots\\\
x_{n}\end{bmatrix})=\frac{1}{\sum_{i=1}^{n}\exp(x_{i})}\begin{bmatrix}\exp(x_{1})\\\
\exp(x_{2})\\\ \vdots\\\ \exp(x_{n})\end{bmatrix}.$

This produces the following rescaled vector attention function
$A_{\mathcal{K}}:\mathbb{R}^{d}\to\mathbb{R}^{n}$:

$A_{\mathcal{K}}(q)=\frac{1}{\sum_{i=1}^{n}\exp(q\cdot
k_{i}/\sqrt{d})}\begin{bmatrix}\exp(q\cdot k_{1}/\sqrt{d})\\\ \exp(q\cdot
k_{2}/\sqrt{d})\\\ \vdots\\\ \exp(q\cdot k_{n}/\sqrt{d})\end{bmatrix}.$

Their paper also includes some additional aspects of attention that are
important for its implementation in the transformer architecture, but that we
mention only briefly here:

  1. 1.

In addition to keys $k_{1},\ldots,k_{n}\in\mathbb{R}^{d}$, they also have a
finite ordered set of _values_ $v_{1},\ldots,v_{n}\in\mathbb{R}^{t}$. (Since
keys and values are to be thought of as pairs, the number of keys and values
must be the same. However, the dimensions of the spaces where they reside may
be different.) To arrive at what they term their “Attention” function, they
first apply the above rescaled vector attention function and then apply a
linear transformation $T:\mathbb{R}^{n}\to\mathbb{R}^{t}$ (restricted to the
domain $\Delta_{n-1}$) given by

$T(\begin{bmatrix}x_{1}\\\ x_{2}\\\ \vdots\\\
x_{n}\end{bmatrix})=\sum_{i=1}^{n}x_{i}v_{i}.$

This produces a vector in the convex hull of $v_{1},\ldots,v_{n}$.

  2. 2.

Also, they write their “Attention” function in terms of a _set_ of (row
vector) queries $q_{1},\ldots,q_{m}\in\mathbb{R}^{d}$ that form the rows of a
matrix, rather than in terms of individual queries.

These aspects are important for the implementation of attention in the
transformer architecture but not for our discussion here.

##  2 Compensating for the dimension of the keys

The authors of “Attention Is All You Need” [1] explain their reason for
dividing the dot product by $\sqrt{d}$ (or $\sqrt{d_{k}}$ in their notation)
in what we have termed their scalar attention function: “We suspect that for
large values of $d_{k}$, the dot products grow large in magnitude, pushing the
softmax function into regions where it has extremely small gradients. To
counteract this effect, we scale the dot products by $1/\sqrt{d_{k}}$.” They
elaborate further in a footnote that the issue can be observed by noting that
if the components of the queries and keys are independent random variables
with mean $0$ and variance $1$, then their dot products have mean $0$ and
variance $d$.

Their explanation can be further illustrated through some simulations, and
understanding these simulations will also be helpful when we use similar
simulations to compare alternative rescalings later in this paper.

For each of the plots in Figure 1, we simulate all the components of every
query and key as being independent and standard normally distributed. We
generate a set of $32$ keys, and we give them a very small dimension of $16$.
(The effect we are illustrating is so large that even such a small dimension
shows it strongly.) To compute attentions, we generate $500$ queries, also
each of dimension $16$. We then make a kernel density estimate plot of just
the first component of the rescaled vector attention function applied to all
the queries. By symmetry, the other components should look similar, and this
approach avoids any issues with displaying (in the same kernel density
estimate plot) multiple components of the rescaled vector attention, which
lack independence.

In these three plots, each point represents the following:

  1. a.

In (a), a single unscaled dot product.

  2. b.

In (b), a single unscaled dot product after softmax has been applied to it.

  3. c.

In (c), a single scaled dot product (scaled by $1/\sqrt{d}$) after softmax has
been applied to it.

Comparing the three plots in Figure 1, we can see how softmax, with and
without scaling, distorts the shape of the original distribution of unscaled
dot products.

Figure 1: The first component of vector attention for 500 simulated queries.
(a) These points have not had any scaling, and softmax has not been applied.
They are simply dot products of queries with the first key. (b) These dot
products of queries with the first key have not been scaled, but they have had
softmax applied. (c) These dot products of queries with the first key have
been divided by the square root of the key dimension and have then had softmax
applied.

Even with such a small key dimension as $16$, Figure 1(b) shows that applying
softmax without scaling severely distorts the shape of the distribution of the
original dot products. Because the shape after applying softmax is weighted
heavily near $0$ and has a pronounced right skew, it is apparent that applying
softmax to the unscaled dot product would be prone to vanishing gradient
issues.

Although Figure 1(c) shows a mild right skew that was not present in the
distribution before softmax was applied, from the plot it is clear that
dividing the dot products by $\sqrt{d}$ before applying softmax did indeed
help preserve the general shape of the distribution compared to not scaling at
all. Correspondingly, this method helps alleviate the vanishing gradient issue
with softmax (as has also been demonstrated time and again in its widespread
use).

However, there are two things to think about here:

  1. 1.

The choice to divide by $\sqrt{d}$ was based on the absolute values of the
query and key dot products growing too large because of their dimension, but
there are other reasons besides the dimension why the absolute value of these
dot products might grow large. It would be good to compensate for those too.

  2. 2.

The reason why we want to compensate for the size of the dot products is that
we are planning to apply softmax, but notice that it is impossible to apply
softmax without knowing how many keys are in $\mathcal{K}$. As such, we might
not be able to avoid all of the softmax-related difficulties by adjusting the
scalar attention function, since this function has nothing to do with
$\mathcal{K}$, only with individual keys. Instead we might want to adjust the
rescaling function, which does depend on the choice of $\mathcal{K}$.

These considerations lead us to rethink the way we view dividing by $\sqrt{d}$
in the transformer neural network architecture. Instead of thinking of the
“scaled dot product” $(q\cdot k)/\sqrt{d}$ as the scalar attention function
and softmax as the rescaling function, we view the scalar attention function
as the ordinary dot product $q\cdot k$ and the rescaling function as what
might be called a “prescaled softmax function”
$s_{\mathcal{K}}:\mathbb{R}^{n}\to\Delta_{n-1}$:

$s_{\mathcal{K}}(\begin{bmatrix}x_{1}\\\ x_{2}\\\ \vdots\\\
x_{n}\end{bmatrix})=\frac{1}{\sum_{i=1}^{n}\exp(x_{i}/\sqrt{d})}\begin{bmatrix}\exp(x_{1}/\sqrt{d})\\\
\exp(x_{2}/\sqrt{d})\\\ \vdots\\\ \exp(x_{n}/\sqrt{d})\end{bmatrix}.$

This minor shift in perspective is unimportant for using the “Attention”
function directly as formulated in “Attention Is All You Need” [1]. However,
for our purposes here it is crucial. It suggests that the ordinary, unscaled
dot product (as used already in [3]) is actually a good scalar attention
function; rescaling follows it only because of how it is to be used in a
particular neural network context. This might seem like a small change, but it
opens up the possibility that the rescaling might depend not solely on the
dimension of the keys (as with dividing by $\sqrt{d}$) but possibly on the
number of keys in $\mathcal{K}$ (as softmax does), or even on the keys
$k_{1},\ldots,k_{n}$ themselves.

##  3 Exploring rescalings

In light of the above considerations, we take the following as our starting
point: the ordinary, unscaled dot product is a good scalar attention function
for the transformer architecture, and our task is to figure out a suitable
rescaling function $s_{\mathcal{K}}:\mathbb{R}^{n}\to\Delta_{n-1}$ that
preserves as much of the overall shape of the distribution of the unscaled dot
products as possible.

Note that the rescaling function doesn’t interact with queries directly, so in
this approach, it can’t be helped if $\|q\|$ gets large and so makes the dot
product large. If we were modifying the scalar attention function, it might be
tempting to divide it by $\|q\|$, but (even ignoring the possibility of this
being $0$) that would make the scalar attention function independent of
$\|q\|$, which seems undesirable. It might be worth thinking about whether
anything different should be done with $q$ in the scalar attention function,
but for our purposes here we are leaving $q$ out of the investigation and
focusing solely on finding a rescaling function.

Suppose then that we have the dot product as our scalar attention function
$a:\mathbb{R}^{d}\times\mathbb{R}^{d}\to\mathbb{R}$:

$a(q,k)=q\cdot k.$

Also suppose that we are given a finite ordered set $\mathcal{K}$ of keys
$k_{1},\ldots,k_{n}\in\mathbb{R}^{d}$. We can then define the vector attention
function $a_{\mathcal{K}}:\mathbb{R}^{d}\times\mathbb{R}^{d}\to\mathbb{R}^{n}$
by:

$a_{\mathcal{K}}(q)=\begin{bmatrix}q\cdot k_{1}\\\ q\cdot k_{2}\\\ \vdots\\\
q\cdot k_{n}\end{bmatrix}.$

Our task is to find a suitable rescaling function
$s_{\mathcal{K}}:\mathbb{R}^{n}\to\Delta_{n-1}$.

A natural idea for a rescaling function would be
$\text{softmax}_{n}:\mathbb{R}^{n}\to\Delta_{n-1}$, but as discussed above and
in “Attention Is All You Need” [1], this function by itself is prone to
vanishing gradients because the absolute values of the dot products that make
up each component can easily get very large as the dimension $d$ of the keys
and queries does. The authors of “Attention Is All You Need” [1] suggest pre-
dividing by $\sqrt{d}$ before applying softmax, which works well for avoiding
this problem.

However, as also discussed above, there are other reasons why the absolute
values of the dot products might get large besides just the dimension of the
key space. Keeping in mind that the function $s_{\mathcal{K}}$ can’t depend on
the queries but that it can depend on $k_{1},\ldots,k_{n}$, some thought and
experimentation suggests pre-dividing by $k_{total}$, the sum of the key
lengths:

$k_{total}=\sum_{i=1}^{n}\|k_{i}\|.$

(Note that $k_{total}$ should indeed be nonzero in all practical
applications.) In other words, as a rescaling function
$s_{\mathcal{K}}:\mathbb{R}^{n}\to\Delta_{n-1}$, we propose:

$s_{\mathcal{K}}(\begin{bmatrix}x_{1}\\\ x_{2}\\\ \vdots\\\
x_{n}\end{bmatrix})=\frac{1}{\sum_{i=1}^{n}\exp(x_{i}/k_{total})}\begin{bmatrix}\exp(x_{1}/k_{total})\\\
\exp(x_{2}/k_{total})\\\ \vdots\\\ \exp(x_{n}/k_{total})\end{bmatrix}.$

Some of the intuition behind this is that, by the Cauchy-Schwarz inequality,

$\frac{|k_{i}\cdot
q|}{k_{total}}\leq\frac{\|k_{i}\|}{k_{total}}\|q\|\leq\|q\|.$

As discussed earlier, the rescaling function doesn’t interact directly with
the queries themselves. But the previous inequality shows that as long as the
lengths of the queries don’t get too large, then the relative sizes of the
components of the vectors to which softmax is applied won’t be distorted too
much.

##  4 Some simulations to compare rescalings

We now use simulations to compare this rescaling function to the one used
(with a slightly different point of view, as discussed above) in “Attention Is
All You Need” [1]. Both are of the following form:

$s_{\mathcal{K}}(\begin{bmatrix}x_{1}\\\ x_{2}\\\ \vdots\\\
x_{n}\end{bmatrix})=\frac{1}{\sum_{i=1}^{n}\exp(x_{i}/c_{\mathcal{K}})}\begin{bmatrix}\exp(x_{1}/c_{\mathcal{K}})\\\
\exp(x_{2}/c_{\mathcal{K}})\\\ \vdots\\\
\exp(x_{n}/c_{\mathcal{K}})\end{bmatrix},$

and $c_{\mathcal{K}}$ equals either $\sqrt{d}$ or $k_{total}$.

In each of the plots in Figure 2, we simulate all the components of every
query and key as being independent and standard normally distributed. We
generate a set of $32$ keys, each of dimension $256$. To compute the vector
attentions, we generate $500$ queries, also each of dimension $256$. We then
make a kernel density estimate plot of just the first component of either the
vector attention function or the rescaled vector attention function applied to
all the queries. By symmetry, the other components should look similar, and as
before, this approach avoids any issues with displaying (in the same kernel
density estimate plot) multiple components of the rescaled vector attention,
which lack independence.

Each point in the three plots in Figure 2 represents:

  1. a.

In (a), a single unscaled dot product.

  2. b.

In (b), a dot product which has been rescaled by the above $s_{\mathcal{K}}$
with $c_{\mathcal{K}}=\sqrt{d}$, as in “Attention Is All You Need” [1],

  3. c.

In (c), a dot product which has been rescaled by the above $s_{\mathcal{K}}$
with $c_{\mathcal{K}}=k_{total}=\sum_{i=1}^{n}\|k_{i}\|$.

Figure 2: The first component of vector attention for 500 simulated queries.
(a) These scalar attentions have not had any rescaling. They are simply dot
products of queries with the first key. (b) These are the first component of
the rescaled vector attention, where the rescaling is dividing by the square
root of the key dimension and then applying softmax. (c) These are the first
component of the rescaled vector attention, where the rescaling is dividing by
the sum of the key lengths and then applying softmax.

The axes on all three plots are on completely different scales, but we have
displayed them in this way (using the default scales chosen by the computer)
in order to be able to compare the shapes of the distributions. In these
plots, it is apparent that pre-dividing by $k_{total}$ before applying softmax
preserves the shape of the distribution much better than pre-dividing by
$\sqrt{d}$.

These simulations have used an independent standard normal distribution for
each component of the queries and keys. Further experimentation readily shows
that when normal distribution means and variances change (and even more so
when distribution families change), pre-dividing by $\sqrt{d}$ leads to
greater distortions of the distribution shape than pre-dividing by
$k_{total}$. Also, these patterns persist even when $d$ and $n$ vary over a
wide range.

To explore these variations further, the R package that the author wrote to
generate the simulations and plots for this paper can be used. It is available
at https://github.com/James-Bernhard/attnsims.

##  5 Further considerations

Once we view dividing the dot product by $\sqrt{d}$ in the transformer
architecture as part of the rescaling function rather than as a modification
of the dot product in the scalar attention function, many other rescaling
possibilities arise. In our explorations, pre-dividing by $k_{total}$ has
appeared to decrease the distortion by the softmax function and help avoid the
issue of vanishing gradients, but some other possibilities that might also be
considered are:

  * •

dividing by $\sum_{i=1}^{n}\|k_{i}\|/n$,

  * •

dividing by $\sqrt{\sum_{i=1}^{n}\|k_{i}\|^{2}}$,

  * •

more generally, dividing by $\left(\sum_{i=1}^{n}\|k_{i}\|^{p}\right)^{1/p}$.

These are more complicated, and in the author’s explorations, none of them
seemed to perform as well as dividing by $k_{total}$. But perhaps there are
other possibilities that do.

It is also possible that different rescalings might be more effective in
different contexts. As such, it would be good to consider rescaling functions
other than just the ones described here. If it is feasible, multiple possible
rescaling functions might even be tested in the specific context in which they
are to be applied.

It is worth noting that dividing by $n\sqrt{d}$ seems to exhibit similar
behavior to dividing by $k_{total}$ for independent standard normally
distributed key and query components. If it is impractical to compute
$k_{total}$ in a particular situation, perhaps dividing by $n\sqrt{d}$ could
be substituted for it. As might be expected though, dividing by $n\sqrt{d}$
doesn’t appear to behave as well for distributions other than standard normal.

##  6 Conclusion

Vanishing gradients arise when individual components resulting from applying
softmax approach $0$ or $1$, and this issue can be seen in the distortion of
the shapes of the distributions of the vector attention components. Dividing
by the square root of the key dimension alleviates this distortion well, but,
judging from simulations, in many situations dividing by the sum of the key
lengths appears to preserve the shape of the distribution even better.

Of course, the real test of the utility of dividing by the sum of the key
lengths lies in how it performs in its intended setting in the transformer
neural network architecture. Although further and more systematic testing is
still needed, the author has conducted preliminary experiments using this
modified transformer architecture and it appears to perform well.

The simulations and plots in this paper were generated using R version 4.3.0
[4] and the R packages ggplot2 [5] and rlang [6]. The R package that the
author wrote to generate the simulations and plots in this paper is available
at https://github.com/James-Bernhard/attnsims.

## References

re [1] A. Vaswani _et al._ , “Attention is all you need.” 2017. doi:
10.48550/arXiv.1706.03762. Available: https://arxiv.org/abs/1706.03762

pre [2] D. Bahdanau, K. Cho, and Y. Bengio, “Neural machine translation by
jointly learning to align and translate.” 2014. doi: 10.48550/arXiv.1409.0473.
Available: https://arxiv.org/abs/1409.0473

pre [3] M.-T. Luong, H. Pham, and C. D. Manning, “Effective approaches to
attention-based neural machine translation.” 2015. doi:
10.48550/arXiv.1508.04025. Available: https://arxiv.org/abs/1508.04025

pre [4] R Core Team, _R: A language and environment for statistical
computing_. Vienna, Austria: R Foundation for Statistical Computing, 2023.
Available: https://www.R-project.org/

pre [5] H. Wickham, _ggplot2: Elegant graphics for data analysis_. Springer-
Verlag New York, 2016. Available: https://ggplot2.tidyverse.org

pre [6] L. Henry and H. Wickham, _Rlang: Functions for base types and core r
and ’tidyverse’ features_. 2023. Available:
https://CRAN.R-project.org/package=rlang

p


Dipartimento di Fisica, Università di Cagliari - Cagliari, Italy INFN, Sezione
di Cagliari - Cagliari, Italy Dipartimento di Psicologia, Pedagogia e
Filosofia, Università di Cagliari - Cagliari, Italy

# Quantum mechanics at high school: an online laboratory on wave-particle
duality

M. Tuveriins:xins:y Corresponding author, e-mail: matteo.tuveri[at]ca.infn.it.
D. Faddains:w  C.M. Carbonaroins:x ins:xins:xins:yins:yins:wins:w

###### Abstract

The interest in studying quantum mechanics is always increasing in our society
and schools. Especially in the latter case, this leads researchers to
implement suitable actions to meet social needs of knowledge of quantum
physics. We present an online laboratory on wave-particle duality for high
school students (17-19 years old). The activity has been carried out in the
period December 2021 - May 2022 at the Physics Department of the University of
Cagliari and more than 100 students from different high schools in Sardinia
have been involved. We will show the design of the activity and the
experiments performed. We will show and discuss qualitatively results about a
satisfaction questionnaire. A brief discussion about motivational issues will
be done.

##  1 Introduction

Quantum mechanics is around us, and the interest in studying this subject is
increasing in our society. For example, topics related to quantum physics are
now part of high schools’ programs. Newspapers, tv shows and science
communication profiles on social media often talk about quantum technologies
around us. To learn and to be informed about quantum mechanics and its
application in our research as well as in our everyday life is important for
cultural reasons and to become consciousness citizens [1]. Fron this point of
view, researchers play an important role in society, they have to implement
suitable actions to meet social needs of knowledge of quantum physics.

Starting from schools, many strategies can be used to face with the quantum
world, focusing on technological aspects [2, 3] or on historical and informal
ones [5]. The educational content of these approaches can focus on different
subjects, from conceptual and linguistic aspects [4, 6], where the language,
both the natural and the mathematical one, is used as an instrument to
introduce the peculiar features of the quantum world [7]. Another possibility
can be to focus on one of the main conceptual issues of quantum mechanics,
that is the wave-particle duality and develop suitable learning strategies to
highlight the manifestation of the dual nature of matter and light.

In this paper we present a laboratory on wave-particle duality for high school
students (17-19 years old). The experimental activities had been carried out
in the period December 2021 - May 2022 at the Physics Department of the
University of Cagliari. More than one hundred students from different high
schools in Sardinia have been involved, whose participation was online due to
the pandemic. Main aim is to show the design of the activity and the
experiments performed. Inspired by previous research on this field [1], we
also wrote a research questionnaire to understand how the online laboratory
affected students’ motivation and interest in physics, their vision of the
scientific method and the influence of the laboratory on their understanding
of physics and the concepts studied at school. A detailed analysis will appear
in a forthcoming paper. Research methodology and a qualitative analysis of
data are presented.

##  2 Methods

The main topic of the laboratory was the wave-particle duality. We focus on
waves (mechanical and electromagnetic) and their properties, as well as on
particular macroscopic properties and phenomenology of matter (such as
scattering). Four different experiments dealing with the undulatory and
particle properties of matter were shown and discussed.

The first experiment deal with mechanical waves propagating in a fluid. In
this case, researchers focused on diffraction as a key phenomenon to introduce
the dual behavior of matter according to the experimental set-up and
conditions. The second experiment was a flipper-like apparatus, with marbles
hitting a screen passing through a slit. This was to explain and show the
particle behavior of matter, that is that massive particles and, in general,
macroscopic objects (with a length of the order of centimeters or more) do not
diffract. Also in this case, researchers focused on the phenomenon of elastic
scattering and the relationship between the dimension of the marbles and the
slit. The third experiment concerned the diffraction of light. A red light
emitted by a laser (with a wavelength of about 650 nm) passes through some
lenses and a slit to be coherently collimated in a beam. The slit can be
opened or closed until its size becomes comparable with the laser wavelength.
Then, diffraction occurs. Finally, in the fourth experiment, researchers
showed electron diffraction through a suitable experimental set-up (the
electron diffraction system build by Phywe). In this case, the diffraction
manifests with rings on a fluorescent screen. This experiment shows that,
under suitable conditions, that is an electron passing through a slit
(graphite planes) of dimensions comparable with its wavelength, even what is
typically thought as a particle manifest an undulatory phenomenology. To also
show that in this process, the electron does not loose its charge, we used a
magnet to move the diffraction figure along all the screen.

The methodological structure of the laboratory was as follows. Firstly, an
introductory game was proposed using the ”Quizziz” platform to qualitatively
measure students’ expectations about phenomena showed during the activity. The
questions had not any evaluation intent, rather they just measured their
feeling or previous knowledge (especially for students attending the last
years in high school) on the subject. This activity lasts ten minutes. After
that, the experimental activities started (duration: 40 minutes). The
laboratory ended with a general recap on the physics dealt and the results of
the introductory game was discussed in the light of phenomena observed. We
left a detailed discussion on the pedagogical approach to a future paper,
where further details will be given.

The total duration of the activity was about one hour. Contents where
targeted: the more the participants were young the less technicalities and
details were inserted in the discussion. Despite the online environment, a
certain level of interaction with the class through the mediation of the
teacher was guaranteed.

Participants to the synchronous online session were 104 high-school students
attending the last three years of Lyceums in Sardinia (in the metropolitan
area of Cagliari, 1 ”humanities” and 5 ”scientific”). The total number of
participants was obtained by summing the in-class counting made by teachers
once the synchronous session started. Teachers and students attended the
online laboratory from their classrooms and a Zoom connection was established,
with cameras filming the researchers and the experiments connected to a laptop
with a Raspberry system. Every class attended the laboratory separately, thus
the total number of meeting was 6.

We wrote a satisfaction questionnaire to investigate students’ feedback on
their experience with the online laboratory (2 items); on the influence of the
laboratory on their understanding of physics and the concepts studied at
school (2 items); on their vision of science and of the scientific method (3
items); on the interaction with researchers (2 items). Students could answer
by using a 5-point Likert scale, from 1 (completely disagree) to 5 (completely
agree). For each class, data were collected from 15 days to one month after
the end of the synchronous meeting. The questionnaire was written in Italian
and imported in Microsoft Forms. The teacher distributed it as a link via
email to students. Students’ participation was voluntary with no positive or
negative inducements. The questionnaire was anonymous, no information on
gender or class was obtained. The number of answers collected was 104.

In the following, we just show and discuss the qualitative results related to
students’s satisfaction on the 4 domains cited above.

##  3 Results

Concerning students’ feedback on their experience with the online laboratory,
most of them (78.8%) affirmed that the topics of the lab were interesting. One
half of them (51.1%) thought the lab fostered their curiosity on the topics of
the lab, whereas one third of the sample (30.8%) stay neutral on this item.
Concerning the influence of the laboratory on their understanding of physics
and the concepts studied at school, 46.2% of students affirmed that thanks to
the lab, he/she could explore the physics phenomena he/she was studying at
school. The 29.8% of the sample was neutral. The capacity of the lab to engage
students in in studying physics was rated as good by the 66.3% of students.

Concerning their vision of science and of the scientific method, the 68.2% of
students affirmed that the lab helps them in understanding the importance of
taking, analyzing, collect, and interpret the data. Most of them (67.3%)
affirmed that the lab helps them in understanding how to carry a scientific
research on. The same happens when we asked students if the lab allowed them
to think about and explain the observed phenomena: in this case, the 57.5% of
students agreed with this item. Concerning the interaction with researchers,
the majority of them (78.8%) affirmed that the interactions with researchers
were useful. Finally, the item: ”attending the remote lab with the researcher
helps me in understanding the experiment” was positively rated by the 65.3% of
the sample.

##  4 Discussion and conclusions

The qualitative results on students’ interest and curiosity towards physics,
as well as on their motivation in participating to the online activity are
encouraging. Moreover students appreciated to interact with researchers even
in an online environment. Most of them also affirmed that the interaction with
researchers was also helpful in understanding the physics behind the
experiments. This result suggests that interaction is a key point in learning
and in outreaching activities, too. Another interesting result is that
students affirmed that our initiative helps them in understanding the
scientific method. The laboratory seemed to have a discrete influence also on
students’ understanding of physics concepts studied at school.

Some criticality emerged: teacher-mediated interaction between researchers and
students did not encourage a constant and active participation of the latter
to the lecture. Students appeared to be scared by a possible judgements of
their teacher if they were wrong in talking with researchers. This is a
crucial point to be faced up in order to find strategies to implement online
learning of physics in school in curricular timetable. A possible solution can
be to include teachers in the design of the activity, thus making them co-
authors of the project. In this sense, if they already know what researchers
will show, then, they can explain concepts to their class during the
synchronous activity, e.g., when internet connection arises or when he/she
think this is needed.

For the future, we hope to increase the sample to better the statistics and to
understand the efficacy of our methodology, possibly introducing a
quantitative measure of students’ learning of concepts proposed in the
laboratory with a pre and a post questionnaire. We are also planning to
implement the laboratory in a proper education and learning platform allowing
us to study all the steps of participants’ online learning. This platform will
allow us to follow the students also in the asynchronous phase, when they re-
elaborate the supplementary and learning material uploaded on the platform and
focus on the content of the laboratory. All these activities are left for a
future study.

###### Acknowledgements.

The author acknowledge faculties, teachers and students who participated in
the study.

## References

  * [1] Michelini M. et al. J. Phys. Conf. Ser.19292021012044;
  * [2] Oss S. Rosi T. The Phys. Teach.53(4)2015230-233;
  * [3] Malgieri M. et al. J. Phys.: Conf. Ser.12872019012005;
  * [4] Levrini O. et al. GIREP-EPEC Conf., Front. of Phys. Ed., (2007, Opatija) Selected contributions, RIJEKA, Zlatni rez2008319-324;
  * [5] Grimellini N. Levrini O. Qual. Dev. in Teach. Ed. and Train., Udine Forum2004306-310;
  * [6] Singh C. Am. J. Phys.69(8)2001885-896.
  * [7] Singh C. et al. Phys. Tod.200643-49;


# Seasonal variation in nighttime NO radiative cooling as observed by
TIMED/SABER in lower thermosphere during solar maximum and solar minimum

Alok K Ranjan, MV Sunil Krishna†, Akash Kumar, Dayakrishna Nailwal, Sumanta
Sarkhel

(Date: 1Department of Physics, Indian Institute of Technology Roorkee,
Roorkee-247 667, Uttarakhand )

###### Abstract.

Both composition and temperature play a crucial role in determining the NO
radiative cooling in lower thermosphere as observed by TIMED/SABER. In this
work, we present a detailed investigation of seasonal variation in
thermospheric NO radiative cooling. We have carried forward the investigation
of [1] regarding the variations in local nighttime peak NO radiative cooling
and its altitude during solar maximum and solar minimum conditions. By
analyzing latitudinal changes over quiet times for each month in year 2018, it
is evident that both the investigative parameters exhibit summer-winter
variability. The qualitative contribution of different species (i.e., NO, and
O), and temperatures in determining the vertical profile of NO radiative
cooling for different latitudes is investigated by utilizing the NRLMSISE-00
estimated parameters, and SNOE observed NO density. The temperature, NO
density, meridional wind, and associated compositional variations due to
asymmetrical solar heating in both the hemispheres during solar minimum
conditions seem to be the dominating factor in controlling the NO radiative
cooling during different seasons. The altitudes at which maximum cooling by NO
occurs exhibits an inverse correlation with the amount of radiative cooling.
The region of enhanced NO densities (polar and summer hemispheric low-mid
latitude regions) have larger NO radiative cooling with lower peak altitudes
in comparison to other regions (equatorial to winter hemispheric low-mid
latitude regions), where NO radiative cooling is low with higher peak altitude
values.

## Introduction

Nitric oxide (NO) present in the lower to mid-thermosphere acts as a natural
thermostat. It partially controls the outgoing energy of this region by
converting its kinetic energy into radiative emission (5.3 $\mu$ m) through
multiple collisions, thereby cooling the lower thermosphere [2]. This process
of NO radiative cooling is dominant during the solar maximum. Frequent
geomagnetic storms during solar maximum result in enhanced energy input into
the lower thermosphere in the form of Joule heating, and energetic particle
precipitations in polar regions. The subsequent upwelling of N2-rich air and
their interaction with energetic precipitating electrons in polar regions
during the energy deposition results in the dissociation of N2-molecules into
N(2D) and N(4S). These excited Nitrogen atoms over polar latitudes then
interact with Oxygen molecules to form NO (Table-1; R1 & R2), which can also
quench back to N2 molecules via temperature-based interaction with N(4S) (R3 &
R4). However, in the equatorial to mid- latitude regions the NO density is
controlled by solar soft X-rays (2-10 nm) flux, and the meridional winds [23,
4]. The enhanced production of NO in the lower thermosphere during geomagnetic
storms is also followed by its excitation in vibration-rotational band (NO
($\textit{v}=0$) to NO ($\textit{v}=1$)) through the temperature based
collision rate with atomic oxygen (R6), which then comes back to its ground
state (NO ($\textit{v}=1$) to NO ($\textit{v}=0$)) by emitting a radiation of
5.3 $\mu$m. However, the atomic oxygen density can also cause the quenching of
NO ($\textit{v}=1$) (R5), and hence the resultant of all these processes (R1
to R6) finally determines the amount of NO radiative cooling in lower
thermosphere.

There has been various studies on the behaviour of NO radiative cooling in the
mesosphere and lower thermosphere during both extreme space weather conditions
and forcing from below (atmospheric tides and sudden stratospheric warming
events) [5, 6, 7, 8, 9, 10, 11, 12]. The TIMED/SABER (Thermosphere-Ionosphere-
Mesosphere Energetics and Dynamics/Sounding of the Atmosphere using Broadband
Emission Radiometry) observed NO daily radiative power from thermosphere to
space can reach upto hundreds of giga watts during geomagnetic storms with the
enhancement of several tens of giga watts compared to quiet time values. The
quiet time NO daily mean radiative power during solar minimum conditions can
alone be of the order of tens of giga watts, and it reaches upto hundreds of
giga watts during solar maximum [13]. This change in the outgoing radiative
energy indicates the importance of NO infrared radiative emissions in
controlling the energy budget of lower thermosphere during solar minimum and
solar maximum.

As mentioned earlier, the total amount and pattern of NO radiative cooling are
controlled by both composition (O2, O, and NO) and temperature, which vary
significantly through different seasons and at different latitude regions. The
seasonal variation in outgoing energy loss of lower thermosphere in form of NO
infrared radiative cooling will also depend on total incoming energy in
different seasons. Since, the summer hemisphere gains more incoming energy in
comparison to the winter hemisphere, we expect more NO infrared emissions from
summer hemisphere. Due to the temperature gradient caused by the asymmetrical
solar heating between the hemispheres, meridional winds from summer to winter
in the lower thermosphere also result in a higher concentration of lighter
species (oxygen atoms) in the winter hemisphere. Heavier species (O2, and N2),
however, are concentrated in the summer hemisphere ([14]). As a result, it
would also affect the column O/N2 ratios at different altitudes and latitudes
through different seasons.

Study of thermospheric NO radiative cooling patterns and associated
thermospheric density response can help in predicting satellite drag in
earth’s upper atmosphere during different solar and geophysical conditions
[15, 10]. The changing heat budget of atmosphere may also modulate other
atmospheric and ionospheric parameters that indirectly affect human life at
the surface. Some examples are, Lower Earth Orbit (LEO) satellite drags (which
are particularly used for geophysical imaging), GPS navigation, exposure of
thermospheric particles near ISS (International Space stations), etc. All
these aspects need to be considered for a better preparation and to mitigate
the potential threats due to space weather influence in future. In this work,
we investigate the variations in peak NO radiative cooling, and its altitude
in the local nighttime through different seasons in different latitude
regions. This work goes further to establish the responsible thermospheric
species or variable for the observed variability during the solar minimum
conditions. The data sources and data processing used in this study are
presented in Section 2. Section 3 represent the results and discussion of our
investigation, and the conclusions are presented in Section 4.

## Data analysis

In December 2001, the TIMED satellite was launched into a 625 km near-circular
orbit with a 74∘ inclination. Every 60 days, orbit precession allows for
24-hour local time coverage, and TIMED conducts a yaw movement to keep SABER
from pointing to the Sun, resulting in only few SABER observations around
local noon [16, 17]. Depending on the yaw cycle, the recorded geographic
latitude ranges from 83∘ in one hemisphere to 55∘ in the other. The SABER
instrument is a 10-channel infrared radiometer that sweeps the Earth’s limb
from the 400-km tangent height to the surface, taking an infrared radiance
sample every 0.4 km. The instrument’s spectral coverage ranges from 1.27 to
15.4 $\mu m$, including NO at 5.3 $\mu m$. Since most of the observational
data from SABER (Level2A in-band NO infrared emissions) is in nighttime, we
have only utilized its nighttime datasets (between 18 Solar Local Time (SLT)
to 6 SLT through midnight), the TIMED/SABER observed SLT datasets have been
considered for this classification.

To investigate the seasonal variation in peak NO radiative cooling and its
corresponding altitude in absence of geomagnetic activity, first three IQDs
(q1, q2, q3) are considered for each months during solar minimum (year 2018).
The daily averages between q1, q2, and q3 with 20∘ latitudinal resolution are
implemented to establish the seasonal variation for both the parameters.
Empirical atmospheric model NRLMSISE-00 (Naval Research Laboratory Mass
Spectrometer and Incoherent Scatter Radar Exosphere) output datasets are used
in different latitude and altitude regions with 31 days running average also
only for the nightside. SNOE (Student Nitric Oxide Explorer) observational
datasets are also used to understand the variations of NO density throughout
the seasons in different latitude regions.

## Results and Discussion

As mentioned earlier, in this study we investigate the temperature and
compositional (O, and NO) contribution to the TIMED/SABER observed nighttime
NO peak radiative cooling and its altitude in different latitude regions. [1]
presented the seasonal variations in peak NO radiative cooling at different
local time and latitudes and compared it with TIE-GCM (Thermosphere-
Ionosphere-Electrodynamics General Circulation Model) simulated results.
However, the contribution of atmospheric parameters (such as perturbed
dynamics, composition, and temperature) accounting to such variation is still
an open question. Figure 1 and Figure 2 show the nighttime peak NO radiative
cooling and its corresponding altitude, respectively. The variation in these
parameters is shown at different latitude regions during both solar maximum
((a) 2013, (b) 2014, and (c) 2015) and solar minimum ((d) 2018, (e) 2019, and
(f) 2020) conditions. The 27-day averaged F10.7 index during 24 solar cycle
(figure not shown here) also shows that year 2013, 2014, and 2015 lie within
the solar maximum, while year 2018, 2019, and 2020 lies within the solar
minimum period. It is to be noted that only the peak emission rate of a given
profile is taken for representation in these figures. It can be seen in Figure
1 that during solar maximum and solar minimum conditions most of the peak NO
radiative cooling occurs in high latitude regions of both the hemispheres,
with its larger equator-ward penetration from summer hemisphere. The colorbar
limit in the figure during both the conditions are different, which also
suggests that the peak cooling is also larger during the solar maximum in
comparison to solar minimum, as expected.

It is to be noted that during solar minimum conditions, high speed solar wind
(HSSW) and co-rotating interaction region (CIR) can caused minor storms. The
geomagnetic Ap index throughout the year 2018 (figure not shown here) suggests
that there are at least 6 minor storms (18-19 March, 20 April, 5-6 May, 13
September, 7 October, and 5 November) and one major geomagnetic storm (26
August) present during this period. As mentioned earlier, presence of these
storms can be seen in form of enhanced peak NO cooling and its penetration
towards the equator from both polar regions. In particular, it can be seen in
Figure 1 (d) that peak NO cooling is enhanced in about every latitude region
during the major geomagnetic storm of 26 August, which was driven by
aggregation of a weak coronal mass ejection (CME) transients and CIR/HSSs

It is interesting to note in Figure 1 and Figure 2 that the both peak NO
radiative cooling and its altitude show a seasonal variation, particularly
during solar minimum conditions. During solar minimum conditions, the NO peak
emission rates in low to mid-latitude regions are larger with lower peak
altitudes in the summer hemisphere in comparison to winter hemisphere.
However, during solar maximum conditions, the seasonal variation in the
altitude of peak NO radiative cooling get disrupted as can be seen in Figure 2
(a, b, and c). The strongly perturbed meridional winds during solar maximum
conditions can play a major role in determining the global NO radiative
cooling. It has been reported in the past that meridional winds can control
the global distribution of both NO density, and NO radiative cooling [18, 10,
11]. As a result, we can expect a perturbation in seasonal variation of peak
NO radiative cooling and its respective altitude during the solar maximum.

Figure 2 shows that during solar minimum, altitude of peak NO radiative
cooling is mostly restricted to the northern hemisphere during the months of
October through February with an average of about 140 km. Meanwhile, during
the months of April through August the peak is located in the southern
hemisphere. The latitude regions manually bounded by the blue lines throughout
the year 2018 shows this variation. The same boundary line is indicated with a
red line in Figure 1 (d), which shows that, for almost all days, the peak NO
radiative cooling has a minima in this bounded red lines regions.

To understand the seasonal variation of peak altitude of NO radiative cooling
(Figure 1 and Figure 2) in the absence of geomagnetic activity, three
international quiet days (IQDs) are considered in each month throughout year
2018. In Figure 3 (a-l), daily nighttime mean of both the investigative
parameters are shown with 20∘ latitude resolution (40-60 ∘, 20-40 ∘, 0-20 ∘).
This figure establishes that, during northern summer months (May, June, July)
northern hemisphere witnesses lower peak altitude in comparison to southern
hemisphere. Similarly, during winter months (November, December, January,
February) in northern hemisphere, it can be clearly seen that the southern
hemisphere has lower peak altitude in comparison to northern hemisphere. It is
also to be noted from the figure that, the variation in NO radiative cooling
is exactly opposite to what is seen in peak altitude. A negative correlation
coefficient of -0.73 is found (Figure 4) by considering the same datasets
utilized in Figure 3. That is, in summer hemisphere peak NO radiative cooling
profile has a larger value with lower peak altitude in comparison to winter
hemisphere. This aspect is further elaborated by utilizing the NRLMSISE-00
datasets in upcoming paragraphs.

Figure 5 (a-j) shows the NRLMSISE-00 estimated 31 day running average
variation in temperature at various latitude sectors for a given altitude. A
clear seasonal variation in temperature at all the altitudes, and latitudes
can be seen between 110 to 170 km. This can be mainly due to the asymmetrical
solar heating between both the hemispheres. From April to August, the
temperature in northern hemisphere is larger in comparison to the southern
hemisphere with its larger values towards the poles. The same is true for
southern hemisphere during the months between October to February. A wave like
pattern in temperature can be seen in almost every latitude and altitude
region in lower thermosphere, which could be due to the effect of solar EUV or
captured by the F10.7 index variations, which also follows the 27-day solar
rotation period. As the active chemical reactions (Table 1) responsible for
5.3 $\mu m$ emission by NO depend on temperature, it would be interesting to
see the effects of seasonally & latitudinally varying temperature on the peak
NO radiative cooling emission and its corresponding altitude.

The collisional excitation rate of NO (v = 0) to NO (v = 1) strongly depends
on temperature along with the concentration of atomic oxygen (collisional
excitation rate C01 (sec-1) = [O] $\times$ $4.2\times
10^{-11}\exp({-2700/\textrm{T}})$) ([19, 20]), which makes atomic oxygen an
important constituent in controlling the NO radiative cooling emissions.
Figure 6 (a-j) shows the seasonal variation in atomic oxygen density for
different altitudes and latitudes same as Figure 5 (a-j). It can be seen in
the figure that, the variation in atomic oxygen is in opposite sense of
temperature, i.e. (1) its density is decreasing with altitude and (2) its
density is larger in northern hemisphere during the months of October to
February and in the southern hemisphere during the months of April to August.
These variations are expected due to expansion of the atmosphere during larger
temperature, and higher susceptibility of oxygen atoms to the dynamical
transport by winds induced by asymmetric solar heating.

An engrossing correlation between the atomic oxygen density and the altitude
of peak NO radiative cooling (Figure 2 (d)) in different latitude regions is
also noticeable. In January, February, November, and December, it can be seen
in the figures that both oxygen density, and altitude of peak NO radiative
cooling are highest in the northern hemisphere. From mid March to April the
oxygen density reaches a peak with comparable concentration in every latitude
regions except for the northern polar region. At the same time, the observed
altitude of peak cooling emissions are also elevated in almost all the
latitude regions between 40∘N to 60∘S. During May to August the observed
enhanced peak altitude of NO cooling is limited to 10∘N to 60∘S, where the
atomic oxygen density (Figure 6) is also higher in southern hemisphere in
comparison to the northern. A positive correlation of 0.88 is also found
between atomic oxygen density and altitude of peak NO radiative cooling, while
a negative correlation of -0.64 is found between temperature and altitude of
peak NO radiative cooling (Figure 7(a & b)) by considering the IQDs datasets
for June and December months of year 2018.

The population ratio of excitation (NO ($\textit{v}=0$) to NO
($\textit{v}=1$)) and quenching (NO ($\textit{v}=1$) to NO ($\textit{v}=0$))
rate of NO with atomic oxygen is shown in Figure 8 (a-j) in the same format as
Figure 5 & 6 (population ratio; C01/C10 =
4.2$\times$10-11$[O]$$\exp({-2700/\textrm{T}})$/(A5.3μm \+
4.2$\times$10-11$[O]$); where A5.3μm is the Einstein coefficient for
spontaneous emission (12.32 sec-1)). It is evident from the figure that the
population ratio in every latitude regions is increasing with height and
reaching a maximum around 145-150 km, after which it again starts decreasing
very slowly. There is no clear seasonal variation till the altitude of 130 km,
after that a clear enhancement in population ratio from January to March and a
decrement from April to July can be seen. During summer months in northern
hemisphere (May to August), the population ratio is larger in southern
hemisphere dominating near low to mid latitude regions (0-40 ∘S) and reaches a
minimum near mid-latitudinal northern hemisphere. Similarly, during the winter
months in northern hemisphere (November to February) the ratio is larger near
0-40 ∘N and reaches a minimum near mid-latitudinal southern hemisphere. During
the months of late March, April, late September, and October, the population
ratio reaches its highest in low latitude regions (0-20∘N, and 0-20∘S)
followed by the mid (20-40∘N, and 20-40∘S) regions of both the hemisphere. The
reason behind this particular enhancement of C01/C10 could be due to the
increase in atomic oxygem density in winter hemisphere, and near equinoxes.
The enhancement near equinoxes are supposed to be due to the semiannual
variation in thermospheric density and composition ([21]). It is proposed that
density scale height is higher during equinoxes than solstices due to less
mixing caused by lower large-scale inter-hemisphere circulation, resulting in
semiannual variation in neutral density. The effect of this semiannual
variation is also present in TIMED/SABER observed nighttime NO radiative
cooling profiles in form of its large peak altitudes (Figure 2) during the
same periods (March, April, September, and October). Ratio C01/C10 also have a
positive correlation (0.76; Figure 7 (c)) with altitude of peak NO radiative
cooling during IQDs of June and December months of year 2018. This indicates
that regions with larger C01/C10 (winter hemisphere) have larger peak altitude
of NO radiative cooling.

In addition to the temperature and oxygen abundance, NO density also plays an
important role in determining the NO radiative cooling profile ([22, 12]).
Since there is no continuous observational data of thermospheric NO density
during the 24 solar cycle, SNOE observed datasets have been utilized to
observe the seasonal variation in NO density in every latitude range. Figure 9
represents the SNOE observed NO density profile for the 935-day period (from
11 March 1998 to 30 September 2000) (as in [23]). At the start of the 935-day
period, the SNOE observations were taken at a mean local time of 10:17 AM,
which shifted to 11:11 AM at the conclusion of the period. In the polar
regions, NO is created by energetic electron precipitation in nightside and
detected during the day when the Earth’s rotation has shifted the location of
electron precipitation into sunlight. In the mid to low latitude regions, only
solar radiation (soft X-rays, EUV), and meridional winds are responsible for
the variability of NO density. Consequently, it can also be seen in both the
figures (Figure 9; top panel and second panel from below) that equatorial to
mid latitude NO density is enhanced in summer hemisphere, which also sometimes
seems to penetrate into winter hemisphere possibly due to strong summer to
winter meridional winds. Figure 9 (second panel from above) represents the
altitude of peak NO density observed by SNOE. It is evident in the figure that
there is no clear asymmetry in the peak altitude between both the hemispheres,
which is about 105 km in high latitude and about 110 km in mid latitude
regions during solstices.

The enhanced NO density profile competes with C01/C10 population ratio profile
to determine the altitude of peak NO radiative cooling emissions. It is
evident in Figure 2(d) that, in most of the regions peak altitude NO cooling
is above 120 km. Figure 9 (lower panel) represents the peak NO density above
120 km, which also shows the same seasonal variation as Figure 9 (second panel
from below).

Both the peak NO density (Figure 9; lower two panel) and peak NO cooling
emissions (Figure 1(d)) have their minima in low-mid latitude of winter
hemisphere. However, the peak NO cooling altitude in the same region are
highest above 135 km (Figure 2 (d)) compared to other regions. Hence, it might
be concluded that, in these particular regions due to the lower NO density,
the peak altitude of NO cooling is controlled mostly by the temperature and
atomic oxygen in the form of population ratio of NO (C01/C10), which
approximately peaks at about 145 km. At the same time, for the low-mid
latitude of summer hemisphere, the contribution of enhanced NO densities
particularly at altitude about 120-130 km dominates over the population ratio
(C01/C10) (i.e., temperature & oxygen) in determining the altitude of peak NO
cooling emission rates, which is at about 125-130 km.

To establish the seasonal variation in altitude of peak NO radiative cooling
using SNOE datasets, the latitudinal variation in SNOE estimated peak NO
radiative cooling and its corresponding altitude is also represented in Figure
10 (a-d) during summer solstice (21 June) of 1998. NRLMSISE-00 estimated (a)
temperature and (b) oxygen density altitude profile is also shown at about 10
LST with (c) SNOE’s observational path of NO density at different latitudes,
which are also used to estimate the (d) NO emission rate (NOER = C01/C10
$\times$ [NO]). It can be seen from the figure that , in polar and mid
latitude region of summer (northern) hemisphere, the altitude of peak NOER is
lower (136 km) in comparison to equatorial to mid-latitude region of winter
hemisphere (140 km) (Figure 10(d)). In the winter polar region, again due to
enhanced NO density in lower thermosphere, the altitude of peak NO cooling
becomes lower (130 km) with enhanced NO cooling (Figure 10(c & d)). The SNOE
estimated latitudinal/seasonal variation in the altitude of peak NOER are
higher than observed by TIMED/SABER (125-130 km) (Figure 2). However, their
qualitative variation is parallel irrespective of their different time of
observation. This suggest that NO density profile between 120-140 km is very
crucial to determine the peak NO radiative cooling and its altitude in every
season.

## Conclusions

In this study, we have investigated the contribution of composition, and
temperature in the TIMED/SABER observed peak NO cooling emission and its
altitude. By comparing low- to mid- latitudinal variations during the first
three IQDs for each months of year 2018, it was clearly seen that there is a
strong summer-winter variability in both peak NO radiative cooling emission
and its corresponding altitude. The region of enhanced NO density (polar, and
low to mid latitude of summer hemisphere) particularly between 120-140 km
leads to larger NO radiative cooling with lower peak altitude (125-130 km).
The equatorial to mid latitude of winter hemisphere have low NO density, due
to which NO radiative cooling is low with its peak altitude at about 140 km.
The hemispheric asymmetry of [NO] and [O] due to asymmetric solar heating
between both the hemispheres seem to be the root cause of such variations
during solar minimum conditions. Both the peak NO radiative cooling emissions,
and its peak altitude are controlled by a combined effect of [O], [NO], and
temperature variations. The contribution of [O], and temperature in form of
population ratio of NO ($v$ = 1)/NO ($v$ = 0) (C01/C10) is dominant in the low
to mid latitudes of winter hemisphere. This is very crucial in determining the
vertical profile of NO radiative cooling in winter hemisphere. The three
parameters ([NO],[O],T) responsible for the net radiaitve flux at 5.3 $\mu$m
seems to vary as a function of latitude and altitude. During solar maximum
conditions, these seasonal pattern could get disrupted due to storm induced
intensified meridional winds.

## Acknowledgments

We thank TIMED/SABER, NRLMSISE-00 and SNOE science teams for providing the
data ($http://saber\\-.gats-Inc.com/browse\\_data.php$),
($https://ccmc.gsfc.nasa.gov/modelweb/models/nrlmsise00.php$),
($https://lasp\\-.colorado.edu/snoe/data/$) used in this study. One of the
author AKR thanks Ministry of Human Resource Development, New Delhi for the
financial support in the form of graduate assistantship.

## References

  * [1] Li, Z., Knipp, D., Wang, W., Sheng, C., Qian, L. and Flynn, S., A comparison study of NO cooling between TIMED/SABER measurements and TIEGCM simulations. Journal of Geophysical Research: Space Physics 123(10), 2018.
  * [2] Kockarts, G., Nitric oxide cooling in the terrestrial thermosphere. Geophysical Research Letters, 7(2), 137-140, 1980.
  * [3] Barth, C.A., Baker, D.N. and Bailey, S.M., Seasonal variation of auroral electron precipitation. Geophysical research letters 31(4), 2003.
  * [4] Barth, C.A., Lu, G. and Roble, R.G., Joule heating and nitric oxide in the thermosphere. Journal of Geophysical Research: Space Physics 114(A5), 2009.
  * [5] Mlynczak, M., Martin-Torres, F.J., Russell, J., Beaumont, K., Jacobson, S., Kozyra, J., Lopez-Puertas, M., Funke, B., Mertens, C., Gordley, L. and Picard, R., The natural thermostat of nitric oxide emission at 5.3 ?m in the thermosphere observed during the solar storms of April 2002. Geophysical Research Letters 30(21), 2003.
  * [6] Mlynczak, M.G., Martin-Torres, F.J., Crowley, G., Kratz, D.P., Funke, B., Lu, G., Lopez?Puertas, M., Russell III, J.M., Kozyra, J., Mertens, C. and Sharma, R., Energy transport in the thermosphere during the solar storms of April 2002. Journal of Geophysical Research: Space Physics 110(A12), 2005.
  * [7] Mlynczak, M. G., Hunt, L. A., Thomas Marshall, B., Martin$-$Torres, F. J., Mertens, C. J., Russell III, J. M., … & Gordley, L. L., Observations of infrared radiative cooling in the thermosphere on daily to multiyear timescales from the TIMED/SABER instrument. Journal of Geophysical Research: Space Physics, 115(A3), 2010.
  * [8] Oberheide, J., M. G. Mlynczak, C. N. Mosso, B. M. Schroeder, B. Funke, and Astrid Maute, Impact of tropospheric tides on the nitric oxide 5.3 $\mu$m infrared cooling of the low‐latitude thermosphere during solar minimum conditions. Journal of Geophysical Research: Space Physics, 118(11), 2013.
  * [9] Knipp, D.J., Pette, D.V., Kilcommons, L.M., Isaacs, T.L., Cruz, A.A., Mlynczak, M.G., Hunt, L.A. and Lin, C.Y., Thermospheric nitric oxide response to shock?led storms. Space Weather 15(2), 2017.
  * [10] Li, Z., Knipp, D. and Wang, W., Understanding the behaviors of thermospheric nitric oxide cooling during the 15 May 2005 geomagnetic storm. Journal of Geophysical Research: Space Physics 124(3), 2019.
  * [11] Bag, T., Local-time, seasonal and solar cycle variation of Nitric Oxide radiative emission over Indian longitude sector. Advances in Space Research 68(6), 2021.
  * [12] Ranjan, A.K., Sunil Krishna, M.V., Kumar, A., Sarkhel, S., Chakrabarty, D. and Reeves, G.D., NO Radiative Cooling and Ionospheric Response to the HILDCAA Events Following Geomagnetic Storms. Journal of Geophysical Research: Space Physics, 128(12), p.e2023JA032028, (2023)
  * [13] Lu, G., Mlynczak, M.G., Hunt, L.A., Woods, T.N. and Roble, R.G., On the relationship of Joule heating and nitric oxide radiative cooling in the thermosphere. Journal of Geophysical Research: Space Physics 115(A5), 2010.
  * [14] Brasseur, G. P., & Solomon, S., Aeronomy of the middle atmosphere: Chemistry and physics of the stratosphere and mesosphere (Vol. 32). Springer Science & Business Media, 2005.
  * [15] Knipp, D., Kilcommons, L., Hunt, L., Mlynczak, M., Pilipenko, V., Bowman, B., Deng, Y. and Drake, K., Thermospheric damping response to sheath-enhanced geospace storms. Geophysical Research Letters 40(7), 2013.
  * [16] Mlynczak, M.G., Energetics of the mesosphere and lower thermosphere and the SABER experiment. Advances in Space Research 20(6), pp.1177-1183, 1997.
  * [17] Esplin, R., Mlynczak, M.G., Russell, J., Gordley, L. and SABER Team., Sounding of the Atmosphere using Broadband Emission Radiometry (SABER): Instrument and science measurement description. Earth and Space Science 10(9), p.e2023EA002999, 2023.
  * [18] Barth, C.A., Joule heating and nitric oxide in the thermosphere, 2. Journal of Geophysical Research: Space Physics 115(A10), 2010.
  * [19] Hwang, E.S., Castle, K.J. and Dodd, J.A., Vibrational relaxation of NO (v = 1) by oxygen atoms between 295 and 825 K. Journal of Geophysical Research: Space Physics 108(A3), 2003.
  * [20] Mlynczak, M. G., Hunt, L. A., Lopez$-$Puertas, M., Funke, B., Emmert, J., Solomon, S., … & Mertens, C., Spectroscopy, gas kinetics, and opacity of thermospheric nitric oxide and implications for analysis of SABER infrared emission measurements at 5.3 $\mu$m. Journal of Quantitative Spectroscopy and Radiative Transfer, 268, 107609, 2021.
  * [21] Fuller‐Rowell, T. J., The “thermospheric spoon”: A mechanism for the semiannual density variation, Journal of Geophysical Research: Space Physics 103(A3), 2003.
  * [22] Bharti, G., Sunil Krishna, M.V., Bag, T. and Jain, P., Bharti, G., Sunil Krishna, M.V., Bag, T. and Jain, P., 2018. Storm time variation of radiative cooling by nitric oxide as observed by TIMED?SABER and GUVI. Journal of Geophysical Research: Space Physics 123(2), 2018.
  * [23] Barth, C.A., Baker, D.N. and Bailey, S.M., Seasonal variation of auroral electron precipitation. Geophysical research letters 31(4), 2003.
  * [24] Duff, J.W., Dothe, H. and Sharma, R.D., On the rate coefficient of the N(2D) + O2 $\rightarrow$ NO + O reaction in the terrestrial thermosphere. Geophysical research letters 30(5), 2003.
  * [25] Siskind, D.E. and Rusch, D.W., Nitric oxide in the middle to upper thermosphere. Journal of Geophysical Research: Space Physics 97(A3), 1992.
  * [26] Swaminathan, P.K., Strobel, D.F., Kupperman, D.G., Kumar, C.K., Acton, L., DeMajistre, R., Yee, J.H., Paxton, L., Anderson, D.E., Strickland, D.J. and Duff, J.W., Nitric oxide abundance in the mesosphere/lower thermosphere region: Roles of solar soft X rays, suprathermal N(4S) atoms, and vertical transport. Journal of Geophysical Research: Space Physics 103(A6), 1998.

Figure 1. Latitudinal or seasonal variation in peak NO radiative cooling in lower thermosphere throughout solar maximum ((a) 2013, (b) 2014, (c) 2015) and solar minimum ((d) 2018, (e) 2019, (f) 2020) of solar cycle 24. Figure 2. Latitudinal or seasonal variation in the altitude of peak NO radiative cooling throughout solar maximum ((a) 2013, (b) 2014, (c) 2015) and solar minimum ((d) 2018, (e) 2019, (f) 2020) of solar cycle 24. The blue lines are drawn to mostly represent the regions which have larger peak altitudes at a particular DOY compared to other regions. Figure 3. (a-l) Latitudinal or seasonal variation in the altitude of peak NO radiative cooling throughout quiet days for year 2018. The blue lines represent the peak altitude (km) and red lines represent the corresponding peak NO radiative cooling (ergs/cm3/sec) values. Figure 4. Correlation of peak NO radiative cooling with its corresponding altitude for quiet days of year 2018. Figure 5. Seasonal variation in nighttime temperature at different altitudes and in different latitude zones throughout the year 2018 as estimated by NRLMSISE-00. Table 1. NO Reaction Rate Coefficients Reaction |  Rate Coefficient |  Reference
---|---|---
(R1) N(2D) + O2 $\rightarrow$ NO + O |  $6.2\times 10^{-12}(\textrm{T}/300)$ |  [24]
(R2) N(4S) + O2 $\rightarrow$ NO + O |  $1.5\times 10^{-11}\exp({-3600/\textrm{T}})$ |  [25]
(R3) N(4S) + NO $\rightarrow$ N2 \+ O |  T$>$400 K:$3.25\times 10^{-11}$ |  [26]
(R4) N(4S) + NO $\rightarrow$ N2 \+ O |  T$<$400 K:$2.2\times 10^{-11}\exp({160/\textrm{T}})$ |  [26]
(R5) NO($v$=1) + O $\rightarrow$[k10] NO($v$=0) + O |  $4.2\times 10^{-11}$ |  [19]
(R6) NO($v$=0) + O $\rightarrow$[k01] NO($v$=1) + O |  $4.2\times 10^{-11}\exp({-2700/\textrm{T}})$ |  [19, 20]
Figure 6. Seasonal variation in nighttime oxygen density at different
altitudes and in different latitude zones throughout the year 2018 as
estimated by NRLMSISE-00. Figure 7. Correlation of peak altitude of NO
radiative cooling with (a) atomic oxygen, (b) temperature, and (c) C01/C10 for
June and December months throughout the quiet days of year 2018. Figure 8.
Seasonal variation in nighttime NO (v = 1) population ratio (C01/C10) at
different altitudes and in different latitude zones throughout the year 2018
as estimated by NRLMSISE-00. Figure 9. Latitudinal or seasonal variation in
(a) NO column density, (b) altitude of peak NO density, (c) peak NO density,
and (d) peak NO density above 120 km as observed by SNOE. This plot
corresponds to 1998-2000 period. Figure 10. Altitudinal variation in
NRLMSISE-00 estimated (a) temperature, (b) O density, (c) SNOE observed NO
density, and (d) NRLMSISE-00 & SNOE estimated NOER at different latitudes and
0 E longitude at 10 UT on 21 June 1998.


# Cross-border Exchange of CBDCs
using Layer-2 Blockchain

Krzysztof Gogol<EMAIL_ADDRESS>Department of Computer Science, University
of Zurich Johnnatan Messias Matter Labs Malte Schlosser Department of Banking
and Finance, University of Zurich
Benjamin Kraner Department of Computer Science, University of Zurich and
Claudio Tessone UZH Blockchain Center, University of Zurich

###### Abstract

This paper proposes a novel multi-layer blockchain architecture for the cross-
border trading of CBDCs. The permissioned layer-2, by relying on the public
consensus of the underlying network, assures the security and integrity of the
transactions and ensures interoperability with domestic CBDCs implementations.
Multiple Layer-3s operate various Automated Market Makers (AMMs) and compete
with each other for the lowest costs. To provide insights into the practical
implications of the system, simulations of trading costs are conducted based
on historical FX rates, with Project Mariana as a benchmark. The study shows
that, even with liquidity fragmentation, a multi-layer and multi-AMM setup is
more cost-efficient than a single AMM.

###### keywords:

Decentralized Finance Automated Market Maker CBDC Layer-2 Blockchain

##  1 Introduction

The Bitcoin network, launched in 2008, was first described in a whitepaper by
the anonymous individual or group, known as Satoshi Nakamoto [1]. The
fundamental promise of this first cryptocurrency was to establish a peer-to-
peer payment system that operates independently of traditional financial
intermediaries. In 2014, Vitalik Buterin introduced Ethereum [2], the next
generation blockchain with a virtual machine capable of executing computer
programs known as smart contracts. With Ethereum and the Ethereum Virtual
Machine (EVM), Decentralized Finance (DeFi) was born. By utilizing smart
contracts, DeFi offers sophisticated financial services, such as trading,
lending, borrowing, derivatives and asset management [3, 4, 5, 6].

It quickly became apparent that this new blockchain-based financial system
required non-volatile tokens, giving the advent to stablecoins—tokens with
values pegged to fiat currencies. The success of stablecoins prompted central
banks to explore similar solutions, leading to the development of Central Bank
Digital Currencies (CBDCs) [7]. While CBDCs do not necessarily have to be
implemented on a blockchain, the decentralized approach promises enhanced
scalability and security [8, 9, 10, 11]. Various central banks across the
globe are already engaged in CBDC initiatives[8, 9, 12]. The collective effort
explores ways to integrate these CBDCs into a unified marketplace, potentially
transcending borders, as seen in Project Mariana by the Bank for International
Settlements (BIS) [8].

This paper introduces a novel architectural framework for cross-border CBDC
trading that is based on Layer-2 (L2) blockchain scaling. L2s proved to be an
efficient approach for addressing the limitations of Ethereum, especially
scalability and privacy. [13, 14, 15]. The proposed system is the rollup on
the public L1 blockchain that seamlessly integrates additional Layer-3 (L3)
blockchains, each operating decentralized exchanges (DEXes), or other DeFi
protocols, utilizing CBDCs. The system automatically selects L3 and DEXes with
optimal costs. This system architecture is compared to the approach of Project
Mariana in a series of simulations based on the historical Foreign Exchange
(FX) rates.

##  2 Background

This section introduces the concept of Layer-2 blockchain, presents the
functionalities of Project Mariana, and summarizes this work’s contributions
to the research on cross-border CBDCs exchange.

Figure 1: Architecture of Rollup—Layer-2 blockchain that stores state in
underlying Layer-1 blockchain

Figure 2: Project Mariana Architecture: Cross-Border CBDC Exchange using
Cryptoswap Invariant AMM

###  2.1 Layer-2 Blockchains

There are two approaches to tackle the challenges of blockchain scalability
and related high gas prices: Layer-1 and Layer-2 blockchains. Layer-1 scaling
involves creating entirely new blockchains, e.g., with unique consensus
mechanisms or block sizes. These chains operate with their own validators and
infrastructure, requiring decentralization to win users’ trust. Layer-2
scaling takes a different approach and uses complex computations off-chain
(outside of Ethereum), aiming to reduce on-chain data congestion. These off-
chain activities include rollups, sidechains, plasma, and state channels.
Layer-2 blockchains rely on the security of underlying Layer-1 chains, such as
Ethereum, for final settlement.

Rollups represent a form of Layer-2 scaling that does not custody any data by
themselves. Rollups offload complex calculations from the Ethereum mainnet and
store the results (along with other transactions) in Ethereum after
compressing them. Fig. 2 illustrates rollup architecture with key
components—sequencers and verifiers. Sequencers roll up transactions to the
Layer-1 chain. By bundling transactions, rollups manage to save on gas fees.
Verifiers are smart contracts that operate on Ethereum and verify the
transactions stored by the sequencer. They ensure the correctness of the
transactions.

###  2.2 Project Mariana

The specific focus of this work is on facilitating cross-border exchanges of
CBDCs. One notable proposal for such a solution is Project Mariana
(L1-Mariana) [8], initiated by BIS, the Swiss National Bank, the Bank of
France, and the Monetary Authority of Singapore.

Within L1-Mariana, a DEX with an Automated Market Maker (AMM) is employed to
exchange wholesale CBDCs versions of Swiss Franc (CHF), Euro (EUR), and
Singaporean Dollar (SGD). The selected AMM is the Stableswap Invariant, first
introduced by Curve v2—the second largest DEX in terms of trading volumes in
permissionless DeFi on Ethereum [16]. The setup involves bridges that
facilitate the transition of wholesale CBDCs from domestic central bank
blockchains to the chain where the Cryptoswap Invariant pool operates, as
depicted in Fig. 2.

Whereas the project proved the feasibility of AMM-DEX for cross-border CBDCs
exchange, several questions arise—e.g., the choice of the blockchain (and its
scalability and security), the AMM and the pool types (3-token pools vs
2-token pool)—which this research addresses.

##  3 Related Work and Contribution

There is an abundance of literature discussing the implementation of CBDCs in
various countries [9, 10, 11, 17, 12], but little research on the exchange
between CBDCs in AMMs, except for Project Mariana [8]. Lipton and Sepp[18]
study the implicit costs (slippage cost) for G-10 CBDCs exchange at AMM with
Concentrated Liquidity (Uniswap v3).

Our work is the first research that takes the holistic approach to analyze the
total costs of CBDCs exchange at various AMMs, including Stableswap Invariant
(Curve v2), applied in Project Mariana. This study found that a multi-AMM set-
up for CBDCs exchange on L2 is more cost-efficient than a single AMM of
Project Mariana, despite the fragmentation of liquidity among various AMMs.
Such a multi-AMM system on private L2 is further presented, and its behavior
is evaluated via simulation based on the historical FX rates, Mariana Project
set up as a benchmark.

This work makes the following contributions.

$\blacktriangleright$ Demonstrating that multi-AMMs set-up for CBDCs exchange
is more cost-efficient than a single AMM.

$\blacktriangleright$ Designing such multi-AMMs set-up for CBDCs exchange
using L2 and L3 blockchains and demonstrating its superior performance for
small, medium, and largest transaction volumes and any transaction in case of
spikes of gas fees.

$\blacktriangleright$ Conducting first detailed analysis of the total costs of
CBDCs swaps on AMM-DEX—gas fees, swap fees (explicit fees), and slippage costs
(explicit fees), among various AMMs and L1 and L2-based DEXes.

$\blacktriangleright$ Providing quantitative metrics to evaluate the
efficiency of cross-border CBDCs on DEXes for major AMMs. Their implementation
is available in the public GitHub repository [19]

$\blacktriangleright$ Building a framework for simulation based on historical
FX rate that can be replicated in other cross-border CBDCs projects or in
permission DeFi in the Ethereum ecosystem. For all metrics, the mathematical
background and numerical methods with the implementation are provided, such as
the Newthon-Raphon method for slippage in Cryptoswap Invariant AMM applied in
Project Mariana.

##  4 System Architecture

This paper proposes a novel approach for facilitating cross-border CBDCs
exchange through a rollup (a form of L2 blockchain) on the public Layer-1
network, further enhanced with a Layer-3 (L3), as illustrated in Fig. 3.

Figure 3: General Architecture of Cross-Border CBDC Exchange using L3 and L2s
on Public Layer-1 Network

Blockchain and VM Type. The system operates as a L2 blockchain on the public
L1 network, benefiting from the inherent security and infrastructure of the
L1, including consensus mechanisms and miners/validators. Bitcoin, Ethereum or
other L1 networks can be the underlying L1. The system also incorporates
Virtual Machines (VMs) to execute smart contracts, with the Ethereum Virtual
Machine (EVM) being our chosen VM due to its compatibility with most DeFi
protocols.

L2 and L3s Responsibilities. L2 is the data integration layer and its
operations are managed by central institutions like BIS, focusing on
interoperability with other CBDC blockchains and facilitating communication
between L2 and L3s. The system supports multiple independent L3 blockchains,
each with the authority to determine the deployment of decentralized exchanges
(DEX) and Automated Market Makers (AMM). Furthermore, the deployment of other
DeFi protocols is feasible within this framework. AMM and exchange logic of
L3s is moved to the external entities that compete with each other.

Transaction Privacy and Compliance. The L2 and L3 blockchains are private
(permissioned networks). All participants must undergo KYC [20] procedures
before entering the system. This ensures the system can maintain full
transaction privacy, e.g. by leveraging zero-knowledge proofs technology [21],
while adhering to regulatory requirements.

Proof-of-storage. We propose utilizing proof of storage protocols to enhance
the security, instead of bridges. Unlike bridges that often involve trust
assumptions and centralization, the system employs a proof-of-storage
approach. CBDC tokens are directly minted on L2, and proof-of-storage
protocols rely on corresponding token reserves within country-specific CBDC
blockchains.

Rule-based router to L3s. At the core of the system is a Rule-based router
hosted on L2. This router employs rules to select the optimal AMM-DEX and L3
for traders at any given moment. Trading fees are dependent on gas costs and
trade expenses, and the router optimizes these parameters for each trade.

Integration with DeFi on Ethereum. To ensure compatibility with regulations,
the system integrates with DeFi through the privacy pools on the Ethereum
blockchain, proposed by Buterin et al.[22]. Only profiles and users validated
through these pools are permitted to trade CBDCs, with no additional
restrictions or limitations imposed.

Comparison to Mariana Project. A key distinction is its flexibility regarding
AMMs, allowing external operators to make decisions about the types of AMMs or
central limit order books they wish to operate on L3. Operators of L3s retain
control over actions and DeFi protocols within their respective layers.
Another advantage of the L2-based system with L3 enhancements is cost
optimization and resistance to network congestion. The L2 router automatically
directs traders to the L3 AMM-DEX with the lowest trade and gas fees.

##  5 Metrics and AMMs

The major metric to consider for evaluation of the cross-border CBDCs exchange
is the cost of the CBDCs swap. In general, the total cost of DeFi service
consists of three components: [23, 24]

$\displaystyle TotalCost=GasFee+DeFiExplicitFee+DeFiImplicitFee$ (1)

_Gas Fees_ are paid to the blockchain operators for executing the transaction,
and _DeFi Explicit Fee_ to the DeFi protocol for the provided service. _DeFi
Implicit Fee_ are indirect fees specific to the design of the DeFi protocol.
For tokens swaps at AMM-DEX, swap fees is the explicit fee charged by the DEX,
whereas slippage (price impact) is the implicit fee: [23, 24]

$\displaystyle TotalSwapCost=GasFee+SwapFee+SlippageCost$ (2)

_SwapFee_ is typically the percentage of the transaction volume, and
_Liquidity Providers_ (LPs) supply capital to the AMM’s liquidity pools in
exchange for participation in swap fees. _Slippage Cost_ is the change in
exchange price caused by the transaction and is specific to the AMM type, the
liquidity pool size and transaction volume. The next section presents the
major AMM types and corresponding slippage calculation methods.

###  5.1 Automated Market Makers

Constant Function Market Makers are the dominant type of AMMs. They are
equipped with a reserve curve function
$F:\mathbb{R}^{N}_{+}\rightarrow\mathbb{R}$ that maps $N$ token reserves
$x_{i}$ to a fixed invariant (i.e., constant) $k$. The AMM-DEX in DeFi with
the highest trading volumes [16] are Curve v2 [25] and Uniswap v3 [26]. The
Project Mariana involves Curve v2 AMM and a 3-token pool. The formulation of
AMMs follows [27].

Constant Product with Concentrated Liquidity Market Maker (CLMM) - Uniswap v3

$(x_{1}+\frac{L}{\sqrt{S_{l}}})(x_{2}+L\cdot\sqrt{S_{u}})=L^{2}$ (3)

Stableswap Invariant - Curve v1

$K\cdot
D^{N-1}\cdot\sum\limits_{i=1}^{N}x_{i}+\prod\limits_{i=1}^{N}x_{i}=K\cdot
D^{N}+(\frac{D}{N})^{N}$ (4)

where $K=A\cdot\prod_{i=1}x_{i}\cdot D^{-N}\cdot N^{N}$.

Cryptoswap Invariant - Curve v2 As in equation (4), but with K defined as

$K=A\cdot\underset{\text{ =:
}K_{0}}{\underbrace{\frac{A\cdot\prod_{i=1}x_{i}}{D^{N}}\cdot
N^{N}}}\cdot\frac{\gamma^{2}}{(\gamma+1-K_{0})^{2}}$ (5)

###  5.2 Slippage at AMM-DEXs

Further, we consider 2-token, or 3-token pools and denote the reserves of
CBDCs in the pools by $x_{t}$ for CHF, $y_{t}$ for EUR, and $z_{t}$ for SGD at
time t. The FX spot rate CHF-EUR is $S_{t}$ and CHF-SGD is $P_{t}$. The token
reserves $x_{0}$, $y_{0}$, $z_{0}$ at the moment of the pool creation are set
by:

$\displaystyle x_{0}=N_{0},y_{0}=S_{0}N_{0},z_{0}=P_{0}N_{0}$ (6)

For a buy transaction of $\Delta y$ EUR in exchange for $\Delta x$ CHF at time
t and the slippage is:

$\displaystyle Slippage(\Delta x,\Delta y,S_{t})=\frac{\Delta y/\Delta
x}{S_{t}}-1$ (7)

In CLMM, LPs can define the price range $[S_{l},S_{u}]$, for which liquidity
is provided. When the exchange price $S_{t}$ moves outside the range
$[S_{l},S_{u}]$, LP does not earn any fees. For simplicity, we consider the
range $[\frac{S_{t}}{\alpha},S_{t}\alpha]$, where $\alpha>1$. Slippage at CLMM
can be expressed as [27]:

$\displaystyle Slippage(t)=\frac{\Delta
y}{N_{0}*\sqrt{S_{0}*S_{t}}}(1-\frac{1}{\sqrt{\alpha}})$ (8)

For $n>3$, the closed formula for slippage at Cryptoswap Invariant does not
exist [28]. The numerical approximation of the Newton-Raphson method is used
in two steps. First, given Eq. 6, the parameter D is calculated, and,
subsequently, $\Delta x$ is found.

##  6 Simulation

To ensure comparability with L1-Mariana , we consider three CBDCs: Swiss Franc
(CHF), Euro (EUR), and Singaporean Dollar (SGD) and back-test the total costs
of CBDCs swaps in L1-Mariana and L2-L3-Exchange systems. We consider the buy
transaction of EUR for CHF for volumes ranging from 1 EUR to 1mn EUR. The
slippage costs for CLMMs are calculated based on Eq. 8, and the Newton-Raphson
method is applied for Cryptoswap Invariants, both for $n=2$ and $n=3$. The
implementation of all methods is available in a public GitHub repository [19]
and was based on the smart contract code of Curve v2.

###  6.1 Data and Parameters

The analysis uses the historical exchange rates of CHF-EUR and CHF-SGD for the
last three years (daily closing values from Yahoo Finance). We assume that
arbitrageurs maintain prices aligned between CBDCs in AMMs and the FX market,
which allows us to calculate the historical AMM pools’ compositions based on
these FX rates.

Liquidity pools. We assume 100mn CHF is provided to each system for liquidity
provisions. As L1-Mariana operates Cryptoswap Invariant with one 3-token pool
CHF-EUR-SGD, the pool’s value is 100mn CHF. In L2-L3-Exchange, we consider
three L3 operators, each running AMM-DEX setup. The 100mn CHF liquidity is
equally divided among the L3 operators. The first L3 operator uses a
Cryptoswap Invariant with CHF-EUR-SGD pool (like in L1-Mariana), and the pool
is valued 100/3 mn CHF. The second L3 also employs Cryptoswap Invariant, but
with two 2-token pools: CHF-EUR and CHF-SGD, each valued 100/6 mn CHF. The
third L3 operator utilizes CLMM with CHF-EUR and CHF-SGD pools, each valued
100/6 mn CHF. The L2-L3-Exchange pool architecture is illustrated in Fig. 7 in
the appendix.

AMMs. To be compatible with L1-Mariana, for all Cryptoswap Invariant we set A
to 50 and gamma to $10^{-8}$. For CLMM, we consider the liquidity range around
the spot price with the alpha of 1.2, rebalanced daily.

Swap fees. Each liquidity pool charges swap fee of 1bp (i.e., 0.0001) of
transaction volume.

Gas costs. Gas fees for swaps on Ethereum, referred to in the Project Mariana,
oscillated between 5 EUR and 50 EUR over the last three years [29]. The gas
costs on L2s are, on average, 50 times lower compared to the underlying L1
[15, 14]. Based on these facts, we consider 15 EUR gas fees for a swap on L1
and 15EUR/50 on the L2-L3 network.

###  6.2 Results

Figure 4: Difference between the total swap costs at L1-Mariana and
L2-L3-Exchange. The negative difference indicate L2-L3-Exchange out-
performance for small and large transaction volumes. Figure 5: Breakdown of
total swap costs for various transaction volumes

Figure 6: Slippage costs for L1 Mariana (100mn TVL) and L3 AMM operators (each
33mn TVL)

The simulation outcomes are depicted in Figs. 4, 5 and 6. Fig. 8 in the
appendix presents the historical total swap costs for transaction volumes of
10k, 100k, and 1mn EUR for CHF for each day over the last 3 years with fixed
gas fees. Fig 4 extends this analysis for various gas fees and presents the
difference between the costs of L2L3 Exchange and L1 Mariana. Notably,
L2-L3-Exchange outperforms for volumes of 10k and 1mn. This out performance
varies, influenced not only by transaction volume but also by current gas
fees, as shown in fig. 4. For gas fees surpassing 800 EUR, L2-L3-Exchange
outperforms for any transaction volume. For lower gas fees, such as 15 EUR,
the out performance range is observed for volumes representing less than 0.01%
or more than 0.7% of the provided liquidity. The reason for L2-L3-Exchange
outperforming for smaller transactions lies in the minimization of gas fees
through the application of L2 and L2s. Fig. 5 breaks down total swap costs,
indicating that gas fees dominate the costs for L1 Mariana in smaller
transactions, compared to the swap fee for L2-L3-Exchange. For larger
transactions, slippage becomes the predominant component of total swap costs.

The out performance of the L2-L3-Exchange over L1-Mariana and its ability to
handle slippage effectively stem from the use of L3 with CLMM, as illustrated
in Figs. 6. The analysis of L3 selection indicates the use of L3 with
Cryptoswap Invariant 2-token pool for smaller transactions, while the 3-token
pool of Cryptoswap Invariant is unused for any transaction volumes. The
simulation showed that the application of more AMMs, despite the liquidity
fragmentation, outperforms the application of just one AMM: 100mn to
L1-Mariana and 33.33mn to each L3. Fig. 9 simulates the swap costs when
various total liquidity is provided.

##  7 Discussion

The primary consideration when establishing cross-border CBDCs exchange is the
choice of blockchain architecture. While private L1s may initially appear to
provide greater operational control, they require significant investments in
physical infrastructure. Public blockchains operate in a decentralized manner,
supported by well-established consensus mechanisms. A novel approach involves
_permissioned L2s_ networks on public blockchains, which combine the
advantages of both private and public networks.

Another system decision is about allowance arbitrage, where the revenue from
arbitrage could be allocated to AMM-DEX operators, L2-L3 operators or central
banks. There is ongoing research about sequencer decentralization at public L2
blockchains and the enablement of MEV and MEV arbitrage. Currently, Ethereum
roll-ups operations are supported only by one sequencer which does not allow
MEV.

To assess the system, additional metrics such as latency and finality can be
considered in conjunction with the domestic CBDC blockchains and the
underlying L1 network. In this context, _latency_ refers to the duration
between submitting a transaction to a network and receiving the initial
confirmation of its commitment. On the other hand, _finality_ refers to the
time required for confirming that a transaction is irrevocable.

Furthermore, the profitability of liquidity provisions and corresponding swap
fee, should be analyzed. The prototype implementation of such systems could be
based on the ready rollup frameworks [30, 31, 32].

##  8 Conclusions

The major finding of this research is that a multi-AMM setup on L2 for a CBDCs
exchange is more cost-efficient than a single L1 AMM, despite the liquidity
fragmentation. This work presented the design of such a multi-AMM system on
private L2. The proposed system offers the advantages of private blockchain
while minimizing infrastructure costs and enhancing security, as it leverages
the consensus mechanism of the underlying L1.

Through a historical simulation based on the FX rates among CHF, EUR, and SGD,
we compared the exchange costs between L2-L3 Exchange and Project Mariana. We
found that the L2-L3 Exchange outperforms across small, low-medium, and large
transactions, even in the presence of liquidity fragmentation between L3s.
During gas fee spikes, the performance gap widens, with lower transaction
costs for all transactions at L2-L3 Exchange. Our analysis of CBDC swap costs
revealed that the gas fees component is significantly lower in the L2-L3
Exchange for medium transactions, enabling their efficient swap.

## Acknowledgements

The first author is a research fellow at Matter Labs. The second author is a
researcher at Matter Labs. This research article is a work of scholarship and
reflects the authors’ own views and opinions. It does not necessarily reflect
the views or opinions of any other person or organization, including the
authors’ employer. Readers should not rely on this article for making
strategic or commercial decisions, and the authors are not responsible for any
losses that may result from such use.

## References

  * [1] Nakamoto, S. “Bitcoin: A Peer-to-Peer Electronic Cash System.” URL www.bitcoin.org.
  * [2] Buterin, V. “Ethereum: A Next-Generation Smart Contract and Decentralized Application Platform.” .
  * [3] Werner, S. M., Perez, D., Gudgeon, L., Klages-Mundt, A., Harz, D., Knottenbelt, W. J. “SoK: Decentralized Finance (DeFi).” (2022) 2101.08778.
  * [4] Schär, F. “Decentralized Finance: On Blockchain- and Smart Contract-based Financial Markets.” (2020) URL https://ssrn.com/abstract=3571335orhttp://dx.doi.org/10.2139/ssrn.3571335.
  * [5] Auer, R., Haslhofer, B., Kitzler, S., Saggese, P., Victor, F. “The Technology of Decentralized Finance (DeFi).” (2023).
  * [6] Gogol, K., Killer, C., Schlosser, M., Boeck, T., Stiller, B. “SoK: Decentralized Finance (DeFi) - Fundamentals, Taxonomy and Risks.” IEEE Computer Society (2023) .
  * [7] Ward, O., Rochemont, S. “Understanding central bank digital currencies (CBDC).” _Institute and Faculty of Actuaries_ 1–52.
  * [8] “Cross-border exchange of wholesale CBDCs using automated market-makers.” (2023).
  * [9] Náñez Alonso, S. L., Jorge-Vazquez, J., Reier Forradellas, R. F. “Central Banks Digital Currency: Detection of Optimal Countries for the Implementation of a CBDC and the Implication for Payment Industry Open Innovation.” _Journal of Open Innovation: Technology, Market, and Complexity_ 7.1 10.3390/joitmc7010072 URL https://www.mdpi.com/2199-8531/7/1/72.
  * [10] Chu, Y., Lee, J., Kim, S., Kim, H., Yoon, Y., Chung, H. “Review of Offline Payment Function of CBDC Considering Security Requirements.” _Applied Sciences_ 12.9 10.3390/app12094488 URL https://www.mdpi.com/2076-3417/12/9/4488.
  * [11] Chaum, D., Grothoff, C., Moser, T. “How to Issue a Central Bank Digital Currency.” (2021) 2103.00254.
  * [12] “Drex – Digital Brazilian Real.” (2023) URL https://www.bcb.gov.br/en/financialstability/drex_en.
  * [13] Sguanci, C., Spatafora, R., Vergani, A. M. “Layer 2 blockchain scaling: A survey.” _arXiv preprint arXiv:2107.10881_ .
  * [14] Yee, B., Song, D., McCorry, P., Buckland, C. “Shades of Finality and Layer 2 Scaling.” (2022) 2201.07920.
  * [15] Gangwal, A., Gangavalli, H. R., Thirupathi, A. “A Survey of Layer-Two Blockchain Protocols.” (2022) 2204.08032.
  * [16] “DeFi Llama.” (2022) URL https://defillama.com/.
  * [17] Morales-Resendiz, R., _et al._ “Implementing a retail CBDC: Lessons learned and key insights.” _Latin American Journal of Central Banking_ 2.1 100022 (2021) https://doi.org/10.1016/j.latcb.2021.100022 URL https://www.sciencedirect.com/science/article/pii/S2666143821000028.
  * [18] Lipton, A., Sepp, A. “Automated Market-Making for Fiat Currencies.” (2021) 2109.12196.
  * [19] Gogol, K. “Github Repository, CBDCs in AMMs.” (2023) URL https://github.com/kgogol/CBDCinAMMs.
  * [20] Rajput, V. U. “Research on know your customer (KYC).” _International Journal of Scientific and Research Publications_ 3.7 541–546 (2013).
  * [21] Fiege, U., Fiat, A., Shamir, A. “Zero knowledge proofs of identity.” In _Proceedings of the nineteenth annual ACM symposium on Theory of computing_ 210–217 (1987) .
  * [22] Buterin, V., Illum, J., Nadler, M., Schär, F., Soleimani, A. “Blockchain privacy and regulatory compliance: Towards a practical equilibrium.” _Available at SSRN_ .
  * [23] Xu, J., Paruch, K., Cousaert, S., Feng, Y. “SoK: Decentralized Exchanges (DEX) with Automated Market Maker (AMM) Protocols.” _ACM Computing Surveys_ 55.11 1–50 (2023) 10.1145/3570639 URL https://doi.org/10.1145%2F3570639.
  * [24] Gudgeon, L., Werner, S. M., Perez, D., Knottenbelt, W. J. “DeFi Protocols for Loanable Funds: Interest Rates, Liquidity and Market Efficiency.” (2020) 2006.13922.
  * [25] Egorov, M. “Curve Whitepaper: Automatic market-making with dynamic peg.” .
  * [26] Adams, H., Zinsmeister, N., Salem moody, M., River Keefer, u., Robinson, D. “Uniswap v3 Core.” .
  * [27] Xu, J., Paruch, K., Cousaert, S., Feng, Y. “SoK: Decentralized Exchanges (DEX) with Automated Market Maker (AMM) Protocols.” URL http://arxiv.org/abs/2103.12732.
  * [28] Tiruviluamala, N., Port, A., Lewis, E. “A General Framework for Impermanent Loss in Automated Market Makers.” (2022) 2203.11352.
  * [29] “Etherscan.” (2023) URL https://etherscan.io/.
  * [30] “zkSync.” (2022) URL https://zksync.io/.
  * [31] “starknet.” (2022) URL https://starkware.co/starknet/.
  * [32] “Polygon.” (2023) URL https://polygon.technology/.

## Graphs and Tables

Figure 7: Architecture of Cross-Border CBDC Exchange using L3 and L2s on the
Public Layer-1 Blockchain Network for EUR, CHF and SGD CBDCs. The selected
exchanges are Cryptoswap Invariant with one pool of three CBDCs, Cryptoswap
Invariant with two pools of two CBDCs and Concentrated Liquidity Market Maker
with two pools of two CBDCs

Figure 8: Back-testing results for transaction volumes of 10k, 100k and 1mn, assuming 15 EUR gas fees and 100mn TVL provided to each system (based on the historical FX rates) Figure 9: The contour lines of the percentage difference (of total transaction cost) between L1-Mariana and an L2-L3 exchange for different size of market. The Total Value Locked is indicated in each panel. fig. 4, refers to the left most panel, in the middle row. Table 1: Breakdown of the average fees for the small (10k EUR), medium (100k EUR) and large (1mn EUR) transactions. The buy EUR-CHF transactions are considered at L1 Mariana and L2-L3 Exchange. All fees are denominated in EUR. The simulation is based on the daily historical FX rate for the last three years. | Total Fee | Gas Fee | Swap Fee | Slippage
---|---|---|---|---
Size |  |  |  |
L1 Mariana: |  |  |  |
Small | 16.0 (16bps) | 15.0 (15bps) | 1.0 (1bps) | 0.01 (0bps)
Medium | 26.1 (3bps) | 15.0 (2bps) | 10.0 (1bps) | 1.08 (0bps)
Large | 10,386.4 (104bps) | 15.0 (0bps) | 100.0 (1bps) | 10,271.42 (103bps)
L2 Exchange: |  |  |  |
Small | 1.3 (1bps) | 0.3 (0bps) | 1.0 (1bps) | 0.02 (0bps)
Medium | 25.6 (3bps) | 0.3 (0bps) | 10.0 (1bps) | 15.33 (2bps)
Large | 5,445.3 (54bps) | 0.3 (0bps) | 100.0 (1bps) | 5,345.04 (52bps)