# Transformer-based Graph Neural Networks for Battery Range Prediction in AIoT
Battery-Swap Services ††thanks: 5Equal contribution. ††thanks: 1Corresponding
author.

Zhao Li865, Yang Liu25, Chuan Zhou291, Xuanwu Liu6 Xuming Pan6 Buqing Cao31
and Xindong Wu4  8Zhejiang Lab, Hangzhou, China  6Hangzhou Yugu Technology
Co., Ltd, Hangzhou, China  2Academy of Mathematics and Systems Science,
Chinese Academy of Sciences, Beijing, China  9School of Cyber Security,
University of Chinese Academy of Sciences, Beijing, China  3Hunan University
of Science and Technology, Xiangtan, China  4Hefei University of Technology,
Hefei, China
Email<EMAIL_ADDRESS>{liuyang2020<EMAIL_ADDRESS>{liuxuanwu,
<EMAIL_ADDRESS>
<EMAIL_ADDRESS><EMAIL_ADDRESS>
###### Abstract

The concept of the sharing economy has gained broad recognition, and within
this context, Sharing E-Bike Battery (SEB) have emerged as a focal point of
societal interest. Despite the popularity, a notable discrepancy remains
between user expectations regarding the remaining battery range of SEBs and
the reality, leading to a pronounced inclination among users to find an
available SEB during emergency situations. In response to this challenge, the
integration of Artificial Intelligence of Things (AIoT) and battery-swap
services has surfaced as a viable solution. In this paper, we propose a novel
structural Transformer-based model, referred to as the SEB-Transformer,
designed specifically for predicting the battery range of SEBs. The scenario
is conceptualized as a dynamic heterogeneous graph that encapsulates the
interactions between users and bicycles, providing a comprehensive framework
for analysis. Furthermore, we incorporate the graph structure into the SEB-
Transformer to facilitate the estimation of the remaining e-bike battery
range, in conjunction with mean structural similarity, enhancing the
prediction accuracy. By employing the predictions made by our model, we are
able to dynamically adjust the optimal cycling routes for users in real-time,
while also considering the strategic locations of charging stations, thereby
optimizing the user experience. Empirically our results on real-world datasets
demonstrate the superiority of our model against nine competitive baselines.
These innovations, powered by AIoT, not only bridge the gap between user
expectations and the physical limitations of battery range but also
significantly improve the operational efficiency and sustainability of SEB
services. Through these advancements, the shared electric bicycle ecosystem is
evolving, making strides towards a more reliable, user-friendly, and
sustainable mode of transportation.

###### Index Terms:

Transformer, Graph Neural Networks, AIoT Battery-Swap Service

##  I Introduction

The emergence of the sharing economy has become ubiquitous across diverse
facets of modern society [1, 2, 3], spotlighting Sharing E-Bike Battery (SEB)
[4] as a focal point of attention. Furthermore, the sharing battery assumes a
central role in numerous intelligent systems, particularly in the context of
AIoT with battery-swap services. As an illustration, in e-bike battery-swap
services , range prediction functions as the primary propulsion source,
delivering the necessary driving force for the entire vehicle’s operation. The
performance of SEB plays a pivotal role in determining critical factors,
including driving range [5], fuel efficiency [6], and safety standards [7]
within the realm of electric vehicles. Additionally, a noticeable disparity
persists between user expectations and the actual remaining range of SEBs.
This discrepancy is particularly evident when users urgently require access to
available SEBs, a situation that carries significant implications for
alleviating range-related concerns during their journeys. The provision of
accurate range prediction and strategically optimal placement of exchange
stations can greatly aid users in their route planning endeavors [8, 9, 10],
thereby enhancing operational efficiency and promoting energy conservation
initiatives.

Figure 1: AIoT Battery-Swap Services. The workflow involves riders interacting
with AIoT systems through an app, accessing battery-swap services designed for
efficiency and convenience. AIoT system integration includes three key
aspects: signal and sensor interfacing for real-time data stream, cloud center
and transformer-based model for advanced processing and analytics, and
finally, services seamlessly connecting with the app to deliver user-centric
solutions.

Range anxiety of riders need to swap batteries primarily due to insufficient
battery range, as e-bikes can only travel a limited distance on a single
charge. This necessitates swapping when the battery depletes. Additionally,
long charging times contribute to the need for swapping, as waiting for a
battery to recharge is often impractical, especially for riders using e-bikes
for delivery services or commuting. Battery degradation over time also means
batteries hold less charge, requiring more frequent swaps. Operational
efficiency, particularly for commercial use, favors swapping over recharging
to ensure continuous operation. Convenience plays a significant role, as
swapping stations offer a quick solution compared to the lengthy recharging
process. In areas with inadequate charging infrastructure, swapping becomes a
practical necessity. Lastly, range anxiety—the fear of running out of power
without access to charging—prompts riders to prefer battery swapping to ensure
their e-bikes are always ready for use. This study focuses primarily on this
aspect, with a specific emphasis on the refinement and enhancement of range
prediction accuracy.

AIoT Battery-Swap Services denote a sophisticated system integrating
Artificial Intelligence of Things (AIoT) technology with battery-swapping
facilities tailored for e-bike, marking the advent of a revolutionary phase in
energy management and mobility solutions (see Fig.1). The primary objective of
this service is to augment the efficiency and convenience of electric e-bike
usage. This is achieved through the utilization of smart sensors, connectivity
solutions, and advanced AI algorithms, all geared towards optimizing battery
management and exchange processes. These processes encompass battery usage
monitoring, demand pattern prediction, and the streamlining of the swapping
procedure. A key focal point of AIoT battery-swapping services lies in the
enhancement of battery range and longevity. Through the utilization of real-
time data analytics and predictive algorithms, AIoT systems possess the
capability to accurately evaluate battery health, forecast remaining range,
and suggest optimal intervals for battery swapping. Such a proactive approach
plays a pivotal role in mitigating range anxiety among e-bike riders,
guaranteeing timely access to fully charged batteries whenever required.
Consequently, this fosters the widespread adoption of batteries, thus
contributing to the acceleration of sustainable transportation solutions.
Through the integration of AIoT Battery-Swap Services outlined in our paper,
we overcome the constraints associated with traditional charging
infrastructure. This results in an array of benefits, including heightened
convenience [11], scalability [11], and sustainability, laying the groundwork
for a more sustainable and efficient transportation network [12]. This
innovative technology not only expedites the adoption of batteries but also
lays the groundwork for a smarter, interconnected ecosystem poised to
revolutionize the future of transportation and energy consumption, ushering in
an era of sustainable and efficient mobility solutions.

Considering the complex characteristics inherent in this dynamic prediction
task, our research focus is increasingly oriented towards the utilization of
Transformers, which are currently recognized extensively in the academic
community. The Transformer architecture, a groundbreaking development in
neural network design, has significantly transformed the fields of natural
language processing and sequential learning. Its innovative attention
mechanism has established new benchmarks for state-of-the-art performance
across a multitude of domains. Interest in investigating data-driven
approaches is growing rapidly [13, 14, 15, 16, 17], particularly those
leveraging Transformer-based models, for the prediction of battery range.
However, the exclusive reliance on Transformers or alternative models to
address the complexities of dynamic graph sequence tasks is inadequate. This
approach fails to account for structural information and the critical
interactions between the graph elements and sequences. Transforming non-
Euclidean interactive networks [18] into Euclidean space represents a
significant challenge for traditional machine learning methodologies. Through
the adoption of a graph structure, Transformers are adept at capturing the
intricate relationships and interactions that exist between batteries and
users efficiently. Summarily, our research endeavors to address the following
pivotal question: _“How can an advanced neural network architecture be
developed to more effectively incorporate structural information for the
prediction of battery range, through the innovative application of
Transformers?"_

In this study, we delve deeply into the pivotal issue of predicting the
remaining range in Sharing E-Bike Battery (SEB), with a specific focus on
applications within the Artificial Intelligence of Things (AIoT) domain. This
concern is of utmost importance for end-users, influencing both usability and
service satisfaction. We propose a novel, task-oriented model termed as SEB-
Transformer, which employs a structural Transformer-based methodology
specifically devised for the accurate prediction of battery range in SEBs. We
envision the scenario as a dynamic, heterogeneous graph, meticulously crafted
to encapsulate the intricate interplay and connections between users and
bicycles. Additionally, we seamlessly integrate this graph structure into the
SEB-Transformer framework. This integration facilitates the concurrent
estimation of not only the remaining range of e-bike battery but also the
average structural similarity across the system, providing a holistic view of
the network’s dynamics. By leveraging the insights obtained from our model, we
dynamically optimize cycling routes for users in real time. This optimization
process considers the spatial distribution of charging stations, thereby
enhancing user experience by ensuring efficient energy use and reducing the
likelihood of battery depletion during trips.

Our contributions are summarized as follows:

  * •

AIoT Battery-Swap Services. We delineate the scenario of Sharing E-Bike
Battery (SEB) as a dynamic heterogeneous graph, a conceptual framework that
allows for the representation of complex relationships and attributes.
Furthermore, we elucidate the introduction of structural information into this
framework, thereby leveraging GNN’s powerful capability to process and analyze
graph-structured data.

  * •

Transformer-based Structual GNNs. We propose the SEB-Transformer model, a
novel structural Transformer-based framework designed specifically for the
prediction of sharing e-bike battery range. This model leverages the advanced
capabilities of Transformer architectures to analyze and predict battery usage
patterns, incorporating a structural perspective that enhances its predictive
accuracy and reliability for applications in e-bike.

  * •

Real-world Evaluation. In our empirical analysis, the SEB-Transformer model
was evaluated using a dataset derived from real-world scenarios, alongside a
comparison against nine other competitive baseline models. The results of this
evaluation unequivocally illustrate the enhanced performance of our model.
Notably, it outperforms the traditional vanilla Transformer model by a
significant margin, achieving an improvement of over 36.7%. This notable
enhancement underscores the effectiveness of the SEB-Transformer in addressing
the complexities of range prediction in sharing e-bike battery.

Outline. Section II provides an overview of related works, encompassing GNNs,
Transformer, and their applications in prediction tasks. Section III offers an
introduction to the fundamentals of Transformers and GNNs. Subsequently, we
present our proposed framework and discuss the scenario involving shared
e-bike battery. Section VI delves into various applications linked with web
services. Finally, Section V presents a comprehensive experimental study
conducted on a real-world dataset.

##  II Related Works

This section provides an overview of related works, including models utilized
in SEB-Transformer, such as GNNs and Transformer. Additionally, we will
discuss the connection to our work.

#### GNNs and Transformer

The fusion of graph neural networks (GNNs) [19] and Transformers marks a
pivotal development in machine learning, with GNNs excelling in graph data
analysis and Transformers advancing sequence tasks. Prior to Transformers [20,
21, 22, 23], RNNs, including LSTMs [24] and GRUs [21], dominated sequence
processing but fell short in distributed computing. The advent of the
attention mechanism, epitomized by Google’s BERT [25], revolutionized NLP by
enhancing focus on relevant data segments during processing. This synergy
between GNNs for local structure and Transformers for global dependencies is
now under active investigation, aiming to unify their strengths for improved
performance across tasks.

#### Transformer for prediction task

Deep neural networks have increasingly become the foundational framework for
prediction tasks [26], paralleled by the substantial development of the
Transformer model. Transformer model is optimally utilized in scenarios where
it can simultaneously generate predictions for interrelated tasks. Research
into employing Transformers for prediction tasks has become a critical focus
within the machine learning domain. Originally designed for natural language
processing tasks [20, 21], Transformers have showcased exceptional ability in
identifying complex sequential patterns and managing long-range dependencies.
Expanding the use of Transformers [26, 27, 28] beyond traditional sequence-
based applications to include a variety of domains like time-series
forecasting, image classification, and financial prediction has broadened
their applicability. This study delves into the use of Transformers in
predictive modeling, highlighting their strengths in deciphering complex data
relationships.

#### Transformer for combinatorial task

Beyond the widespread adoption of the simulated annealing technique for a
range of combinatorial optimization challenges [29, 30, 31], recent scholarly
efforts have explored the integration of RNNs in this sphere. Although RNNs
have not uniformly achieved error rates as minimal as those attained through
annealing methods, the findings have been promising, showcasing significant
improvements in solution speed. This suggests a strategic equilibrium between
precision and high efficiency, a compromise that might be particularly
appealing to stakeholders like Google Maps users and crew schedulers seeking
to refine their scheduling processes. The exploration of Transformer models
for combinatorial tasks has become a focal point in contemporary machine
learning research. Initially conceived for natural language processing tasks,
Transformers have demonstrated exceptional proficiency in identifying complex
dependencies and patterns, prompting their adoption in a variety of fields,
such as combinatorial optimization challenges. Combinatorial tasks
fundamentally involve choosing the best solutions from a set of discrete
options, making them prevalent in areas like logistics [32], operations
research [33], and network design [34].

##  III Preliminaries

Notation. We denote a graph as $\mathcal{G}$ and its edges and nodes as
$\mathcal{E}$ and $\mathcal{V}$ respectively. We represent an ordinary graph
as a set of edges $\mathcal{E}=\\{(v_{i},v_{j})\mid
v_{i},v_{j}\in\mathcal{V}\\}$, where $n$ is the number of observed edges. For
each node $v$ and edge $e$, we use their bold version $\mathbf{v}$ and
$\mathbf{e}$ to denote their embeddings. We use bold capital letters. e.g.,
$\mathbf{A},\mathbf{B},\mathbf{W}$ to denote matrices and use $\|\cdot\|$ to
denote the Euclidean norm of vectors or the Frobenius norm of matrices. Due to
space limitations, we summarize this paper’s main symbols and notations in
Table I.

TABLE I: Notation table. Name |  Description
---|---
$t$ |  time step
$HG^{(t)}=(V^{(t)},E^{(t)})$ |  heterogeneous graph at time $t$
$V^{(t)}=\\{v_{i}^{(t)}\\}_{i=1}^{N}$ |  set of nodes at time $t$
$E^{(t)}=\\{e_{i}^{(t)}=(v_{i,1}^{(t)},v_{i,2}^{(t)})\\}_{i=1}^{M}$ |  set of edges at time $t$
$\mathcal{T}=\\{t_{i}\\}_{i=1}^{T}$ |  set of node’s type
$\mathcal{R}=\\{r_{i}\\}_{i=1}^{R}$ |  set of edge’s type
$\mathbf{W},\mathbf{B}$ |  parameters in GNNs
$\mathbf{Q},\mathbf{K},\mathbf{V}$ |  query/key/value matrix in attention mechanism

###  III-A Scenario of SEBs

The scenario involving Sharing E-Bike Battery (SEB) with shared battery
presents a complex landscape, requiring a detailed representation of the
dynamic interactions between riders and e-bike batteries within the framework
of a temporal graph. When users replace batteries, it becomes feasible for the
same battery to appear at multiple exchange stations, thus enabling its reuse
by a succession of different users across the system. In order to accurately
capture the system’s diverse characteristics, we utilize the notation
$HG={V,E}$, representing the heterogeneous graph input that encompasses the
intricate relationships within the SEB ecosystem. Within this framework, the
set of nodes is comprehensive, including both user nodes and battery nodes,
which are defined as $V=V_{U}\cup V_{B}$, illustrating the system’s dual
aspects of interaction and utility. By interlinking users and batteries
through edges, the structure of $HG$ naturally conforms to the characteristics
of a bipartite graph, reflecting the two distinct but interconnected groups
within the system. For clarity and further understanding, we present a
simplified illustration of the SEB system in Fig.2, which visualizes the
conceptual framework discussed.

###  III-B Graph Neural Networks

Most Graph Neural Networks (GNNs) [19] conform to the messing passing between
neighboring nodes, which can be described as the following iteration
functions:

$m_{v}^{l+1}=f_{\theta}^{l}(h_{v}^{l},\\{h_{u}^{l}|u\in\mathcal{N}_{v}\\})$
(1) $h_{v}^{l+1}=\sigma^{l}(g^{l}(h_{v}^{l},m_{v}^{l+1})),$ (2)

where $f_{\theta}^{l},\sigma^{l},g^{l}$ denote parametric functions, i.e.,
neighborhood aggregation function, activation function (e.g. sigmoid, ReLU),
and combination function (e.g. summation, mean), at the $l$-layer messaging
passing on graphs. $\mathcal{N}_{v}$ denotes the neighborhood for node $v$ and
$h_{v}^{l}$ denotes the hidden embedding for $v$. Such message passing in Eq.1
will repeat $L$ times ($l\in\\{1,2,\ldots,L\\}$) until converge. For the
combinatorial optimization task in this paper, the information will only pass
across the entire graph.

Taking GCN for example, the message-passing function in graph convolutional
network [19] is explicitly written as:

$h_{v}^{l+1}=\sigma\left(\mathbf{W}^{l}\sum_{u\in\mathcal{N}_{v}}\frac{h_{u}^{l}}{|\mathcal{N}_{v}|}+\mathbf{B}^{l}h_{v}^{l}\right),$
(3)

where $\mathbf{W}^{l}$ and $\mathbf{B}^{l}$ are learnable parameters in
$l$-layer.

###  III-C Transformer

Transformer [21, 35] signifies a notable achievement in the realm of natural
language processing (NLP) and machine learning. Departing from traditional
recurrent or convolutional architectures, the Transformer leverages a self-
attention mechanism to capture contextual dependencies across input sequences,
enabling it to excel in tasks such as language translation, summarization, and
question-answering. The model’s innovative architecture eliminates sequential
dependencies, allowing for parallelization during training and significantly
accelerating processing times.

For a given input vector
$\mathbf{X}=[\mathbf{x}_{1},\mathbf{x}_{2},\ldots,\mathbf{x}_{N}]\in\mathbb{R}^{N\times
D}$, where $\mathbf{x}_{i}\in\mathbb{R}^{D}$, transform embeds $\mathbf{X}$
into the output $\mathbf{H}$ in the following two steps:

Step 1: We project $\mathbf{X}$ into three matrices: $\mathbf{Q}$ (query
matrix), $\mathbf{K}$ (key matrix), $\mathbf{V}$ (value matrix) via linear
transformation as follows:

$\mathbf{Q}=\mathbf{X}\mathbf{W}_{Q}^{\mathrm{T}},\mathbf{K}=\mathbf{X}\mathbf{W}_{K}^{\mathrm{T}},\mathbf{V}=\mathbf{X}\mathbf{W}_{V}^{\mathrm{T}}$
(4) $\mathbf{Q}=[\mathbf{q}(1),\mathbf{q}(2),\ldots,\mathbf{q}(N)]$ (5)
$\mathbf{K}=[\mathbf{k}(1),\mathbf{k}(2),\ldots,\mathbf{k}(N)]$ (6)
$\mathbf{V}=[\mathbf{v}(1),\mathbf{v}(2),\ldots,\mathbf{v}(N)]$ (7)

where $\mathbf{W}_{Q},\mathbf{W}_{K}\in\mathbb{R}^{D_{qk}\times D}$ and
$\mathbf{W}_{V}\in\mathbb{R}^{D}$.

Step 2: The output vector
$\mathbf{H}=[\mathbf{h}(1),\mathbf{h}(2),\ldots,\mathbf{h}(N)]\in\mathbb{R}^{N\times
D_{qk}}$ is then computed as follows:

$\mathbf{H}={Softmax}\left(\frac{\mathbf{Q}\mathbf{K}^{\mathrm{T}}}{\sqrt{D_{qk}}}\right)\mathbf{V}.$
(8)

Our work refers to a Transformer that uses the classical softmax attention.

##  IV Framework

###  IV-A Dynamic SEB scenario

The scenario of sharing e-bike battery is complex and we describe the
interaction between users and batteries as a temporary graph at time $t$. When
users replace the battery, the same battery may appear at different exchange
stations and subsequently be utilized by different users. We use
$HG^{(t)}=\\{V^{(t)},E^{(t)}\\}$ to represent the input heterogeneous graph at
time $t$. The set of nodes includes user nodes and battery nodes as
$V^{(t)}=V^{(t)}_{U}\cup V^{(t)}_{B}$. Thus, graph neural networks (see
Section III-B) can readily embed $HG^{(t)}$. Edges are connected by users and
batteries, and then $HG^{(t)}$ can be described as a bipartite graph.

###  IV-B SEB-Transformer

Here, we introduce the details of SEB-Transformer. Initially, the dataset is
bifurcated into two classifications: the first comprises standard time series
Euclidean data, while the second encompasses non-Euclidean data representing
the temporal dynamic graph (see Section IV-A). Then we use SEB-Transformer to
update the features on edges and nodes. We update the embeddings of edge
features by GNNs as Eq.3. Also, we use a Transformer to update the original
features to predict the range of e-bike battery. The above process can be
formulated as follows:

$\mathbf{X}^{(t)}_{1}={GNN}(V^{(t)}_{U},V^{(t)}_{B},HG^{(t)})$ (9)
$\mathbf{X}^{(t)}_{2}={Transformer}(V^{(t)}_{U},V^{(t)}_{B},{\mathbf{X}}^{(t)}_{0})$
(10)

Then, we can obtain the predicted labels as:

$\widehat{\mathbf{Y}}^{(t)}={MLP}\left(\hat{\mathbf{X}}^{(t)}\right)$ (11)

where
$\hat{\mathbf{X}}^{(t)}={\mathbf{X}}^{(t)}_{0}\bigoplus\hat{\mathbf{X}}^{(t)}_{1}\bigoplus\hat{\mathbf{X}}^{(t)}_{2}$.

###  IV-C S3IM

We give a genetic form for the strong structural similarity index on graph
S3IM: $\mathbb{R}^{n}\times\mathbb{R}^{n}\to\mathbb{R}$ as follows:

$S{}^{3}IM(x,y)=f(r_{1}(x,y),r_{2}(x,y),r_{3}(x,y))$ (12)
$f(r_{1},r_{2},r_{3})=[r_{1}]^{\alpha}\cdot[r_{2}]^{\beta}\cdot[r_{3}]^{\gamma}$
(13)

where $\alpha,\beta,\gamma$ are parameters used to adjust the relative
importance of the three terms.

The S3IM term contains three components which will be presented in the next
subsection with details. As the previous paper [36] says, the similarity
measure should obey the following conditions:

  * •

Symmetric: S3IM$(x,y)$ = S3IM$(y,x)$.

  * •

Boundedness: S3IM$(x,y)\leq M$

  * •

Unique maximization: S3IM$(x,y)=M$ if and only if $x=y$ in element wise
($x_{i}=y_{i},i\in[n]$).

Next, we will introduce the details of each component $r_{1},r_{2},r_{3}$
shown in Eq.12 and we call them (1) luminance term, (2) contrast term, and (3)
structure term, respectively.

(1) luminance term $r_{1}$. As the first term, we can define the luminance as
follows

$r_{1}(x,y)=\frac{2\mu_{x}\mu_{y}+C_{1}}{\mu_{x}^{2}+\mu_{y}^{2}+C_{1}}$ (14)

where $C_{1}>0$ is a constant to avoid the denominator being zero. Usually, we
choose $C_{1}=(K_{1}L)$, $L$ is the length of the output and $K_{1}\ll 1$ is a
pretty small constant.

(2) contrast term $r_{2}$. The second term, we can define the contrast
function as

$r_{2}(x,y)=\frac{2\sigma_{x}\sigma_{y}+C_{2}}{\sigma_{x}^{2}+\sigma_{y}^{2}+C_{2}}$
(15)

where $C_{2}=(K_{2}L)^{2}$ and $K_{2}\ll 1$.

(3) structure term $r_{3}$. The third term, we can refer to the following form

$r_{3}(x,y)=\frac{\sigma_{xy}+C_{3}}{\sigma_{x}\sigma_{y}+C_{3}}$ (16)

where

$\sigma_{xy}=\frac{1}{n-1}\sum_{i=1}^{n}(x_{i}-\mu_{x})(y_{i}-\mu_{y})$ (17)

Figure 2: Illustration of SEB scenario and SEB-Transformer.

Overview. The primary aim of this section is to furnish a comprehensive
overview of the SEB-Transformer, delineating its core principles and
operational framework. Prior to embarking on the prediction of battery range,
we precisely define the dynamic scenario of Sharing E-Bike Battery (SEB) as a
heterogeneous graph, which effectively captures the intricate web of
interactions occurring between users and batteries. Following this, we proceed
to develop a structural Transformer model that meticulously incorporates
topological information, achieving a seamless integration of both graph-based
and sequential data, thereby enriching the model’s predictive capabilities.
Furthermore, to augment the model’s ability to recognize global structural
information, we implement the advanced regularization technique S3IM, which
significantly improves the precision of our predictions. Throughout the
training phase, our objective shifts towards minimizing the discrepancy
between the actual battery range $\mathbf{Y}^{(t)}$ and its predicted
counterpart $\widehat{\mathbf{Y}}^{(t)}$, over the entirety of the temporal
spectrum under consideration. The optimization strategy employed for our model
is delineated as follows, encompassing a detailed methodology aimed at
refining the accuracy of our predictive framework:

$\min\sum_{t=1}^{T}\left(\frac{\|\widehat{\mathbf{Y}}^{(t)}-\mathbf{Y}^{(t)}\|^{2}}{|\mathbf{Y}^{(t)|}}+{S{}^{3}IM}(\widehat{\mathbf{Y}}^{(t)},\mathbf{Y}^{(t)})\right).$
(18)

##  V Experiments

This section provides a detailed exposition of our experiments. Section V-A
presents a real-world dataset collected by our team, accompanied by an in-
depth analysis of its statistical information from various perspectives.
Section V-B outlines several competitive baselines that serve as benchmarks
for comparison, aiming to surpass their performance. Section V-C highlights
the main results assessed by our model.

###  V-A Dataset

For our experimental investigations, we utilize a real-world dataset that has
been meticulously collected by our team. Our dedicated engineering team
meticulously curated a dataset comprising 16,000 order samples, each enriched
with 64 distinct timing data points. Subsequently, we provide an overview of
statistical information pertaining to our dataset. In Fig.3, we provided
visualizations depicting sequence length information. Observation of the
dataset reveals that it approximates a normal distribution, with an average
value of 275, thereby suggesting that the data we gathered is both reasonable
and reflective of societal dynamics.

Figure 3: Statistical visualization. Figure 4: Analysis of the outliers in our
data.

###  V-B Baseline

Within this section, we present an overview of the competitive baseline
methods utilized in our study, namely SVR, LR, XGBoost, MLP, and the vanilla
Transformer model. These methods are implemented for our task.

  * •

Support Vector Regression (SVR) [37, 38] stands out as a robust machine
learning method for regression challenges, especially adept at managing
datasets where the variables exhibit intricate interconnections.

  * •

Linear Regression (LR) [39] is a fundamental statistical method utilized in
machine learning and data analysis for establishing a connection between a
dependent variable and one or more independent variables. LR presupposes a
direct linear connection between the input factors and the outcome, depicted
as a straight line within a multidimensional space. The model calculates the
coefficients for the linear equation that most closely aligns with the
observed data points, by reducing the sum of the squared differences
(residuals).

  * •

eXtreme Gradient Boosting [40] is an effective and robust machine learning
technique renowned for its effectiveness in predictive modeling and
classification tasks. It belongs to the ensemble learning family, specifically
boosting algorithms, which sequentially combine weak learners to create a
robust and accurate model. XGBoost utilizes a gradient boosting framework,
employing decision trees as base learners. It excels in handling structured
data and is known for its speed, scalability, and accuracy. XGBoost
incorporates regularization techniques to prevent overfitting and provides
features for fine-tuning model performance, such as cross-validation and early
stopping.

  * •

Multilayer Perceptron (MLP)[13] represents a basic artificial neural network
structure, featuring several layers of linked neurons, including an input
layer, at least one hidden layer, and an output layer.

  * •

Transformer [21] is a groundbreaking architecture in deep learning that has
notably propelled advancements in natural language processing (NLP) and
related sequence-dependent tasks. Unlike previous recurrent or convolutional
models, the Transformer relies entirely on self-attention mechanisms to
capture dependencies between input and output tokens in parallel.

###  V-C Main Results

The experimental results have been succinctly summarized in Table II. The last
two models represent variants of the SEB-Transformer architecture. An
additional regularization term, denoted as S3IM, has been incorporated into
the SEB-Transformer∗ architecture. The aforementioned models serve as ten
competitive baselines, providing a robust benchmark for evaluation.
Remarkably, our model surpasses these baselines by a substantial margin.
Furthermore, Fig.6 has been included to visually illustrate the effects of
each improvement. This visual representation effectively demonstrates the
impact of individual improvements. Additionally, the Fig.5 showcases the best
MAE achieved by our model. This presentation serves to underscore that our
model consistently outperforms others even in dynamic stream conditions.

Fig.7 presents a visual depiction of the loss curve as observed throughout the
training and validation phases, providing a graphical representation of the
model’s performance over these periods. When compared to the baseline models,
our framework demonstrates a decrease in loss, indicating its superior
performance in reducing the discrepancy between predicted outcomes and actual
values. This improvement underscores the framework’s superior efficacy in
aligning predictions closely with real-world data.

Figure 5: Illustration of MAE for the best performance. Figure 6:
Demonstration of framework improvements.

Figure 7: Training loss among various models: (top line) auto-encoder, lstm, mlp, and (bottom line) Transformer, Transformer plus lstm, SEB-Transformer. TABLE II: MAE on the battery range prediction task Model |  MAE $\downarrow$
---|---
SVR |  4.7564 $\pm$ 2.0711
LR |  4.7645 $\pm$ 1.9910
XGBoost |  5.1529 $\pm$ 4.2586
Auto-Encoder |  5.3849 $\pm$ 4.2582
MLP |  4.3606 $\pm$ 2.0636
LSTM |  3.1380 $\pm$ 1.7353
Transfomer |  2.3772 $\pm$ 1.4306
TEConv+LSTM |  2.2240 $\pm$ 1.5272
TEConv+Transformer |  1.9908 $\pm$ 1.7498
LSTM+Transfomer |  1.8642 $\pm$ 1.3228
SEB-Transformer |  1.5020 $\pm$ 1.2281
SEB-Transformer∗ |  1.4552 $\pm$ 1.0332

##  VI Application with Web Service

Within Sharing E-Bike Battery (SEB), the app and web service are key to user
experience and system efficiency. Future improvements promise to enhance SEB
functionality and accessibility, fostering wider use and greater satisfaction.
By addressing these application perspectives, SEB have the opportunity to
enhance user satisfaction, optimize system efficiency, and contribute to the
widespread adoption of sustainable transportation solutions.

  * •

User Interface Design. Prioritizing user-centric design principles [41] in
mobile applications is essential for offering intuitive interfaces that enable
users to access battery status information, locate nearby SEB stations, and
plan routes based on predicted battery ranges. Adding features like
interactive maps, customizable ride options, and live updates could greatly
improve the user experience and encourage more frequent use of SEB services.
These enhancements can contribute to a more engaging and satisfying experience
for users, thereby promoting greater adoption and usage of SEB services.

  * •

Predictive Range Estimation. The integration of battery range prediction
algorithms [42] directly into the application interface aims to empower users
by providing them with accurate estimations of remaining battery life for
their planned journeys. This integration could involve the display of
estimated range, considering factors such as user weight, terrain, and
historical usage patterns.

  * •

Ride Optimization Features. The implementation of ride optimization features
within the application aims to improve user convenience and system efficiency.
These features may encompass smart routing algorithms capable of suggesting
optimal paths based on available battery range and user preferences.
Additionally, real-time alerts and notifications will be integrated to remind
users to recharge or swap batteries as needed, further enhancing the overall
user experience and system efficiency.

  * •

Data Visualization and Analytics. Utilizing data visualization techniques [43]
within the application interface to present battery usage statistics, ride
history, and system performance metrics in a clear and comprehensible manner
is essential. By providing users with insights into their usage patterns,
environmental impact, and potential cost savings, we can foster greater
awareness and engagement with SEB services.

  * •

Integration with Urban Mobility Ecosystem. Facilitating seamless integration
with existing urban mobility ecosystems involves ensuring interoperability
with public transit systems, ride-sharing platforms, and navigation services.
This may entail the provision of multi-modal trip planning capabilities,
integration of payment systems for seamless fare integration, and enabling
cross-platform connectivity to enhance overall transportation accessibility
and convenience.

##  VII Discussion and Conclusion

Why We Need Sharing E-Bike Battery. (1) Bridging Expectation Gaps: A notable
discrepancy exists between user expectations and the actual remaining battery
range of SEBs, especially in urgent needs for accessible SEBs. (2) Operational
Efficiency and Energy Conservation: Accurate battery range prediction and
strategic placement of exchange stations can significantly enhance route
planning, operational efficiency, and energy conservation. (3) Promoting
Sustainable Transportation: By overcoming limitations associated with
traditional charging infrastructure, sharing e-bike batteries can lead to a
more efficient and environmentally friendly transportation ecosystem.

Conclusion. In this paper, we have conceptualized the scenario involving
Sharing E-Bike Battery (SEB) as a dynamic heterogeneous graph. Concurrently,
we introduce the innovative SEB-Transformer, which is specifically designed
for the purpose of battery range prediction. Furthermore, it is noteworthy
that our model significantly outperforms the conventional Transformer models,
indicating a substantial improvement in predictive performance. The
contributions of our work represent a notable advancement within the domain of
web services, characterized by a dual achievement: the reduction of carbon
emissions and the enhancement of user satisfaction, thereby marking a pivotal
step forward in sustainable urban mobility. We propose a novel, task-oriented
model termed as SEB-Transformer, which employs a structural Transformer-based
methodology specifically devised for the accurate prediction of battery range
in SEBs. Utilizing the prediction, we can dynamically modify optimal cycling
routes for users in real-time, taking into account the locations of charging
stations. Experimental results shows that our model outperforms nine other
competitive baseline models on real-world datasets, with a significant
reduction in the MAE (Mean Absolute Error) metric compared to the basic
Transformer model.

## Acknowledgment

This work was partially supported by the National Key R&D Program of China
(2023YFB4502400), the Strategic Priority Research Program of the Chinese
Academy of Sciences (XDB0680101), the NSFC (62376064, U2336202), and the CAS
Project for Young Scientists in Basic Research (YSBR-008).

## References

  * [1] M. Cheng, “Sharing economy: A review and agenda for future research,” _International Journal of Hospitality Management_ , vol. 57, pp. 60–70, 2016.
  * [2] M. Hossain, “Sharing economy: A comprehensive literature review,” _International Journal of Hospitality Management_ , vol. 87, p. 102470, 2020.
  * [3] Z. Li, G. Ren, Y. Gu, S. Zhou, X. Liu, J. Huang, and M. Li, “Real-time e-bike route planning with battery range prediction,” in _Proceedings of the 17th ACM International Conference on Web Search and Data Mining_ , 2024, pp. 1070–1073.
  * [4] J. Li, J. Shen, and B. Jia, “Exploring intention to use shared electric bicycles by the extended theory of planned behavior,” _Sustainability_ , vol. 13, no. 8, p. 4137, 2021.
  * [5] Z. Lu, Q. Zhang, Y. Yuan, and W. Tong, “Optimal driving range for battery electric vehicles based on modeling users’ driving and charging behavior,” _Journal of Advanced Transportation_ , vol. 2020, pp. 1–10, 2020.
  * [6] V. Kiray, M. Orhan, and J. N. Chijioke, “Significant increase in fuel efficiency of diesel generators with lithium-ion batteries documented by economic analysis,” _Energies_ , vol. 14, no. 21, p. 6904, 2021.
  * [7] Q. Yu, Y. Nie, S. Peng, Y. Miao, C. Zhai, R. Zhang, J. Han, S. Zhao, and M. Pecht, “Evaluation of the safety standards system of power batteries for electric vehicles in china,” _Applied Energy_ , vol. 349, p. 121674, 2023.
  * [8] H. Bast, D. Delling, A. Goldberg, M. Müller-Hannemann, T. Pajor, P. Sanders, D. Wagner, and R. F. Werneck, “Route planning in transportation networks,” _Algorithm engineering: Selected results and surveys_ , pp. 19–80, 2016.
  * [9] D. S. Alberts and R. E. Hayes, _Planning: complex endeavors_. CCRP publications Washington, DC, 2007.
  * [10] R. krishna Vaddy, “Ai and ml for transportation route optimization,” _International Transactions in Machine Learning_ , vol. 5, no. 5, pp. 1–19, 2023.
  * [11] Z. Chang, S. Liu, X. Xiong, Z. Cai, and G. Tu, “A survey of recent advances in edge-computing-powered artificial intelligence of things,” _IEEE Internet of Things Journal_ , vol. 8, no. 18, pp. 13 849–13 875, 2021.
  * [12] F. A. Alaba, A. Oluwadare, U. Sani, A. A. Oriyomi, A. O. Lucy, and O. Najeem, “Enabling sustainable transportation through iot and aiot innovations,” in _Artificial Intelligence of Things for Achieving Sustainable Development Goals_. Springer, 2024, pp. 273–291.
  * [13] S. A. Hasib, D. K. Saha, S. Islam, M. Tanvir, and M. S. Alam, “Driving range prediction of electric vehicles: A machine learning approach,” in _2021 5th International Conference on Electrical Engineering and Information Communication Technology (ICEEICT)_. IEEE, 2021, pp. 1–6.
  * [14] J. Gallardo-Lozano, E. Romero-Cadaval, M. I. Milanes-Montero, and M. A. Guerrero-Martinez, “Battery equalization active methods,” _Journal of Power Sources_ , vol. 246, pp. 934–949, 2014.
  * [15] C. Hu, B. D. Youn, and J. Chung, “A multiscale framework with extended kalman filter for lithium-ion battery soc and capacity estimation,” _Applied Energy_ , vol. 92, pp. 694–704, 2012.
  * [16] J. Li, K. Adewuyi, N. Lotfi, R. G. Landers, and J. Park, “A single particle model with chemical/mechanical degradation physics for lithium ion battery state of health (soh) estimation,” _Applied energy_ , vol. 212, pp. 1178–1190, 2018.
  * [17] Y. Li, K. Liu, A. M. Foley, A. Zülke, M. Berecibar, E. Nanini-Maury, J. Van Mierlo, and H. E. Hoster, “Data-driven health estimation and lifetime prediction of lithium-ion batteries: A review,” _Renewable and sustainable energy reviews_ , vol. 113, p. 109254, 2019.
  * [18] N. A. Asif, Y. Sarker, R. K. Chakrabortty, M. J. Ryan, M. H. Ahamed, D. K. Saha, F. R. Badal, S. K. Das, M. F. Ali, S. I. Moyeen _et al._ , “Graph neural network: A comprehensive review on non-euclidean space,” _IEEE Access_ , vol. 9, pp. 60 588–60 606, 2021.
  * [19] T. N. Kipf and M. Welling, “Semi-supervised classification with graph convolutional networks,” in _International Conference on Learning Representations (ICLR)_ , 2017.
  * [20] E. Min, R. Chen, Y. Bian, T. Xu, K. Zhao, W. Huang, P. Zhao, J. Huang, S. Ananiadou, and Y. Rong, “Transformer for graphs: An overview from architecture perspective,” _arXiv preprint arXiv:2202.08455_ , 2022.
  * [21] A. Vaswani, N. Shazeer, N. Parmar, J. Uszkoreit, L. Jones, A. N. Gomez, Ł. Kaiser, and I. Polosukhin, “Attention is all you need,” _Advances in neural information processing systems_ , vol. 30, 2017.
  * [22] V. P. Dwivedi and X. Bresson, “A generalization of transformer networks to graphs,” _arXiv preprint arXiv:2012.09699_ , 2020.
  * [23] C. Ying, T. Cai, S. Luo, S. Zheng, G. Ke, D. He, Y. Shen, and T.-Y. Liu, “Do transformers really perform badly for graph representation?” _Advances in Neural Information Processing Systems_ , vol. 34, pp. 28 877–28 888, 2021.
  * [24] A. Sherstinsky, “Fundamentals of recurrent neural network (rnn) and long short-term memory (lstm) network,” _Physica D: Nonlinear Phenomena_ , vol. 404, p. 132306, 2020.
  * [25] J. Devlin, M.-W. Chang, K. Lee, and K. Toutanova, “Bert: Pre-training of deep bidirectional transformers for language understanding,” _arXiv preprint arXiv:1810.04805_ , 2018.
  * [26] Y. Xu, X. Li, H. Yuan, Y. Yang, and L. Zhang, “Multi-task learning with multi-query transformer for dense prediction,” _IEEE Transactions on Circuits and Systems for Video Technology_ , 2023.
  * [27] A. Nambiar, M. Heflin, S. Liu, S. Maslov, M. Hopkins, and A. Ritz, “Transforming the language of life: transformer neural networks for protein prediction tasks,” in _Proceedings of the 11th ACM international conference on bioinformatics, computational biology and health informatics_ , 2020, pp. 1–8.
  * [28] L. Yang, T. L. J. Ng, B. Smyth, and R. Dong, “Html: Hierarchical transformer-based multi-task learning for volatility prediction,” in _Proceedings of The Web Conference 2020_ , 2020, pp. 441–451.
  * [29] Q. Wang, K. H. Lai, and C. Tang, “Solving combinatorial optimization problems over graphs with bert-based deep reinforcement learning,” _Information Sciences_ , vol. 619, pp. 930–946, 2023.
  * [30] B. Yildiz, “Reinforcement learning using fully connected, attention, and transformer models in knapsack problem solving,” _Concurrency and Computation: Practice and Experience_ , vol. 34, no. 9, p. e6509, 2022.
  * [31] T. Wang, A. H. Payberah, and V. Vlassov, “Graph representation learning with graph transformers in neural combinatorial optimization,” in _2023 International Conference on Machine Learning and Applications (ICMLA)_. IEEE, 2023, pp. 488–495.
  * [32] Y. Ren, X. Lu, H. Guo, Z. Xie, H. Zhang, and C. Zhang, “A review of combinatorial optimization problems in reverse logistics and remanufacturing for end-of-life products,” _Mathematics_ , vol. 11, no. 2, p. 298, 2023.
  * [33] N. Mazyavkina, S. Sviridov, S. Ivanov, and E. Burnaev, “Reinforcement learning for combinatorial optimization: A survey,” _Computers & Operations Research_, vol. 134, p. 105400, 2021.
  * [34] M. Chen, S. C. Liew, Z. Shao, and C. Kai, “Markov approximation for combinatorial network optimization,” _IEEE transactions on information theory_ , vol. 59, no. 10, pp. 6301–6327, 2013.
  * [35] T. Nguyen, T. M. Nguyen, and R. G. Baraniuk, “Mitigating over-smoothing in transformers via regularized nonlocal functionals,” in _Thirty-seventh Conference on Neural Information Processing Systems_ , 2023.
  * [36] Z. Wang, A. C. Bovik, H. R. Sheikh, and E. P. Simoncelli, “Image quality assessment: from error visibility to structural similarity,” _IEEE transactions on image processing_ , vol. 13, no. 4, pp. 600–612, 2004.
  * [37] J. Cervantes, F. Garcia-Lamont, L. Rodríguez-Mazahua, and A. Lopez, “A comprehensive survey on support vector machine classification: Applications, challenges and trends,” _Neurocomputing_ , vol. 408, pp. 189–215, 2020.
  * [38] Y. Zhang, “Support vector machine classification algorithm and its application,” in _Information Computing and Applications: Third International Conference, ICICA 2012, Chengde, China, September 14-16, 2012. Proceedings, Part II 3_. Springer, 2012, pp. 179–186.
  * [39] M. Ahmed, Z. Mao, Y. Zheng, T. Chen, and Z. Chen, “Electric vehicle range estimation using regression techniques,” _World Electric Vehicle Journal_ , vol. 13, no. 6, p. 105, 2022.
  * [40] T. Chen and C. Guestrin, “Xgboost: A scalable tree boosting system,” in _Proceedings of the 22nd acm sigkdd international conference on knowledge discovery and data mining_ , 2016, pp. 785–794.
  * [41] D. Stone, C. Jarrett, M. Woodroffe, and S. Minocha, _User interface design and evaluation_. Elsevier, 2005.
  * [42] A. Enthaler and F. Gauterin, “Method for reducing uncertainties of predictive range estimation algorithms in electric vehicles,” in _2015 IEEE 82nd vehicular technology conference (VTC2015-Fall)_. IEEE, 2015, pp. 1–5.
  * [43] G. Andrienko, N. Andrienko, S. Drucker, J.-D. Fekete, D. Fisher, S. Idreos, T. Kraska, G. Li, K.-L. Ma, J. Mackinlay _et al._ , “Big data visualization and analytics: Future research challenges and emerging applications,” in _BigVis 2020-3rd International Workshop on Big Data Visual Exploration and Analytics_ , 2020.


shape of the obtained spectrum remains close to a Gaussian. On the other hand,
in Fig. 5e we show total contributions to the antisymmetric ($N_{-}$) and
symmetric ($N_{+}$) ports, as well as the ratio $N_{-}/N_{+}$ along with
fitted model that is used to estimate the $\varepsilon$ without a direct need
to know total source brightness.

## Discussion

We have demonstrated frequency-separation estimation which outperforms direct
spectroscopy. The protocol operates in a previously unexplored regime of very
narrowband light, which merits further discussion and comparison with other
possible schemes. In Fig. 6 we compare several different approaches to measure
frequency difference of two sources. We characterize the gain achieved with
our method via the super-resolution parameter $\mathfrak{s}$ that is
interpreted as a reduction of resources (number of photons) required to
achieve the same resolution as direct imaging spectroscopy with the same
aperture $\sigma$. The $\mathfrak{s}$ for a given measurement scheme
characterized by the Fisher information $\mathcal{F}$ is calculated as

$\mathfrak{s}=\underset{\varepsilon\to
0}{\lim}(\mathcal{F}/\mathcal{F}_{\mathrm{DI}}).$ (7)

While for the perfect case with $\mathcal{F}=\mathcal{F}_{Q}$ the
superresolution enhancement would reach infinity, this is practically never
the case. In particular, it has been recently shown that effects such as
finite visibility, noise, or cross-talk will always restore the
$\varepsilon^{2}$ scaling [45], making the above limit well-defined. For
instance, in the case of SLIVER with finite visibility we will have:

$\mathfrak{s}_{\mathrm{SLIVER}}=\frac{\mathcal{V}^{2}}{2(1-\mathcal{V}^{2})}.$
(8)

Thus, for a high visibility the enhancement may be immense, yet remains well-
defined for small $\varepsilon$. The PuDTAI protocol follows a similar
scaling, with the full formula given by Eq. 24 in the Methods section that
yields $\mathfrak{s}=20\pm 0.5$.

All the conventional methods that include: grating and Fourier transform (FT)
spectrometers along with far-field temporal imaging or inherently lossy
scanning methods that employ cavity or EIT media fall into DI description and
are Fourier-limited ($\mathfrak{s}=1$). Surprisingly, there is only one more
demonstration (Quantum Pulse Gate – QPG [24]) which yielded improvement over
the conventional DI approach. Until now, the QPG approach, that in principle
enables temporal-mode demultiplexing, allowed projecting only a single mode at
a time. In our work we are able to observe two modes (ports) in the same
experiment. An important future challenge in both techniques is to allow truly
multi-mode sorting.

Figure 6: Comparison of super-resolution enhancement factor $\mathfrak{s}$ of
different spectrometers and super-resolution spectroscopy techniques. All
conventional methods (Grating, FTS - Fourier transform spectrometer) and the
temporal-imaging method using our quantum memory (QMTI - quantum-memory
temporal imaging) are analogous to the DI approach and thus fall under the
Fourier limit. Only two (QPG - Quantum Pulse Gate [24] and PuDTAI - this work)
beat the limit of $\mathfrak{s}=1$ and thus achieve super-resolution. The
curves represent exemplary realizations of given spectrometer for constant
time-bandwidth product.

While using DI (a spectrometer) for high bandwidth signals seems an obvious
choice, one may conclude that for narrowband signals a balanced heterodyne (or
homodyne) detection would perform better. The first obvious challenge is that
one then needs a stable and narrowband local oscillator, but as our method
uses a control field, this requirement is effectively shared. However, when
the sources brightness is low (below one photon per mode), the heterodyne
detection scheme suffers strongly from shot noise. For the particular task of
separation estimation, the shot noise will affect the estimation precision and
makes it useless for measuring single-photon-level sources. Nevertheless,
heterodyne (or homodyne) can overcome the Fourier limit for higher signal
photon levels and for small separations as has been recently analyzed in
detail for the spatial domain [46] ($\mathfrak{s}>1$ for average 7.2 photons
per mode and more), with the use of optimized data analysis, as opposed to
simply looking at power spectral densities. Therefore, a purely photon-
counting method is in general needed in the low light-level regime.

It is also worth considering the influence of fluctuations on our method. If
the amplitude or phase of the signal varies over the single shot (temporal
aperture), clearly the two parts of the pulse will not be able to interfere
perfectly. Such a situation represents and unavoidable loss of information,
and may be quantified via the reduced visibility $\mathcal{V}$ of
interference. The result is therefore the same as already considered in the
case of finite visibility caused by the device itself (see Eq. 8 and Methods),
yet the information here is already reduced in the signal itself.

The conjunction of the operation in the optical domain and the kHz-level
resolution has promising application in the schemes that combine microwave or
radio-frequency and optical domains [47]. Our method of spectroscopy can
provide an optimal detection scheme for light that is transduced from the RF
or microwave domain, without the sensitivity loss due to shot noise, which is
inherently present in the traditional heterodyne optical receivers.

We envisage that other platforms may be used to implement the protocol we
proposed, also in different frequency regimes. For example, rare-earth doped
crystals such as Eu:Y2SiO5 offer narrow homogeneous absorption linewidth that
can be dynamically broadened with an electric field [48] for the purpose of
time-frequency domain multimode storage [49]. Processing with AC-Stark shifts
has also been demonstrated [50], and advances in embedding ions in waveguides
promise good efficiency and noise properties.

Another approach has been very recently discussed theoretically by Shah and
Fan [51], who considered a transformation device based on pulse shapers and
electro-optic modulators. This approach may be very applicable where relevant
devices can operate, which is in particular GHz-bandwidth regime in the
telecom band of light. In this regime no quantum memory is required, as the
timescales involved are much shorter. Several other quantum-information
protocols have been realized with similar means, also for quantum light, and
the scheme is generally termed quantum-frequency processor [52]. We expect
that those approaches would perform particularly well in GHz-bandwidth regime
and beyond. On the other hand, to enhance resolution of our scheme to below 1
kHz a quantum memory with much longer lifetime would suffice, which has
already been demonstrated in an optical lattice [53]. This lifetime does not
necessarily change the superresolution enhancement factor itself, which for
the given temporal/spectral aperture only depends on the quality of
interference and noise properties of the device.

Remarkably, the PuDTAI protocol has been realized here in a quantum memory
that is insensitive to the signal spatial distribution., i.e. is spatially-
multimode [54]. This means that it can accept external fluorescence light that
is in principle spatially-multimode. Furthermore, we note that to analyze
fluorescent light from different kinds of samples, one needs to match the
wavelength of operation. This can be done via the maturing techniques of
quantum frequency conversion [55].

The path from resolving two sources to obtaining a more complex spectrum with
super-resolved features is challenging, yet some knowledge can be drawn from
imaging problems considered so far. Various groups have considered the cases
of three sources in two dimensions [56, 57], or two sources with arbitrary
brightness [58], and practical frameworks for multi-pixel images are being
developed as well [59]. For the spectroscopic case discussed here, different
operations in the quantum memory will be needed to prepare measurements
optimal for multi-source scenarios.

## Methods

#### Gradient Echo Memory

The Gradient Echo Memory is based on pencil-shaped ($8\times 0.3\times
0.3\,\mathrm{mm}^{3}$) $\mathrm{{}^{87}Rb}$ atomic cloud prepared in
magnetooptical trap. The full experimental sequence is depicted in Fig. 7a.
After the cloud preparation stage (trapping, compression and cooling) the
atoms are optically pumped to the $|h\rangle=(F=2,m_{F}=-2)$ state. The
control field (795 nm) couples the excited state $|e\rangle=(F=1,m_{F}=-1)$
with the previously emptied storage state $|g\rangle=(F=1,m_{F}=0)$ which
enables coherent absorption of the signal field at the $|h\rangle\to|e\rangle$
transition (see 7b for reference). The magnetic field gradient crucial to the
GEM protocol is generated by two identical coils located antisymmetrically on
the $z$-axis and powered by fast H-topology current switch, that allows
switching between negative and positive gradients within 5 $\mu$s. In the
experiment we set the gradient to $\partial_{z}B_{z}=\pm 7.3\
\mathrm{\mu}\mathrm{{T}}/\mathrm{mm}$ Additionally, to separate the
magnetically broadened absorption spectrum of the
$|h\rangle\to|e\rangle\to|g\rangle$ transition from the unbroadened clock
transition $(F=2,m_{F}=-1)\to(F=1,m_{F}=0)\to(F=1,m_{F}=1)$ we keep the cloud
in bias magnetic field of $B_{z}=120$ $\mu$T magnitude along the $z$-axis.
Moreover, to stabilize the two photon detuning that is sensitive to magnetic
fields we operate the protocol at 50 Hz synced with local mains frequency and
correct for slow magnetic fluctuations (caused, for example, by an elevator
near our laboratory) by adjusting the magnitude of the bias magnetic field in
a feedback scheme described below. The temperature of the cloud is measured to
be about $60\,\mu\mathrm{K}$. Given the configuration of laser beams, i.e.
angle between coupling and signal light, the atomic coherence has a
$50\,\mathrm{rad/mm^{-1}}$ transverse wavevector component. This gives
$\approx 260\,\mu\mathrm{s}$ of thermal-motion-limited storage time [60]. The
control field induced spin-wave decay rate [37] in the experiment is about
$10\,\mathrm{kHz}$.

The signal photons are passed through an optically-pump 87Rb-vapour cell in
order to remove the residual control field. At the end, they are coupled to a
single-mode fiber and detected with an SPCM.

#### Magnetic field synchronization and stabilization

The protocol operates at 50 Hz repetition rate synced with local mains
frequency. The synchronization mechanism is realized by the FPGA (NI 7852R)
system controlling the whole sequence. The synchronization (waiting for mains
trigger) happens during the trapping period of each experimental repetition
effectively providing no-idle-time operation. The slow (below 50 Hz) magnetic
field fluctuations are compensated by feedback mechanism that is enabled at
the end of each sequence repetition. This is achieved by repumping the atoms
to the $m_{F}=-2$ sublevel, switching off the GEM gradient and probing the
atomic spin precession with linearly polarized probe beam at ($F=2)\to(F=1)$
transition illuminating the whole ensemble from the side. The polarization-
rotation signal is registered by differential photodiode and the precession
frequency is estimated in real time by fitting a quadratic function around the
maximum of registered signal Fourier spectrum. From this, the frequency-error
signal is obtained and fed to PI (proportional-integral) controller that
modulates the current in the $z$-direction compensation coils (see Fig. 2a for
reference). With the compensation mechanism active, we achieve long-term rms
stability of 130 Hz of the Larmor frequency, corresponding to 18.5 nT. This
translates to the stability of the relative frequency centroid of twice the
Larmor frequency, i.e. 260 Hz, which is well below the desired resolution.

#### Signal pulse preparation

Figure 7: Experimental details and schematic representation of PuDTAI model. a
The sequence is separated into the main experiment part and the auxiliary
magnetic field measurement part via free-induction decay (FID) measurement. In
the main sequence, we show the signal input/output, the control field
intensity and detuning, the GEM magnetic field gradient, the AC-Stark patterns
with two grating patterns G1 and G2, and the pump/repump lasers that prepare
the initial atomic state. In the FID magnetometry sequence we show the same
preparation as in the main experiment as well as the FID signal registered on
a polarization rotation detector. The signal is used to correct the mean
magnetic field asynchronously. b The essential levels of 87Rb atoms used in
the protocol as well as control, signal and AC-Stark light fields with respect
to atomic level structure. c Experimental setup used to generate frequency-
domain double-Gaussian signal $\mathcal{\tilde{S}}_{\varphi}(\omega)$. The in-
phase (I) and quadrature (Q) signal components generated using the arbitrary
signal generator module (ASG) are mixed with intermediate carrier frequency at
35 MHz using digital IQ-mixer. The resulting radio-frequency (RF) signal is
then up-converted by 45 MHz with help of analog mixer. Finally, the RF signal
with carrier frequency at 80 MHz is feed into acousto-optic modulator (AOM) in
double pass configuration that carves the light pulses (Signal) from
continuous wave (CW) laser. d The input signal passes through temporal
aperture (atoms) and is split into two halves. The upper and lower parts are
Fourier transformed ($\mathfrak{F}$) (inverse transform - $\mathfrak{F}^{-1}$
\- for the lower part) and combined on the beamsplitter (BS) with relative
phase set to $\theta$. The first output port ($\mathrm{Out_{-}}$) is directly
detected while the second port ($\mathrm{Out_{+}}$) before detection
experiences additional loss due to lossy ($\eta$) implementation of the
beamsplitter.

The signal and control pulses are carved out from two branches of a continuous
wave frequency-stabilized [61] laser. The first branch, used for signal pulse
generation is derived by frequency-shifting by $6834$ MHz part of laser light
using EOM and Fabry–Pérot filtering cavity (see [41] for details). Then the
signal pulses are carved with double-pass AOMs feed by home-made arbitrary
waveform generator consisting of _Red Pitaya_ running the _PyRPL_ [62]
software and external frequency mixer providing upconversion of the carrier
frequency to the desired 80 MHz. The setup is depicted in Fig. 7c. The _Red
Pitaya_ with _PyRPL_ allows us to prepare arbitrary (up to bandwidth
limitations of 50 MHz) complex envelopes that are internally multiplied by the
carrier waveform at 35 MHz using digital IQ mixer. The signal is then
externally mixed with 45 MHz local oscillator from Direct Digital Synthesizer
controlled by the main FPGA system to match the AOM central frequency of 80
MHz and provide extended amplitude dynamic range.

The frequency-domain double-Gaussian signal
$\mathcal{\tilde{S}}_{\varphi}(\omega)$ is generated by programming a temporal
envelope $\mathcal{S}_{\varphi}(t)=\mathcal{S}\cos(\frac{\delta\omega
t-\varphi}{2})\exp(-t^{2}\sigma^{2})$ with given
$\delta\omega=\sigma\varepsilon$. During the measurements, to make the virtual
sources mutually incoherent we continuously ($\mod 2\pi)$ change the phase
$\varphi$ from $-\pi$ to $\pi$ in a way that for single measurement the number
of complete $2\pi$ cycles is in order of few thousands.

#### PuDTAI Model and calibrations

The schematic representation of the theoretical model is depicted in Fig. 7d.
The model follows image-inversion interferometer description with two mutually
incoherent weak ($\bar{n}\ll 1$) sources at the input.

Figure 8: Chirped square-wave phase grating used to simultaneously apply
positive and negative quadratic phase in space. a \- Two gratings used to
implement the antisymmetric ($-$) and symmetric ($+$) PuDTAI ports. b The
coherence at longitudinal positions $z$ is split into diffraction orders that
are separated by the grating local wavevector $k_{g}=\kappa z$. c
Interpretation of the chirped square-wave grating as a superposition of
positive and negative quadratic Fresnel phase profiles.

By design, our interferometer superimposes the two arms in the Fourier space.
This can be most easily understood by investigating the Wigner function
transformations of the two signal pulse halves during propagation through the
interferometer. Let us focus on the first half that has a temporal amplitude:

$\mathcal{A}_{-}(t)=\begin{cases}\mathcal{A}(t)&t<0\\\ 0&t\geq 0\end{cases}.$
(9)

The time-dependent two photon detuning which for $t<0$ is $\delta(t)=\alpha t$
virtually applies a temporal phase profile
$\mathcal{A_{-}}(t)\to\mathcal{A}_{-}(t)\exp\left(i\frac{\alpha}{2}t^{2}\right)$
that corresponds to $z\to z^{\prime}=z-\alpha k_{z}$ transformation of the
associated atomic coherence Wigner function $\mathcal{W}_{-}(z,k_{z})$. In the
language of temporal imaging this operation is known as propagation through
temporal lens with the focal length $f_{t}=\omega_{0}/\alpha$ [37] where
$\omega_{0}$ is the optical carrier frequency. The SSM modulation with
spatially chirped square grating with wavevector $k_{g}=\kappa z$ splits the
coherence into multiple diffraction orders as depicted in Fig. 8. However, as
the depth of the grating is $\pi$ the 0-th diffraction order vanishes and the
coherence is mostly split to $\pm 1$ orders (ideally, only 18% is distributed
into higher orders). In the case of the first half of the signal pulse we are
interested in the $-1$-st order, that when isolated can be understood as a
result of quadratic phase modulation in the real space:
$\varrho_{hg}(z)\to\varrho_{hg}(z)\exp(i\frac{\kappa}{2}z^{2})$. This
correspond to the $k_{z}\to k_{z}^{\prime}=k_{z}\pm\kappa z$ transformation of
the Wigner function $\mathcal{W}_{-}(z,k_{z})$ and in terms of temporal
imaging represents temporal propagation by a distance
$d_{t}=\kappa/\omega_{0}\beta^{2}$ where $\beta$ is the Zeeman shift gradient
slope that facilitates the spectrum-to-space mapping. With
$\kappa=\nicefrac{{1}}{{\alpha}}$ that means $d_{t}=f_{t}$ the full
transformation reads:

$\displaystyle k_{z}$ $\displaystyle\to k_{z}^{\prime}=\kappa z$ (10)
$\displaystyle z$ $\displaystyle\to z^{\prime}=z-\frac{1}{\kappa}k_{z}$ (11)

which up to the additional temporal phase modulation represents a counter-
clockwise $90^{\circ}$ rotation of the phase space, that in fact is a backward
Fourier transform. Similarly for the second half of the pulse (for $t\geq 0$),
as the sign of $\alpha$ changes we get a clockwise rotation and thus forward
Fourier transform. Finally, as at the input we have the full signal pulse
$\mathcal{A}(t)=\mathcal{A}_{-}(t)+\mathcal{A}_{+}(t)$ the two components
interfere in the in the Fourier domain when the positive frequency components
of the first half are superimposed onto the negative components of the second
half thus implementing the inversion interferometer. Additionally, the by
design Fourier transform feature of our PuDTAI interferometer can improve the
signal-to-noise ratio when using noisy detectors as long signal pulses result
in short pulses at the interferometer output.

With the separation parameter
$\varepsilon=\nicefrac{{\delta\omega}}{{\sigma}}$ and temporal
representational of the input signal given by:

$\mathcal{S}_{\varphi}(t)=\psi_{\scalerel*{\leavevmode\hbox to29.16pt{\vbox
to29.86pt{\pgfpicture\makeatletter\hbox{\hskip 14.9377pt\lower-0.6957pt\hbox
to0.0pt{\pgfsys@beginscope\pgfsys@invoke{
}\definecolor{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@rgb@stroke{0}{0}{0}\pgfsys@invoke{
}\pgfsys@color@rgb@fill{0}{0}{0}\pgfsys@invoke{
}\pgfsys@setlinewidth{0.4pt}\pgfsys@invoke{ }\nullfont\hbox
to0.0pt{\pgfsys@beginscope\pgfsys@invoke{
}{}{{}}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}
{} {}{} {}\pgfsys@beginscope\pgfsys@invoke{
}\color[rgb]{1,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{1,0,0}\pgfsys@color@rgb@stroke{1}{0}{0}\pgfsys@invoke{
}\pgfsys@color@rgb@fill{1}{0}{0}\pgfsys@invoke{
}\definecolor[named]{pgffillcolor}{rgb}{1,0,0}\pgfsys@moveto{-14.22638pt}{0.0pt}\pgfsys@lineto{-14.22638pt}{0.01563pt}\pgfsys@lineto{-13.0407pt}{0.0521pt}\pgfsys@lineto{-11.85503pt}{0.15543pt}\pgfsys@lineto{-10.66934pt}{0.41895pt}\pgfsys@lineto{-9.48367pt}{1.01549pt}\pgfsys@lineto{-8.29799pt}{2.2181pt}\pgfsys@lineto{-7.11232pt}{4.36542pt}\pgfsys@lineto{-5.92664pt}{7.74141pt}\pgfsys@lineto{-4.74097pt}{12.36993pt}\pgfsys@lineto{-3.55528pt}{17.81206pt}\pgfsys@lineto{-2.36961pt}{23.10788pt}\pgfsys@lineto{-1.18393pt}{27.01266pt}\pgfsys@lineto{0.00172pt}{28.45276pt}\pgfsys@lineto{1.18741pt}{27.00441pt}\pgfsys@lineto{2.37308pt}{23.09442pt}\pgfsys@lineto{3.55876pt}{17.7947pt}\pgfsys@lineto{4.74443pt}{12.35516pt}\pgfsys@lineto{5.93011pt}{7.72968pt}\pgfsys@lineto{7.11578pt}{4.3576pt}\pgfsys@lineto{8.30147pt}{2.21332pt}\pgfsys@lineto{9.48714pt}{1.01288pt}\pgfsys@lineto{10.67282pt}{0.41765pt}\pgfsys@lineto{11.85849pt}{0.15543pt}\pgfsys@lineto{13.04417pt}{0.0521pt}\pgfsys@lineto{14.22638pt}{0.0pt}\pgfsys@closepath\pgfsys@fill\pgfsys@invoke{
} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope{{}}{}{}{}{}{}{}{}{}
{}{{}{}{}}{}{}{} {}{{}{}{}}{}{}{} {}{{}{}{}}{}{}{} {}{{}{}{}}{}{}{}
{}{{}{}{}}{}{}{} {}{{}{}{}}{}{}{} {}{{}{}{}}{}{}{} {}{{}{}{}}{}{}{}
{}{{}{}{}}{}{}{} {}{{}{}{}}{}{}{} {}{{}{}{}}{}{}{} {}{{}{}{}}{}{}{}
{}{{}{}{}}{}{}{} {}{{}{}{}}{}{}{} {}{{}{}{}}{}{}{} {}{{}{}{}}{}{}{}
{}{{}{}{}}{}{}{} {}{{}{}{}}{}{}{} {}{{}{}{}}{}{}{} {}{{}{}{}}{}{}{}
{}{{}{}{}}{}{}{} {}{{}{}{}} {}{}{}{}\pgfsys@beginscope\pgfsys@invoke{
}\color[rgb]{0,0,0}\definecolor[named]{pgfstrokecolor}{rgb}{0,0,0}\pgfsys@color@gray@stroke{0}\pgfsys@invoke{
}\pgfsys@color@gray@fill{0}\pgfsys@invoke{
}\definecolor[named]{pgffillcolor}{rgb}{0,0,0}\pgfsys@setlinewidth{1.42264pt}\pgfsys@invoke{
}{}\pgfsys@moveto{-14.22638pt}{0.01563pt}\pgfsys@curveto{-14.22638pt}{0.01563pt}{-13.3697pt}{0.0327pt}{-13.0407pt}{0.0521pt}\pgfsys@curveto{-12.71169pt}{0.07149pt}{-12.18404pt}{0.10454pt}{-11.85503pt}{0.15543pt}\pgfsys@curveto{-11.52602pt}{0.20631pt}{-10.99835pt}{0.29962pt}{-10.66934pt}{0.41895pt}\pgfsys@curveto{-10.34033pt}{0.53827pt}{-9.81268pt}{0.76587pt}{-9.48367pt}{1.01549pt}\pgfsys@curveto{-9.15466pt}{1.2651pt}{-8.627pt}{1.75331pt}{-8.29799pt}{2.2181pt}\pgfsys@curveto{-7.96898pt}{2.68288pt}{-7.44133pt}{3.59908pt}{-7.11232pt}{4.36542pt}\pgfsys@curveto{-6.78331pt}{5.13176pt}{-6.25565pt}{6.6308pt}{-5.92664pt}{7.74141pt}\pgfsys@curveto{-5.59763pt}{8.85202pt}{-5.06998pt}{10.97266pt}{-4.74097pt}{12.36993pt}\pgfsys@curveto{-4.41196pt}{13.76721pt}{-3.8843pt}{16.32219pt}{-3.55528pt}{17.81206pt}\pgfsys@curveto{-3.22627pt}{19.30193pt}{-2.69862pt}{21.83131pt}{-2.36961pt}{23.10788pt}\pgfsys@curveto{-2.0406pt}{24.38445pt}{-1.51294pt}{26.27109pt}{-1.18393pt}{27.01266pt}\pgfsys@curveto{-0.85492pt}{27.75424pt}{-0.32729pt}{28.4539pt}{0.00172pt}{28.45276pt}\pgfsys@curveto{0.33073pt}{28.45161pt}{0.8584pt}{27.74786pt}{1.18741pt}{27.00441pt}\pgfsys@curveto{1.51642pt}{26.26096pt}{2.04407pt}{24.37224pt}{2.37308pt}{23.09442pt}\pgfsys@curveto{2.70209pt}{21.8166pt}{3.22975pt}{19.28474pt}{3.55876pt}{17.7947pt}\pgfsys@curveto{3.88777pt}{16.30464pt}{4.41542pt}{13.75166pt}{4.74443pt}{12.35516pt}\pgfsys@curveto{5.07344pt}{10.95866pt}{5.6011pt}{8.83931pt}{5.93011pt}{7.72968pt}\pgfsys@curveto{6.25912pt}{6.62004pt}{6.78677pt}{5.12299pt}{7.11578pt}{4.3576pt}\pgfsys@curveto{7.4448pt}{3.59222pt}{7.97246pt}{2.67738pt}{8.30147pt}{2.21332pt}\pgfsys@curveto{8.63048pt}{1.74925pt}{9.15813pt}{1.26202pt}{9.48714pt}{1.01288pt}\pgfsys@curveto{9.81615pt}{0.76373pt}{10.34381pt}{0.5366pt}{10.67282pt}{0.41765pt}\pgfsys@curveto{11.00183pt}{0.29869pt}{11.52948pt}{0.20613pt}{11.85849pt}{0.15543pt}\pgfsys@curveto{12.1875pt}{0.10472pt}{13.04417pt}{0.0521pt}{13.04417pt}{0.0521pt}\pgfsys@stroke\pgfsys@invoke{
} \pgfsys@invoke{\lxSVG@closescope }\pgfsys@endscope
\pgfsys@invoke{\lxSVG@closescope
}\pgfsys@endscope{}{}{}\hss}\pgfsys@discardpath\pgfsys@invoke{\lxSVG@closescope
}\pgfsys@endscope\hss}}\lxSVG@closescope\endpgfpicture}}}{p}}(t)\sqrt{2}\cos(\frac{\delta\omega
t-\varphi}{2})\exp(\frac{i\varphi}{2})$ (12)

that at the interferometer input is clipped by the (symmetric) temporal
aperture function $f_{\mathfrak{A}}(t)$, we may write the following amplitudes
for the antisymmetric and symmetric ports:

$\displaystyle u_{-}(t)=$
$\displaystyle\frac{1}{2}f_{\mathfrak{A}}(t)(\mathcal{S}_{\varphi}(t)-\mathcal{S}_{\varphi}(-t)),$
(13) $\displaystyle u_{+}(t)=\frac{1}{2}$ $\displaystyle
f_{\mathfrak{A}}(t)(\mathcal{S}_{\varphi}(t)+\mathcal{S}_{\varphi}(-t)),.$
(14)

As the interferometer internally performs a Fourier transform of the input
signal, at the device output we observe the counts distributions given by
these two components in the frequency domain
$\tilde{p}_{i}(\omega)=|\tilde{u}_{i}(\omega)|^{2}$ (see Fig. 9a for example
of measured counts distributions, with $\omega=\alpha t$).

The total contributions in the antisymmetric and symmetric ports are
calculated as $p_{i}=\int\tilde{p}_{i}(\omega)\mathrm{d}\omega$ which
corresponds to using a spectral bucket (no frequency information) detector.
After introducing non-perfect interference visibilities $\mathcal{V}_{-}$ and
$\mathcal{V}_{+}$ and additional losses in the symmetric port $\eta_{+}$ we
arrive at outcome probabilities that for hard Cassegrain-type aperture
function given by
$f_{\mathfrak{A}}(t)=\Theta(-t_{\mathfrak{A}}-t)+\Theta(-t_{\mathfrak{A}}+t)$
take the form:

$\displaystyle p_{-}$
$\displaystyle=\frac{1}{2}\left(\mathrm{\mathrm{erfc}(\sqrt{2}\sigma
t_{\mathfrak{A}})}-\mathcal{V}_{-}e^{-\frac{\varepsilon^{2}}{8}}f(t_{\mathfrak{A}},\varepsilon)\right),$
(15) $\displaystyle p_{+}$
$\displaystyle=\frac{\eta_{+}}{2}\left(\mathrm{\mathrm{erfc}(\sqrt{2}\sigma
t_{\mathfrak{A}})}+\mathcal{V}_{+}e^{-\frac{\varepsilon^{2}}{8}}f(t_{\mathfrak{A}},\varepsilon)\right),$
(16) $\displaystyle p_{\times}$ $\displaystyle=1-p_{-}-p_{+},$ (17)

where
$f(t_{\mathfrak{A}},\varepsilon)=\frac{1}{2}\left(\mathrm{erfc}\left(\frac{4t_{\mathfrak{A}}\sigma-i\varepsilon}{2\sqrt{2}}\right)+\mathrm{erfc}\left(\frac{4t_{\mathfrak{A}}\sigma+i\varepsilon}{2\sqrt{2}}\right)\right)$.
The $p_{-},\,p_{+}$ are probabilities of detecting photon in the antisymmetric
and symmetric interferometer port respectively, while $p_{\times}$ is a
probability of no detection event. In Fig. 9b we show the contributions to the
symmetric and antisymmetric port for $\varepsilon=0$ when varying the grating
phase $\theta$, which demonstrates the high interference visibility.

Figure 9: Time-bin outputs of the PuDTAI interferometer and associated FI. a
Single-photon counts distributions registered at each port
($\mathrm{Out_{-}}$, $\mathrm{Out_{+}}$) of the PuDTAI interferometer for
several chosen true separation values $\varepsilon$. b The PuDTAI
interferometer phase $\theta$ scan for fixed separation parameter
$\varepsilon=0$ along with fitted sine and cosine functions corresponding to
two output ports ($N_{-}$ and $N_{+}$). c Fisher information density
$\mathcal{\mathrm{d}F}_{\varepsilon}$ for direct detection of the
antisymmetric ($-$) and symmetric ($+$) subspace with the realistic parameters
$\mathcal{V}_{-}$ and $\mathcal{V}_{+}$. For small $\varepsilon$ the
information is concentrated in the two lobes outside the central part of the
spectrum. The relative efficiencies $\eta_{-}^{\mathfrak{A}}$,
$\eta_{+}^{\mathfrak{A}}$ correspond to the hard aperture (marked as dashed
lines) that removes the input signal located within the $t\sigma=\pm 0.564$
range. d Fisher information available at each output port of the PuDTAI
device. For small separations $\varepsilon\ll 1$ the antisymmetric port
($\mathcal{F}_{-}$ corresponding to $p_{-}$) contains most information about
$\varepsilon$. The dashed lines represents the ideal case of
$\mathcal{V}_{\pm}=1$ and infinite aperture.

The atomic cloud size along with the strength of the magnetic field gradient
and slope of the control field chirp $\alpha$ limits the temporal aperture
$\mathfrak{A}$ of the interferometer. We design the aperture to contain most
informationally valuable parts of input signal while at the same reducing the
impact of the instantaneous control chirp reversal at $t=0$. This reversal by
being inherently broadband spoils the time-to-position mapping by virtually
locally broadening the input signal. To get rid of this effect we chose the
central two photon detuning $\delta(t=0)$ to be outside the magnetically
broadened absorption spectrum providing no light-to-atoms mapping at the
$\alpha$ reversal time. This forms an Cassegrain type aperture described by
$f_{\mathfrak{A}}$ that limits mostly the efficiency in the second
interferometer port, that for $\varepsilon\ll 1$ contains no information, and
serves only as brightness reference for the first port. We show this in Fig.
9c, where we plot the Fisher information densities defined as:

$\mathrm{d}\mathcal{F}_{i}=\frac{1}{p_{i}(t)}\left(\frac{\partial}{\partial\varepsilon}p_{i}(t)\right)^{2}\mathrm{d}t.$
(18)

The impact of the aperture on photon flux efficiencies in the symmetric and
antisymmetric port can be investigated by comparing the photon detection
probabilities (Eq. 15 and Eq. 16) with the case of infinite aperture
$t_{\mathfrak{A}}=0$ and taking the limit of $\varepsilon\to 0$. This gives
$\eta_{p_{-}}^{\mathfrak{A}}\approx\mathrm{erfc}(\sqrt{2}\sigma
t_{\mathfrak{A}})+2\sqrt{\nicefrac{{2}}{{\pi}}}\sigma
t_{\mathfrak{A}}\exp(-2\sigma^{2}t_{\mathfrak{A}}^{2})$ and
$\eta_{p_{+}}^{\mathfrak{A}}\approx\mathrm{erfc}(\sqrt{2}\sigma
t_{\mathfrak{A}})$ which for realistic aperture
$t_{\mathfrak{A}}=0.564/\sigma$ gives $\eta_{p_{-}}^{\mathfrak{A}}\approx
0.74$, $\eta_{p_{+}}^{\mathfrak{A}}\approx 0.26$. However, in the context of
$\varepsilon$ estimation those are not crucial, and we should look how the FI
changes with the $t_{\mathfrak{A}}$. The FI density 18 integrated over the
aperture gives the total FI available at the outputs of the device
$\mathcal{F}_{i}^{\mathfrak{A}}=\int_{\mathfrak{A}}\mathrm{d}\mathcal{F}_{i}$
that can be utilized when using a spectrally-resolved detection. Notably, in
the case of infinite aperture and ideal visibility the total FI at the output
$\mathcal{F}_{\Sigma}^{\infty}=\mathcal{F}_{-}^{\infty}+\mathcal{F}_{+}^{\infty}$
is independent of $\varepsilon$ and equals QFI which means that shapes of the
distributions at each port of the device contain additional information that
can improve the resolution for larger $\varepsilon$ values as has been
previously recognized in the context of real-space imaging [22]. To
investigate the impact of the finite aperture $\mathfrak{A}$ we calculate the
FI $\mathcal{F}_{\pm}^{\mathfrak{A}}$ and evaluate the efficiencies as
$\eta_{\mathcal{F_{\pm}}}^{\mathfrak{A}}=\mathcal{F}_{\pm}^{\mathfrak{A}}/\mathcal{F}_{\pm}^{\infty}$
which in the case of our aperture and visibilities both approximately equals
94% as included in Fig. 9c. In the case of spectral bucket detector, the total
Fisher information calculated for the observable outcome probabilities
((13),(14)) takes the form:

$\displaystyle\mathcal{F}_{\mathrm{PuDTAI}}=\underbrace{\frac{\mathcal{V}_{-}^{2}F}{64p_{-}}}_{\mathcal{F}_{-}}+\underbrace{\frac{\eta_{+}^{2}\mathcal{V}_{+}^{2}F}{64p_{+}}}_{\mathcal{F}_{+}},$
(19) $\displaystyle
F=e^{-\varepsilon^{2}/4}\left(\sqrt{8/\pi}e^{-2t_{\mathfrak{A}}^{2}\sigma^{2}+\varepsilon^{2}/8}\sin(t_{\mathfrak{A}}\sigma\varepsilon)+\varepsilon
f(t_{\mathfrak{A}},\varepsilon)\right)^{2}.$ (20)

In Fig. 9d we plot the two parts of $\mathcal{F}_{\mathrm{PuDTAI}}$ for both
the ideal and realistic case.

Interestingly, when we now evaluate the FI efficiencies in the similar way as
in the case of spectrally-resolved detection and with the finite visibilities
we may observe improvement over the apertureless case for certain
$\varepsilon$ range. This is direct result of filtering the informationally
not valuable central part of the signal that contains most of the leaking (due
to $\mathcal{V}<1$) photons. The improvement is most prominent for
$\varepsilon\to 0$ and in our case reads
$\eta_{-}^{\mathfrak{A}}=\eta_{+}^{\mathfrak{A}}\approx 2.1$. The experimental
parameters $\mathcal{V}_{-}\approx(97.51\pm 0.03)\%$,
$\mathcal{V}_{2}=(76.4\pm 0.8)\%$, $t_{\mathfrak{A}}\sigma\approx 0.564\pm
0.002$ and the efficiency $\eta_{+}\approx 0.719\pm 0.009$ are obtained from
calibration measurements consisting on running the protocol for different
$\varepsilon$ and interferometer phase $\theta$ as shown in Fig. 9b.

Finally, we can also evaluate the mean efficiencies of storage retrieval from
the memory. We obtain $\eta_{p_{-}}=0.83\%$ and $\eta_{p_{+}}=0.60\%$. We note
that those efficiencies are very similar to the ones obtained in the QPG
protocol [24]. To boost the efficiencies of the GEM one could design a larger
and more dense atomic ensemble or prepare the ensemble inside a cavity
resonant with the signal field that effectively boosts the optical depth and
thus the efficiency [63, 64, 65].

#### Maximum likelihood estimation

The estimation of the separation parameter $\varepsilon$ in both cases (QMTI
and PuDATI) follows the standard maximum likelihood estimation procedure. In
the case of QMTI the single outcome probability function is given by

$p_{\varepsilon}(\omega)=\tilde{I}(\omega)=\frac{1}{2}\left(|\tilde{\psi}(\omega-\sigma\varepsilon/2)|^{2}+|\tilde{\psi}_{-}(\omega+\sigma\varepsilon/2)|^{2}\right).$
(21)

For given distribution of measurement outcomes
$\boldsymbol{\omega}=(\omega_{1},...,\omega_{n})$ we construct the likelihood
function

$\mathcal{L}_{\boldsymbol{\omega}}(\varepsilon)=\prod_{i=1}^{n}p_{\varepsilon}(\omega_{i}),$
(22)

that is numerically maximized to yield the maximum likelihood value of
$\varepsilon$. For PuDTAI we have the three possible outcomes that are
characterized by the three probabilities: $p_{-},p\,_{+},\,p_{\times}$. For N
processed photons we have the likelihood given by a probability mass function
of the trinomial distribution:

$\mathcal{L}_{N_{-},N_{+}}(\varepsilon)=\frac{N!}{N_{-}!N_{+}!(N-N_{-}-N_{+})!}\times\\\
p_{-}(\varepsilon)^{N_{-}}p_{+}(\varepsilon)^{N_{+}}p_{\times}(\varepsilon)^{N-N_{-}-N_{+}},$
(23)

which is maximized for $p_{-}(\varepsilon)/p_{+}(\varepsilon)=N_{-}/N_{+}$.
From this, we estimate the separation by numerically solving the formula for
$\varepsilon$.

#### Superresolution parameter

As given by Eq. 7 the superresolution parameter $\mathfrak{s}$ must be
evaluated at a vanishing separation $\varepsilon$. For the PuDTAI protocol we
directly plug in the formula for Fisher information (Eq. 19) to the limit (Eq.
7) and obtain:

$\mathfrak{s}_{\mathrm{PuDTAI}}=\\\
\frac{e^{-4\sigma^{2}t_{\mathfrak{A}}^{2}}\left(\mathcal{V}_{-}^{2}(\mathcal{V}_{+}+1)-\eta_{+}\mathcal{V}_{-}\mathcal{V}_{+}^{2}+\eta_{+}\mathcal{V}_{+}^{2}\right)}{4(\mathcal{V}_{-}-1)(\mathcal{V}_{+}+1)\left(\text{erf}\left(\sqrt{2}\sigma
t_{\mathfrak{A}}\right)-1\right)}\times\\\
\left(-e^{2\sigma^{2}t_{\mathfrak{A}}^{2}}\text{erf}\left(\sqrt{2}\sigma
t_{\mathfrak{A}}\right)+e^{2\sigma^{2}t_{\mathfrak{A}}^{2}}+2\sqrt{\frac{2}{\pi}}\sigma
t_{\mathfrak{A}}\right)^{2}$ (24)

The value may be evaluated accurately with an uncertainty, as we know all the
relevant experimental parameters. Finally, if we set
$\mathcal{V}_{-}=\mathcal{V}_{+}=\mathcal{V}$ and $\eta_{+}=1$ and
$t_{\mathfrak{A}}=0$, we obtain
$\mathfrak{s}_{\mathrm{PuDTAI}}=\mathfrak{s}_{\mathrm{SLIVER}}$ (see Eq. 8).

The classical (DI) spectrometers such as Grating, FT and QMTI that are not
tailored to the given signal mode function $\tilde{\psi}(\omega)$ can be
directly used with signals that have different FWHM or $\sigma$. To indicate
that, we represent them as lines covering some $\sigma$ range that depend on
given spectrometer implementation. The super-resolution parameter
$\mathfrak{s}$ in this case is calculated using the same formula as in the
case of spectrometers tailored for the given $\tilde{\psi}(\omega)$ such as
PuDTAI or QPG. Any DI spectrometer has its bandwidth (BWL) and resolution
limit (RL). These are causing the $\mathfrak{s}$ parameter to drop below $1$
for signals with bandwidth exceeding the BWL or that are narrower than RL. The
limitation from the finite RL broadens the signal mode function
$\tilde{\psi}(\omega)$ and thus spoils the separation estimation sensitivity
by virtually making the $\varepsilon$ smaller. For a RL given by
$\sigma_{\mathrm{RL}}$ the broadening effect can be calculated as
$\sigma\to\sqrt{\sigma^{2}+\sigma_{\mathrm{RL}}^{2}}$ which result in the
$\varepsilon$ smaller by
$\frac{\sigma}{\sqrt{\sigma^{2}+\sigma_{\mathrm{Rl}}^{2}}}$ factor. On the
other hand the BWL characterized by $\Sigma_{\mathrm{BWL}}$ cuts the
informationally valuable tails of signals with $\sigma>\Sigma_{\mathrm{BWL}}$
that results in drop of the Fisher information given as
$\mathcal{F}_{\mathrm{DI}}=\int_{\Sigma_{\mathrm{BWL}}}\mathrm{d}\mathcal{F_{\mathrm{DI}}}$
with the $\mathrm{d}\mathcal{F}_{\mathrm{DI}}$ being the DI Fisher information
density and the integration goes through the whole available bandwidth. In
Fig. 6 we plot several $\mathfrak{s}$ curves for various DI spectrometers.
These are: Grating - a grating spectrometer with gratings of lengths ranging
from $1\>\mathrm{cm}$ to $10\,\mathrm{cm}$, with grating period of
$1/1200\,\mathrm{mm^{-1}}$ and
$\Sigma_{\mathrm{BWL}}=10^{3}\times\sigma_{\mathrm{RL}}$; FT \- Bruker IFS
125HR Fourier transform spectrometer with $0.001\>\mathrm{cm^{-1}}$ resolution
and $50\times 10^{3}\>\mathrm{cm^{-1}}$ and the MIR spectral range; QMTI - the
Quantum Memory Temporal Imaging Spectrometer with
$\sigma_{\mathrm{RL}}=7.2\>\mathrm{kHz}$ and $300\,\mathrm{kHz}$ BWL.

## Data availability

Data presented in Fig. 5 and Fig. 9 have been deposited in RepOD Repository
for Open Data at https://doi.org/10.18150/JSUKE9. Any other data that support
the findings of this study are available from the corresponding author upon
reasonable request.

## Code availability

Code used in data analysis is available from the corresponding author upon
reasonable request.

## References

  * [1] Orrit, M., Ha, T. & Sandoghdar, V.  Single-molecule optical spectroscopy.  _Chemical Society Reviews_ 43, 973–976 (2014).  URL https://pubs.rsc.org/en/content/articlelanding/2014/cs/c4cs90001d.
  * [2] Beć, K. B., Grabska, J. & Huck, C. W.  Biomolecular and bioanalytical applications of infrared spectroscopy – A review.  _Analytica Chimica Acta_ 1133, 150–177 (2020).  URL https://www.sciencedirect.com/science/article/pii/S0003267020304062.
  * [3] Kitchin, C. R.  _Optical Astronomical Spectroscopy_ (Routledge & CRC Press, 1995).
  * [4] Kim, J. A., Wales, D. J. & Yang, G.-Z.  Optical spectroscopy for in vivo medical diagnosis—a review of the state of the art and future perspectives.  _Progress in Biomedical Engineering_ 2, 042001 (2020).  URL https://doi.org/10.1088/2516-1091/abaaa3.
  * [5] Cheng, R. _et al._ Broadband on-chip single-photon spectrometer.  _Nature Communications_ 10, 4104 (2019).  URL https://www.nature.com/articles/s41467-019-12149-x.
  * [6] Savage, N.  Spectrometers.  _Nature Photonics_ 3, 601–602 (2009).  URL https://www.nature.com/articles/nphoton.2009.185.
  * [7] Hashimoto, K. & Ideguchi, T.  Phase-controlled Fourier-transform spectroscopy.  _Nature Communications_ 9, 4448 (2018).  URL https://www.nature.com/articles/s41467-018-06956-x.
  * [8] Watanabe, A. & Furukawa, H.  Super-resolution technique for high-resolution multichannel Fourier transform spectrometer.  _Optics Express_ 26, 27787–27797 (2018).  URL https://www.osapublishing.org/oe/abstract.cfm?uri=oe-26-21-27787.
  * [9] Paudel, U. & Rose, T.  Ultra-high resolution and broadband chip-scale speckle enhanced Fourier-transform spectrometer.  _Optics Express_ 28, 16469–16485 (2020).  URL https://www.osapublishing.org/oe/abstract.cfm?uri=oe-28-11-16469.
  * [10] Dertinger, T., Colyer, R., Iyer, G., Weiss, S. & Enderlein, J.  Fast, background-free, 3D super-resolution optical fluctuation imaging (SOFI).  _Proceedings of the National Academy of Sciences of the United States of America_ 106, 22287–22292 (2009).
  * [11] Rust, M. J., Bates, M. & Zhuang, X.  Sub-diffraction-limit imaging by stochastic optical reconstruction microscopy (STORM).  _Nature Methods_ 3, 793–796 (2006).  URL https://www.nature.com/articles/nmeth929.
  * [12] Betzig, E. _et al._ Imaging Intracellular Fluorescent Proteins at Nanometer Resolution.  _Science_ 313, 1642–1645 (2006).  URL https://science.sciencemag.org/content/313/5793/1642.
  * [13] Gatto Monticone, D. _et al._ Beating the Abbe Diffraction Limit in Confocal Microscopy via Nonclassical Photon Statistics.  _Physical Review Letters_ 113, 143602 (2014).  URL https://link.aps.org/doi/10.1103/PhysRevLett.113.143602.
  * [14] F.R.S, Lord Rayleigh.  XXXI. Investigations in optics, with special reference to the spectroscope.  _The London, Edinburgh, and Dublin Philosophical Magazine and Journal of Science_ 8, 261–274 (1879).  URL https://doi.org/10.1080/14786447908639684.
  * [15] Boschetti, A. _et al._ Spectral super-resolution spectroscopy using a random laser.  _Nature Photonics_ 14, 177–182 (2020).  URL https://www.nature.com/articles/s41566-019-0558-4.
  * [16] Tsang, M., Nair, R. & Lu, X.-M.  Quantum Theory of Superresolution for Two Incoherent Optical Point Sources.  _Physical Review X_ 6, 031033 (2016).  URL https://link.aps.org/doi/10.1103/PhysRevX.6.031033.
  * [17] Tsang, M.  Subdiffraction incoherent optical imaging via spatial-mode demultiplexing.  _New Journal of Physics_ 19, 023054 (2017).  URL https://doi.org/10.1088/1367-2630/aa60ee.
  * [18] Yang, F., Nair, R., Tsang, M., Simon, C. & Lvovsky, A. I.  Fisher information for far-field linear optical superresolution via homodyne or heterodyne detection in a higher-order local oscillator mode.  _Physical Review A_ 96, 063829 (2017).  URL https://link.aps.org/doi/10.1103/PhysRevA.96.063829.
  * [19] Lupo, C., Huang, Z. & Kok, P.  Quantum Limits to Incoherent Imaging are Achieved by Linear Interferometry.  _Physical Review Letters_ 124, 080503 (2020).  URL https://link.aps.org/doi/10.1103/PhysRevLett.124.080503.
  * [20] Tham, W.-K., Ferretti, H. & Steinberg, A. M.  Beating Rayleigh’s Curse by Imaging Using Phase Information.  _Physical Review Letters_ 118, 070801 (2017).  URL https://link.aps.org/doi/10.1103/PhysRevLett.118.070801.
  * [21] Nair, R. & Tsang, M.  Interferometric superlocalization of two incoherent optical point sources.  _Optics Express_ 24, 3684–3701 (2016).  URL https://www.osapublishing.org/oe/abstract.cfm?uri=oe-24-4-3684.
  * [22] Nair, R. & Tsang, M.  Far-Field Superresolution of Thermal Electromagnetic Sources at the Quantum Limit.  _Physical Review Letters_ 117, 190801 (2016).  URL https://link.aps.org/doi/10.1103/PhysRevLett.117.190801.
  * [23] Paúr, M., Stoklasa, B., Hradil, Z., Sánchez-Soto, L. L. & Rehacek, J.  Achieving the ultimate optical resolution.  _Optica_ 3, 1144–1147 (2016).  URL https://www.osapublishing.org/optica/abstract.cfm?uri=optica-3-10-1144.
  * [24] Donohue, J. _et al._ Quantum-Limited Time-Frequency Estimation through Mode-Selective Photon Measurement.  _Physical Review Letters_ 121, 090501 (2018).  URL https://link.aps.org/doi/10.1103/PhysRevLett.121.090501.
  * [25] Ansari, V. _et al._ Achieving the Ultimate Quantum Timing Resolution.  _PRX Quantum_ 2, 010301 (2021).  URL https://link.aps.org/doi/10.1103/PRXQuantum.2.010301.
  * [26] Zaiser, S. _et al._ Enhancing quantum sensing sensitivity by a quantum memory.  _Nature Communications_ 7, 12279 (2016).  URL https://www.nature.com/articles/ncomms12279.
  * [27] Rosskopf, T., Zopes, J., Boss, J. M. & Degen, C. L.  A quantum spectrum analyzer enhanced by a nuclear spin memory.  _npj Quantum Information_ 3, 33 (2017).  URL https://www.nature.com/articles/s41534-017-0030-6.
  * [28] Glenn, D. R. _et al._ High-resolution magnetic resonance spectroscopy using a solid-state spin sensor.  _Nature_ 555, 351–354 (2018).  URL https://www.nature.com/articles/nature25781.
  * [29] Gefen, T., Rotem, A. & Retzker, A.  Overcoming resolution limits with quantum sensing.  _Nature Communications_ 10, 4992 (2019).
  * [30] Kay, S. M.  _Fundamentals of Statistical Signal Processing: Estimation Theory_ (Prenitce Hall, 1993).
  * [31] Helstrom, C. W.  _Quantum detection and estimation theory_ (Academic Press, 1976).
  * [32] Wicker, K. & Heintzmann, R.  Interferometric resolution improvement for confocal microscopes.  _Optics Express_ 15, 12206–12216 (2007).  URL https://www.osapublishing.org/oe/abstract.cfm?uri=oe-15-19-12206.
  * [33] Wicker, K., Sindbert, S. & Heintzmann, R.  Characterisation of a resolution enhancing image inversion interferometer.  _Optics Express_ 17, 15491–15501 (2009).  URL https://www.osapublishing.org/oe/abstract.cfm?uri=oe-17-18-15491.
  * [34] Larson, W., Tabiryan, N. V. & Saleh, B. E. A.  A common-path polarization-based image-inversion interferometer.  _Optics Express_ 27, 5685–5695 (2019).  URL https://www.osapublishing.org/oe/abstract.cfm?uri=oe-27-4-5685.
  * [35] Larson, W. & Saleh, B. E. A.  Quantum-enhanced estimation of the optical phase gradient by use of image-inversion interferometry.  _Physical Review A_ 102, 013712 (2020).  URL https://link.aps.org/doi/10.1103/PhysRevA.102.013712.
  * [36] Grace, M. R., Dutton, Z., Ashok, A. & Guha, S.  Approaching quantum-limited imaging resolution without prior knowledge of the object location.  _J. Opt. Soc. Am. A_ 37, 1288–1299 (2020).  URL http://josaa.osa.org/abstract.cfm?URI=josaa-37-8-1288.
  * [37] Mazelanik, M., Leszczyński, A., Lipka, M., Parniak, M. & Wasilewski, W.  Temporal imaging for ultra-narrowband few-photon states of light.  _Optica_ 7, 203–208 (2020).  URL https://www.osapublishing.org/optica/abstract.cfm?uri=optica-7-3-203.
  * [38] Cho, Y.-W. _et al._ Highly efficient optical quantum memory with long coherence time in cold atoms.  _Optica_ 3, 100–107 (2016).  URL https://www.osapublishing.org/optica/abstract.cfm?uri=optica-3-1-100.
  * [39] Hosseini, M. _et al._ Coherent optical pulse sequencer for quantum applications.  _Nature_ 461, 241–245 (2009).  URL https://www.nature.com/articles/nature08325.
  * [40] Karpiński, M., Jachura, M., Wright, L. J. & Smith, B. J.  Bandwidth manipulation of quantum light by an electro-optic time lens.  _Nature Photonics_ 11, 53–57 (2017).  URL https://www.nature.com/articles/nphoton.2016.228.
  * [41] Parniak, M. _et al._ Quantum Optics of Spin Waves through ac Stark Modulation.  _Physical Review Letters_ 122, 063604 (2019).  URL https://link.aps.org/doi/10.1103/PhysRevLett.122.063604.
  * [42] Mazelanik, M., Parniak, M., Leszczyński, A., Lipka, M. & Wasilewski, W.  Coherent spin-wave processor of stored optical pulses.  _npj Quantum Information_ 5, 22 (2019).  URL https://www.nature.com/articles/s41534-019-0136-0.
  * [43] Lipka, M., Leszczyński, A., Mazelanik, M., Parniak, M. & Wasilewski, W.  Spatial Spin-Wave Modulator for Quantum-Memory-Assisted Adaptive Measurements.  _Physical Review Applied_ 11, 034049 (2019).  URL https://link.aps.org/doi/10.1103/PhysRevApplied.11.034049.
  * [44] Cohen, L.  _Time-frequency analysis_.  Prentice-Hall signal processing series (Prentice Hall PTR, Englewood Cliffs, N.J, 1995).
  * [45] Oh, C., Zhou, S., Wong, Y. & Jiang, L.  Quantum limits of superresolution in a noisy environment.  _Phys. Rev. Lett._ 126, 120502 (2021).  URL https://link.aps.org/doi/10.1103/PhysRevLett.126.120502.
  * [46] Datta, C. _et al._ Sub-Rayleigh resolution of two incoherent sources by array homodyning.  _Physical Review A_ 102, 063526 (2020).  URL https://link.aps.org/doi/10.1103/PhysRevA.102.063526.
  * [47] Mirhosseini, M., Sipahigil, A., Kalaee, M. & Painter, O.  Superconducting qubit to optical photon transduction.  _Nature_ 588, 599–603 (2020).  URL https://doi.org/10.1038/s41586-020-3038-6.
  * [48] Alexander, A. L., Longdell, J. J., Sellars, M. J. & Manson, N. B.  Photon echoes produced by switching electric fields.  _Phys. Rev. Lett._ 96, 043602 (2006).  URL https://link.aps.org/doi/10.1103/PhysRevLett.96.043602.
  * [49] Fossati, A. _et al._ A frequency-multiplexed coherent electro-optic memory in rare earth doped nanoparticles.  _Nano Letters_ 20, 7087–7093 (2020).  URL https://doi.org/10.1021/acs.nanolett.0c02200.
  * [50] Yang, T.-S. _et al._ Multiplexed storage and real-time manipulation based on a multiple degree-of-freedom quantum memory.  _Nature Communications_ 9, 3407 (2018).  URL https://doi.org/10.1038/s41467-018-05669-5.
  * [51] Shah, M. & Fan, L.  Frequency Superresolution with Spectrotemporal Shaping of Photons.  _Physical Review Applied_ 15, 034071 (2021).  URL https://link.aps.org/doi/10.1103/PhysRevApplied.15.034071.
  * [52] Lukens, J. M. & Lougovski, P.  Frequency-encoded photonic qubits for scalable quantum information processing.  _Optica_ 4, 8–16 (2017).  URL https://www.osapublishing.org/optica/abstract.cfm?uri=optica-4-1-8.
  * [53] Dudin, Y. O., Li, L. & Kuzmich, A.  Light storage on the time scale of a minute.  _Phys. Rev. A_ 87, 031801 (2013).  URL https://link.aps.org/doi/10.1103/PhysRevA.87.031801.
  * [54] Parniak, M. _et al._ Wavevector multiplexed atomic quantum memory via spatially-resolved single-photon detection.  _Nature Communications_ 8, 2140 (2017).  URL https://www.nature.com/articles/s41467-017-02366-7.
  * [55] Maring, N., Lago-Rivera, D., Lenhard, A., Heinze, G. & de Riedmatten, H.  Quantum frequency conversion of memory-compatible single photons from 606 nm to the telecom c-band.  _Optica_ 5, 507–513 (2018).  URL http://www.osapublishing.org/optica/abstract.cfm?URI=optica-5-5-507.
  * [56] Zhou, S. & Jiang, L.  Modern description of rayleigh’s criterion.  _Phys. Rev. A_ 99, 013808 (2019).  URL https://link.aps.org/doi/10.1103/PhysRevA.99.013808.
  * [57] Tsang, M.  Quantum limit to subdiffraction incoherent optical imaging.  _Phys. Rev. A_ 99, 012305 (2019).  URL https://link.aps.org/doi/10.1103/PhysRevA.99.012305.
  * [58] Řeháček, J. _et al._ Optimal measurements for quantum spatial superresolution.  _Phys. Rev. A_ 98, 012103 (2018).  URL https://link.aps.org/doi/10.1103/PhysRevA.98.012103.
  * [59] Pushkina, A. A., Maltese, G., Costa-Filho, J. I., Patel, P. & Lvovsky, A. I.  Superresolution linear optical imaging in the far field.  _Phys. Rev. Lett._ 127, 253602 (2021).  URL https://link.aps.org/doi/10.1103/PhysRevLett.127.253602.
  * [60] Lipka, M., Mazelanik, M., Leszczyński, A., Wasilewski, W. & Parniak, M.  Massively-multiplexed generation of Bell-type entanglement using a quantum memory.  _Communications Physics_ 4, 46 (2021).  URL https://www.nature.com/articles/s42005-021-00551-1.
  * [61] Lipka, M., Parniak, M. & Wasilewski, W.  Optical frequency locked loop for long-term stabilization of broad-line DFB laser frequency difference.  _Applied Physics B_ 123, 238 (2017).  URL https://doi.org/10.1007/s00340-017-6808-6.
  * [62] Neuhaus, L. _et al._ PyRPL (Python Red Pitaya Lockbox) — An open-source software package for FPGA-controlled quantum optics experiments.  In _2017 Conference on Lasers and Electro-Optics Europe European Quantum Electronics Conference (CLEO/Europe-EQEC)_ (2017).
  * [63] Heller, L., Farrera, P., Heinze, G. & de Riedmatten, H.  Cold-atom temporally multiplexed quantum memory with cavity-enhanced noise suppression.  _Phys. Rev. Lett._ 124, 210504 (2020).  URL https://link.aps.org/doi/10.1103/PhysRevLett.124.210504.
  * [64] Wang, X.-J. _et al._ Cavity-enhanced atom-photon entanglement with subsecond lifetime.  _Phys. Rev. Lett._ 126, 090501 (2021).  URL https://link.aps.org/doi/10.1103/PhysRevLett.126.090501.
  * [65] Jiang, Y., Mei, Y., Zou, Y., Zuo, Y. & Du, S.  Intracavity cold atomic ensemble with high optical depth.  _Review of Scientific Instruments_ 90, 013105 (2019).  URL https://doi.org/10.1063/1.5065431.

## Acknowledgments

We thank W. Wasilewski, M. Jachura and R. Demkowicz-Dobrzański for insightful
discussions and K. Banaszek for the generous support. This work has been
funded by National Science Centre (Poland) grant no. 2017/25/N/ST2/00713,
Polish science budget funds for years 2017-2021 as a research project within
the “Diamentowy Grant” program of the Ministry of Science and Education
(DI2016 014846), Office of Naval Research (USA) grant no. N62909-19-1-2127 and
by the MAB/2018/4 “Quantum Optical Technologies” project. The Quantum Optical
Technologies project is carried out within the International Research Agendas
program of the Foundation for Polish Science co-financed by the European Union
under the European Regional Development Fund. Michał Parniak and Mateusz
Mazelanik were also supported by the Foundation for Polish Science via the
START scholarship.

## Author contributions

M.M. and M.P. conceived the scheme and planned the experiment and the
theoretical research. M.M., A.L. and M.P. contributed to the experimental
setup, software and data collection. M.M. analyzed the data, developed theory
and prepared figures. M.M. and M.P. wrote the manuscript. All authors
discussed the results.

## Competing interests

The authors declare no competing interests.