# kNN-Prompt: Nearest Neighbor Zero-Shot Inference

Weijia Shi Julian Michael Suchin Gururangan Luke Zettlemoyer
Paul G. Allen School of Computer Science & Engineering,
University of Washington, Seattle, WA
{swj0419, julianjm, sg01<EMAIL_ADDRESS>
###### Abstract

Retrieval-augmented language models (LMs) use non-parametric memory to
substantially outperform their non-retrieval counterparts on perplexity-based
evaluations, but it is an open question whether they achieve similar gains in
few- and zero-shot end-task accuracy. We extensively study one such model, the
$k$-nearest neighbor LM ($k$NN-LM), showing that the gains marginally
transfer. The main challenge is to achieve coverage of the verbalizer tokens
that define the different end-task class labels. To address this challenge, we
also introduce kNN-Prompt, a simple and effective $k$NN-LM with automatically
expanded fuzzy verbalizers (e.g. to expand “terrible” to also include “silly”
and other task-specific synonyms for sentiment classification). Across nine
diverse end-tasks, using kNN-Prompt with GPT-2 large yields significant
performance boosts over strong zero-shot baselines (13.4% absolute improvement
over the base LM on average). We also show that other advantages of non-
parametric augmentation hold for end tasks; kNN-Prompt is effective for domain
adaptation with no further training, and gains increase with the size of the
retrieval model.

##  1 Introduction

Figure 1:  kNN-Prompt incorporates information from a large, heterogeneous
corpus (unlabeled texts from different domains) to facilitate few- and zero-
shot inference. The datastore contains key-value pairs where the key is an
encoding of a leftward context and the value is the next token following the
context. Our fuzzy verbalizer expands "terrible" to include "silly" and
"great" to include "excellent". Because the encoded corpus is unlabeled plain
text, some datastore entries contain next tokens not in the verbalizer tokens
(e.g., "cinema").

Retrieval-augmented language models (LMs) have access to a non-parametric
memory, allowing them to directly access a large external text collection
during inference. Previous work has shown that these models substantially
outperform their non–retrieval-based counterparts on language modeling tasks
Khandelwal et al. (2020); He et al. (2021); Borgeaud et al. (2021), but it is
an open question whether they also achieve similar gains in few-shot and zero-
shot end task evaluations Radford et al. (2019); Brown et al. (2020a). In this
paper, we demonstrate that, with some extensions to improve coverage of the
verbalizer tokens, the performance gains of retrieval-augmented LMs generalize
well to a wide range of downstream tasks.

We study the $k$-nearest neighbors language model (Khandelwal et al., 2020,
$k$NN-LM), which interpolates the LM softmax distribution with a nearest-
neighbor distribution. The nearest neighbours are computed based on the
distance in LM output embeddings and can be drawn from any text corpus, in our
case, a heterogeneous corpus that contains unlabeled data from different
domains. We are the first to study the zero-shot application of $k$NN-LM to
end tasks, and we find that applying the technique naïvely produces only
marginal improvements (Section 4). The main challenge is that the support of
the $k$NN distribution is sparse (covering at most $k$ tokens, often less), as
it only assigns probability mass to nearest neighbors. This means it often
entirely misses the tokens that are used to verbalize the output label in the
standard application of LMs to zero-shot classification: across the datasets
we test, an output label receives nonzero probability under the $k$NN
distribution only 44.2% of the time (see Section 6).

To address this challenge, we introduce kNN-Prompt, a simple and effective
method built on $k$NN-LM for improving zero-shot inference with no further
training. Key to our approach are fuzzy verbalizers, which automatically
expand the set of tokens corresponding to each output label. For example, in
Figure 1, the verbalized label of the negative sentiment is “terrible.” Our
fuzzy verbalizer also maps “silly” to negative sentiment, allowing the model
to better leverage the information available in the $k$NN distribution.
Extensive experiments (Section 3) show that applying kNN-Prompt using a purely
unlabeled heterogeneous corpus consistently improves zero-shot performance on
eleven tasks, including sentiment analysis, topic classification, entailment,
fact retrieval and question answering. These improvements hold for every model
in the GPT-2 family.

We also show that kNN-Prompt can be used to adapt LMs to new domains and tasks
with no further training (Section 5). With a domain-specific datastore corpus,
we achieve comparable or better performance to prompting the LM after domain-
adaptive pretraining (Gururangan et al., 2020) on that corpus. To better
understand these gains, we conduct a thorough analysis (Section 6), showing
that fuzzy verbalizers are essential for leveraging the $k$NN distribution,
the benefits of retrieval increase with retrieval model size, and even
relatively small datastores can yield sizeable performance gains if they are
tailored to the domain or task. Overall, our results show how retrieval can
benefit zero-shot inference with LMs on a wide variety of tasks, and suggest
that applying retrieval with larger models may yield even greater benefits.
Code is available at github.com/swj0419/kNN_prompt.

Figure 2: An illustration of kNN-Prompt applying to sentiment analysis tasks.
Texts are encoded in the datastore, where each entry consists of a
representation of a leftward context and its next token. During inference, a
test example is mapped to a prompt form and used to retrieve the k most
similar contexts and their next tokens from the datastore. The kNN
distribution is a multinomial computed on the distance of the text example and
similar contexts. The final prediction is formed by combining the kNN
distribution with the language model output distribution.

##  2 Method

To perform zero-shot prediction on a downstream task using a pretrained
language model, we recast the task as language modeling (Radford et al., 2019)
by converting each input instance into a natural language prompt (Section
2.1). We then augment the pretrained model with the $k$-nearest-neighbors
language modeling technique from Khandelwal et al. (2020). To better benefit
from the sparse $k$NN distribution, we introduce fuzzy verbalizers for mapping
from the LM’s outputs to a distribution over task-specific labels (Section
2.3). Finally, we decode the output from this label distribution using the
domain-conditional PMI scoring method of Holtzman et al. (2021).

###  2.1 Prompting and Verbalizers

We address classification problems where an instance consists of an input
sequence of tokens $\mathbf{x}=(x_{0},x_{1},...,x_{|\mathbf{x}|})$ from a
vocabulary $\mathcal{V}$ and an output label $y\in Y$. The output label set
$Y$ may be fixed for the task (text classification). For example, in the
sentiment analysis example in Figure 2, the input is $\mathbf{x}=$ “Mr. Tsai
is one of world cinema’s most gifted artists.” The output labels are $Y$ =
{$y^{+}$, $y^{-}$}, referring to positive and negative sentiment.

To cast the task as language modeling, we deterministically transform each
input example $\mathbf{x}$ into a prompt $p(\mathbf{x})$. Providing this
prompt to an LM yields a probability distribution $P_{LM}(\mathbf{v}\mid
p(\mathbf{x}))$. To extract an output label from this, we apply verbalizers
$V:y\rightarrow\mathcal{V}^{*}$ Schick and Schütze (2021) which map each
output label $y\in Y$ to a label word $V(y)=\mathbf{v}$. We can then compute a
probability for each label:

$P(y\mid\mathbf{x})\propto P_{LM}(V(y)\mid p(\mathbf{x})),$ (1)

normalizing over all $y\in Y$.

For example, our prompt transformation for sentiment analysis adds It was
after the input, and uses the verbalizer
$V(y^{+})=\textit{great},V(y^{-})=\textit{terrible}$, which classifies
sentiment according to the relative probabilities of It was great and It was
terrible after the input sequence (see Figure 2, bottom left).

###  2.2 $k$-Nearest Neighbors Language Modeling

Following Khandelwal et al. (2020), we augment the LM with a datastore from
which it can retrieve tokens that inform its predictions, improving
performance without further training.

The datastore is a key-value store generated by running the LM over a corpus
of text. Each value is a token $w\in\mathcal{V}$ from the corpus, and its key
is the vector hidden representation at the output layer of the LM running
forward on the left context $\mathbf{c}\in\mathcal{V}^{*}$ (call this
$f(\mathbf{c})$). At inference time, when predicting the next token for an
input sequence $\mathbf{c}$, the $k$NN-LM retrieves the $k$ nearest neighbors
of $\mathbf{c}$ from the datastore according to the distance
$d(\cdot,f(\mathbf{c}))$ of their key vectors (squared $L^{2}$ distance
following Khandelwal et al.).

A softmax over the (negative) distances induces a distribution over the the
tokens $w_{i}$ in the nearest neighbor set:

$P_{k\text{NN}}(v\mid\mathbf{c})\propto\sum_{(f(\mathbf{c}_{i}),w_{i})}\mathds{1}_{v=w_{i}}e^{\frac{-d(f(\mathbf{c}_{i}),f(\mathbf{c}))}{t}}$

where $t$ is a temperature parameter.111We have added the temperature
adjustment in the softmax on top of the $k$NN-LM formulation. We can then
interpolate this with the original LM as follows:

$P_{k\text{NN-LM}}(v\mid c)=(1-\lambda)P_{\text{LM}}(v|c)+\lambda
P_{k\text{NN}}(v|c).$

The hyperparameters for the $k$NN-LM approach are the number $k$ of nearest
neighbors, the interpolation constant $\lambda$, the temperature $t$, and the
choice of datastore.

###  2.3 Fuzzy verbalizers

One challenge in performing zero-shot inference with LMs on downstream tasks
is the choice of verbalizer. On one hand, LMs may be highly sensitive to the
particular surface form in ways that are irrelevant to the classification task
(Holtzman et al., 2021). On the other hand, for a $k$NN model, the $k$ nearest
neighbor set is sparse and may fail to cover any of the tokens in the set of
verbalizers (i.e., $P_{kNN}(V(y))=0$ for all $y\in Y$), limiting its utility
in those cases. To address these issues, we introduce fuzzy verbalizers, which
associate each label $y$ with a neighborhood of token sequences around a
specific verbalization $V(y)\in\mathcal{V}^{*}$.

To do this, we first associate each token $v\in\mathcal{V}$ with a
neighborhood $\mathcal{N}(v)\subseteq\mathcal{V}$ of similar tokens. In
particular, we use $v$’s top-5 most similar words according to the cosine
similarity of their GloVe embeddings (Pennington et al., 2014), as well as any
of $v$’s synonyms in ConceptNet (Speer et al., 2017).222https://conceptnet.io
Then, for the purposes of calculating the probability of a verbalized label
$\mathbf{v}=V(y)$, we treat a prediction of any token in each neighborhood of
$v$ as a viable substitute for it, marginalizing over $\mathcal{N}(z)$:

$P_{FV}(y\mid x)\propto\sum_{v_{i}\in\mathcal{N}(v)}P(v_{i}\mid
p(\mathbf{x}))$ (2)

The fuzzy verbalizer helps mitigate the effect the sparsity of the $k$NN
distribution has on zero-shot prediction (see Section 6).

###  2.4 Full model

To make a zero-shot prediction for an input $\mathbf{x}$, we first transform
it into a prompt $p(\mathbf{x})$ and obtain a distribution over the label word
$\mathbf{v}$ with a $k$NN-LM: $P_{kNN-LM}(\mathbf{v}\mid p(\mathbf{x}))$. We
then apply domain-conditional PMI scoring rule (Holtzman et al., 2021) to
calibrate the distribution:

$PMI_{DC}(v,p(\mathbf{x}))=\frac{P(v\mid p(\mathbf{x}))}{P(v\mid\mathbf{p})}$

where $\mathbf{p}$ is a task-dependent string which is independent of the
particular input (generally the local context at the end of the prompt, e.g.,
we use $\mathbf{p}=\text{``It was''}$ for sentiment analysis, as shown in
Figure 2).

Finally, we convert this to the output label score $P(y\mid p(\mathbf{x}))$
using a fuzzy verbalizer (Section 2.3). When using the fuzzy verbalizer
together with PMI calibration, instead of marginalizing over the tokens in the
fuzzy verbalizer $v_{i}\in\mathcal{N}(v)$ (Equation 2), we score each label
according to the sum of the PMIs of its associated tokens:

$P(y\mid\mathbf{x})\propto\sum_{v_{i}\in\mathcal{N}(v)}PMI_{DC}(v_{i},p(\mathbf{x}))$

##  3 Experimental Setup

Corpus | Size | # Tokens
---|---|---
Wikitext-103 | 181MB | 114M
Amazon Reviews | 89MB | 19M
CC-NEWS | 457MB | 324M
IMDB | 45MB | 8M
Total | 722MB | 465M
Table 1:  Statistics of our heterogeneous datastore corpora.

###  3.1 Tasks

We experiment with 9 tasks, including topic classification, sentiment
analysis, entailment and partisanship classification.

#### Topic Classification

We use the AG News (AGN) and Yahoo! Answers (Yahoo) corpora from Zhang et al.
(2015) for topic classification.

#### Sentiment and Partisanship

We study sentiment analysis using the Rotten Tomatoes (RT) and SST-2 corpora
of Socher et al. (2013), movie reviews from Pang and Lee (2005, MR), the
customer review dataset from Hu and Liu (2004, CR) consisting of Amazon and
Yelp reviews, and the hyperpartisan news detection dataset from Kiesel et al.
(2019, HYP), which focuses on classifying whether a text exhibits extreme
political views.

| RTE | CB | Yahoo | RT | SST-2 | CR | MR | HYP | AGN | Avg
---|---|---|---|---|---|---|---|---|---|---
LM | 53.1 | 48.2 | 49.7 | 53.0 | 55.3 | 66.2 | 54.6 | 58.5 | 67.4 | 56.2
LM+PMI | 54.2 | 50.0 | 48.8 | 74.1 | 76.5 | 82.8 | 74.6 | 58.5 | 65.1 | 65.0
kNN-LM | 53.1 | 48.2 | 49.5 | 54.5 | 55.4 | 67.2 | 56.4 | 58.5 | 67.0 | 56.6
kNN-Prompt | 55.6 | 53.5 | 51.0 | 80.6 | 84.2 | 84.3 | 78.2 | 60.0 | 78.8 | 69.6
Table 2:  Zero-shot results on a variety of tasks. Our model, kNN-Prompt,
handily outperforms Holtzman et al. (2021)’s PMI scoring method alone (LM+PMI)
as well as the base $k$NN-LM method of Khandelwal et al. (2020).

#### Entailment

Entailment datasets focus on classifying whether one sentence plausibly
implies another to be true or false. We evaluate on the CommitmentBank (De
Marneffe et al., 2019, CB) and the Recognizing Textual Entailment (Dagan et
al., 2010, RTE) dataset provided in GLUE Wang et al. (2018).

###  3.2 kNN-Prompt Model Details

#### Inference Model

For our main experiments, we directly use GPT-2 large from
Huggingface333https://github.com/huggingface/transformers as our base LM. We
consider other model sizes in Section 6.

#### Retriever Model

Following the inference model, we use GPT-2 large to build the datastore. The
keys are the 1280-dimensional hidden representations before the final MLP
which predicts the token distribution at each timestep, produced using a
single forward pass over the datastore corpus. For efficient similarity
search, we create a FAISS Johnson et al. (2019) index and search for nearest
neighbors by Euclidean distance.

#### Datastore Corpus

For our datastore, we aim to curate a large, heteregenous corpus of data
broadly relevant to the tasks we evaluate. To this end, we combine four
sources of data including Wikitext-103 Merity et al. (2016), the Amazon review
corpus of He and McAuley (2016), and subsets of CC-
NEWS444https://huggingface.co/datasets/cc_news and
IMDB555http://ai.stanford.edu/~amaas/data/sentiment sampled uniformly from
each. Table 1 lists the specifics of each data source.

#### Inference Procedure

We retrieve k=1024 neighbors, soften the kNN distribution with a temperature
value of 3 and use an interpolation factor of $\lambda=0.3$. Our primary
evaluation is zero-shot. All hyperparameters were chosen on the basis of
development experiments (see Section 6 for more details).

###  3.3 Baselines

#### LM

is the result of prompting the base language model (GPT-2 Large), choosing the
output label whose verbalizer has the highest probability under the language
model $P_{LM}(V(y)\mid p(\mathbf{x}))$.

#### LM+PMI

is the approach of Holtzman et al. (2021), calibrating LM with domain-
conditional PMI scoring (Section 2.4).

####  $k$NN-LM

directly applies the $k$NN-LM of Khandelwal et al. (2020) in the same way as
LM, choosing the highest-probability output label.

| CR | HYP | MR
---|---|---|---
LM | 79.5 4.1 | 56.7 0.5 | 78.2 1.4
LM+PMI | 79.8 5.5 | 52.7 2.6 | 76.3 1.5
$k$NN-LM | 79.5 4.2 | 56.7 1.5 | 77.5 2.3
kNN-prompt | 80.5 1.7 | 57.1 1.1 | 79.4 1.5
Table 3:  The mean and standard deviation for 4 uniformly sampled sets of 4
demonstration examples used for few-shot inference.

##  4 Experimental Results

Results for zero-shot prediction are in Table 2. kNN-Prompt outperforms all
baselines in all tasks, improving over the base LM by 13.4% on average. The
gains are particularly pronounced for MR and RT (sentiment analysis on movie
reviews), Yahoo (topic classification). For MR and RT, the gains seem to come
mostly from PMI calibration.

Interestingly, the $k$NN-LM alone yields a fairly small improvement over the
base LM (about 0.4% on average). This suggests that the fuzzy verbalizer and
PMI calibration methods may help kNN-Prompt better leverage the information in
the $k$-nearest neighbors distribution. We examine possible sources of kNN-
Prompt’s performance gains in Section 6.

#### Few-shot inference

For a subset of tasks, we additionally compare to a few-shot setting where we
prepend four examples uniformly sampled from the training data to the input
(Table 3). The demonstration examples are converted to prompt and verbalizer
format. We report the mean accuracy and standard deviation with 4 different
random seeds. We find that kNN-Prompt consistently outperform baselines,
demonstrating that kNN-Prompt is applicable to the few-shot setting as well.
We leave further exploration of this phenomenon to future work.

Figure 3: Effect of the number of tokens in the datastore on CR and MR. Each
line represents the kNN-Prompt model with a different datastore and the line
ends when the entire available datastore is used. General, Domain, and Task
refer to the heterogeneous corpus (Table 1), domain-specific corpus, and task-
specific corpus, respectively. We use IMDB as the domain-specific corpus for
MR, and Amazon Reviews for CR. The task-specific corpus is the unlabeled
training data of each task. GPT-2 Large is used for both retriever and
inference models.

##  5 kNN-Prompt for Domain Adaptation

One of the advantages of retrieval-based LMs is that they can be adapted to
new domains with no further training.

To test this capability, we replace our heterogeneous datastore (Section 3.2)
with domain-specific ones for several tasks. To build these domain-specific
datastores, we select Amazon Reviews for CR, CC-NEWS for HYP and IMDB for MR,
and encode them separately.

| CR | HYP | MR
---|---|---|---
LM + PMI | 82.8 | 58.5 | 74.6
kNN-prompt | 84.3 | 60.0 | 78.2
DAPT (LM + PMI) | 84.1 | 61.1 | 77.8
Table 4: Domain adaptation experiments using domain-specific datastores. DAPT
requires training the LM on the corresponding datastore, while kNN-Prompt can
use it as the datastore with no further training.

For comparison, we consider domain-adaptive pretraining (Gururangan et al.,
2020, DAPT), which further trains the LM on the domain-specific corpus. We
train GPT-2 Large on each domain corpus for a single pass, then apply it to
downstream tasks using our prompting and verbalizer setup and domain-
conditional PMI scoring.

As shown in Table 4, kNN-Prompt performs comparably with DAPT. Specifically,
kNN-Prompt slightly outperforms DAPT on CR and MR. These results indicate that
kNN-Prompt is an effective method for domain adaptation. Critically, unlike
DAPT, kNN-Prompt does not require further training, which is more practical
and efficient for adapting very large LMs.

#### Effect of datastore distribution and size

To better understand kNN-Prompt’s potential for domain adaptation, we
experiment with varying sizes and distributions of the datastore. For each
task, we consider three options for the datastore corpus: our heterogeneous
corpus (Section 3.2), a domain-specific corpus, and a task-specific corpus
constructed from the task’s (unlabeled) training data. Each of these data
sources exhibits increasing levels of relevance to the task.

Figure 3 shows how model performance varies with the choice of datastore
across different datastore sizes. For a fixed number of tokens, retrieving
from a task-specific datastore is best. Furthermore, token-for-token, adding
task-specific data leads to more gains than domain-specific data, which in
turn is better than our heterogeneous corpus.

Using domain-specific data is always better than retrieving from the large
heterogeneous corpus. For example, for CR, using 6M tokens of domain-specific
data outperforms using our 465M token heterogeneous corpus. These results
suggest that while having a large datastore is beneficial, curating task-
specific or domain-specific data can also be an effective way of improving
model performance, especially if datastore size is limited (e.g., due to
memory constraints).

Model | Acc. |  $\Delta$Acc.
---|---|---
LM | 56.2 | 0
LM+kNN (kNN-LM) | 56.6 | +0.4
LM+Fuzzy | 63.4 | +7.2
LM+PMI | 65.0 | +8.8
LM+Fuzzy+PMI | 67.1 | +10.9
LM+kNN+Fuzzy | 66.5 | +10.3
LM+kNN+PMI | 64.2 | +8.0
LM+kNN+Fuzzy+PMI (kNN-Prompt) | 69.6 | +13.4
Table 5:  Effect of different components on the average zero-shot accuracy
across the eleven tasks.

##  6 Analysis

Figure 4: Effect of the number of retrieved neighbors and softmax temperature
on kNN-Prompt performance for three tasks: CR and MR. Task performance
monotonically improves with the number of neighbors as $k$ is increased to
1024.  Figure 5: Effect of the retriever model size (GPT-2) on CR and MR. A
size of 0 indicates that no retriever is used. Different lines represent
different-sized inference models (GPT-2). The benefits of kNN-Prompt scale
with the retriever model size.

We perform several experiments to understand the contribution of each
component of kNN-Prompt and inform our choice of hyperparameters.

#### Model ablations

kNN-Prompt incorporates three features on top of the base LM: $k$NN retrieval
and interpolation (Section 2.2), fuzzy verbalizers (Section 2.3), and PMI
scoring (Section 2.4). Table 5 shows the results of ablation experiments
analyzing the contribution of each component.

First, we find that adding kNN to LM gives trivial improvement (+0.4%), but
much greater once we add fuzzy verbalizers on top of them (+10.3%), exceeding
the contribution of the two components independently (with fuzzy verbalizers
alone at +7.2%). This supports the argument that fuzzy verbalizers allow the
model to make better use of the sparse support of the $k$NN distribution.
Indeed, we find that across all tasks, an output label receives nonzero
probability under the $k$NN distribution in $k$NN-LM only 45.8% of the time.
With fuzzy verbalizers, this increases to 78%.

Second, we find that for the base LM, fuzzy verbalizers bring gains (+7.2%)
similar to PMI scoring (+8.8%), but the gains are only partially additive when
combining the two techniques (+10.9%). This suggests that by incorporating
more varied surface forms into the score for each label, fuzzy verbalizers may
partially — but not completely — mitigate the surface form competition problem
which PMI scoring was designed to tackle (Holtzman et al., 2021). The effect
of PMI scoring is increased, however, when we use fuzzy verbalizers and $k$NN
retrieval together (+13.4% for the full model versus +10.3% for $k$NN with
fuzzy verbalizers), suggesting that the $k$NN distribution might suffer from
more surface form competition problems than the base LM distribution.

####  $k$NN retrieval hyperparameters

Figure 4 shows how the number of retrieved nearest neighbors ($k$) and softmax
temperature affect model performance on three datasets. In most cases,
performance monotonically improves with the number of neighbors when $k$ is
smaller than 1024 and deteriorates after that. When $k<256$, a temperature of
1 performs best, while flattening the distribution is useful when retrieving
more neighbors. Overall, using 1024 neighbors and a temperature value of 3
performs consistently well across the tasks we test.

#### Retrieval model size and inference model size

Figure 5 shows how performance varies with the size of the retriever and
inference models on three tasks. We observe substantial gains as the size of
the retriever increases, which hold regardless of inference model size.

It should be noted that a larger retriever leads to a larger datastore and
slower retrieval: increasing the retriever size from 125M to 1600M parameters
doubles the memory footprint of the datastore, which scales with the size of
the retriever model’s output embeddings. These computational tradeoffs may
inform the retriever size best suited for a particular application.

##  7 Related Work

#### Retrieval-augmented LMs

Several studies propose the use of retrieval mechanisms with external
datastores to improve language modeling performance (Khandelwal et al., 2020)
and open-domain question answering (Izacard and Grave, 2020; Lewis et al.,
2020). Other work incorporates retrieval directly into the LM pretraining
process (Guu et al., 2020; Borgeaud et al., 2021). Khandelwal et al. (2021)
applies nearest neighbor retrieval to conditional sequence generation to
improve the quality of machine translation systems. Our work is the first to
show that retrieval augmentation, introduced at test time, improves the zero-
shot inference of language models on a variety of end tasks.

#### Zero-shot and few-shot inference

Brown et al. (2020b) demonstrate that large LMs can perform zero-shot (given
only a prompt) and few-shot learning (using a concatenation of training
examples as demonstrations) without any finetuning. Subsequent work further
improves their zero-shot and few-shot abilities with calibration Holtzman et
al. (2021); Zhao et al. (2021); Min et al. (2021a), prompt engineering Lu et
al. (2021); Shin et al. (2020) and meta-tuning Min et al. (2021b); Wei et al.
(2022); Zhong et al. (2021). Rubin et al. (2021) and Liu et al. (2021) apply
retrieval methods to select in-context learning examples that are
semantically-similar to a test example for few-shot inference. However, these
retrieval methods require access to a large set of labeled data. In contrast,
kNN-Prompt only assumes the availability of a heterogeneous unlabeled corpus.

##  8 Conclusions

We present kNN-Prompt, a new technique to augment LMs with nearest neighbor
retrieval for zero-shot inference on end tasks. kNN-Prompt substantially
improves zero-shot performance on a wide range of multiple-choice and
classification tasks. With a domain- or task-relevant datastore, kNN-Prompt
enables efficient domain adaptation with no additional training, and its
benefits scale with the size of the retrieval model.

##  9 Limitations

Although kNN-Prompt significantly improves GPT-2 family models’ zero-shot and
few-shot performance, it stores high-dimensional vectors for every token in
the datastore corpus and performs k-nearest neighbor search for every next
token, which incurs significant inference overhead. Future work may study
compressing the datastore and approximating kNN-search for efficient
retrieval. Careful analysis could also explore datastore curation methods to
balance task-relevancy, domain generality, and size. In addition, compared
with sentence or document-level retrieval, retrieving tokens at each time step
may limit the language model’s ability to reason about the retrieved
information. Future work may explore if more coarse-grained retrieval and
interpolation such as chunks, sentences and documents-level lead to better end
task performance.

Our evaluation of kNN-Prompt is limited to GPT-2 family models and eleven end
tasks. There are many other tasks and language models for which kNN-Prompt can
be useful. Future work may study the usefulness of kNN-Prompt with larger
inference models (i.e: GPT-3) and more diverse tasks. Potentially, large
inference models combined with larger retrieval models may result in better
zero-shot performance.

## References

  * Borgeaud et al. (2021) Sebastian Borgeaud, Arthur Mensch, Jordan Hoffmann, Trevor Cai, Eliza Rutherford, Katie Millican, George van den Driessche, Jean-Baptiste Lespiau, Bogdan Damoc, Aidan Clark, et al. 2021.  Improving language models by retrieving from trillions of tokens.  _arXiv preprint arXiv:2112.04426_.
  * Brown et al. (2020a) Tom Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared D Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, et al. 2020a.  Language models are few-shot learners.  _Advances in neural information processing systems_ , 33:1877–1901.
  * Brown et al. (2020b) Tom B. Brown, Benjamin Mann, Nick Ryder, Melanie Subbiah, Jared Kaplan, Prafulla Dhariwal, Arvind Neelakantan, Pranav Shyam, Girish Sastry, Amanda Askell, Sandhini Agarwal, Ariel Herbert-Voss, Gretchen Krueger, Tom Henighan, Rewon Child, Aditya Ramesh, Daniel M. Ziegler, Jeffrey Wu, Clemens Winter, Christopher Hesse, Mark Chen, Eric Sigler, Mateusz Litwin, Scott Gray, Benjamin Chess, Jack Clark, Christopher Berner, Sam McCandlish, Alec Radford, Ilya Sutskever, and Dario Amodei. 2020b.  Language models are few-shot learners.  _CoRR_ , abs/2005.14165.
  * Dagan et al. (2010) Ido Dagan, Bill Dolan, Bernardo Magnini, and Dan Roth. 2010.  Recognizing textual entailment: Rational, evaluation and approaches – erratum.  _Natural Language Engineering_ , 16(1):105–105.
  * De Marneffe et al. (2019) Marie-Catherine De Marneffe, Mandy Simons, and Judith Tonhauser. 2019.  The commitmentbank: Investigating projection in naturally occurring discourse.  In _proceedings of Sinn und Bedeutung_ , volume 23, pages 107–124.
  * Gururangan et al. (2020) Suchin Gururangan, Ana Marasović, Swabha Swayamdipta, Kyle Lo, Iz Beltagy, Doug Downey, and Noah A. Smith. 2020.  Don’t stop pretraining: Adapt language models to domains and tasks.  In _Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics_ , pages 8342–8360, Online. Association for Computational Linguistics.
  * Guu et al. (2020) Kelvin Guu, Kenton Lee, Zora Tung, Panupong Pasupat, and Mingwei Chang. 2020.  Retrieval augmented language model pre-training.  In _International Conference on Machine Learning_ , pages 3929–3938. PMLR.
  * He et al. (2021) Junxian He, Graham Neubig, and Taylor Berg-Kirkpatrick. 2021.  Efficient nearest neighbor language models.  In _Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing_ , pages 5703–5714.
  * He and McAuley (2016) Ruining He and Julian McAuley. 2016.  Ups and downs: Modeling the visual evolution of fashion trends with one-class collaborative filtering.  In _proceedings of the 25th international conference on world wide web_ , pages 507–517.
  * Holtzman et al. (2021) Ari Holtzman, Peter West, Vered Shwartz, Yejin Choi, and Luke Zettlemoyer. 2021\.  Surface form competition: Why the highest probability answer isn’t always right.  In _Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing_ , pages 7038–7051, Online and Punta Cana, Dominican Republic. Association for Computational Linguistics.
  * Hu and Liu (2004) Minqing Hu and Bing Liu. 2004.  Mining and summarizing customer reviews.  In _Proceedings of the Tenth ACM SIGKDD International Conference on Knowledge Discovery and Data Mining_ , KDD ’04, page 168–177, New York, NY, USA. Association for Computing Machinery.
  * Izacard and Grave (2020) Gautier Izacard and Edouard Grave. 2020.  Leveraging passage retrieval with generative models for open domain question answering.
  * Johnson et al. (2019) Jeff Johnson, Matthijs Douze, and Hervé Jégou. 2019.  Billion-scale similarity search with GPUs.  _IEEE Transactions on Big Data_ , 7(3):535–547.
  * Khandelwal et al. (2021) Urvashi Khandelwal, Angela Fan, Dan Jurafsky, Luke Zettlemoyer, and Mike Lewis. 2021\.  Nearest neighbor machine translation.  In _International Conference on Learning Representations_.
  * Khandelwal et al. (2020) Urvashi Khandelwal, Omer Levy, Dan Jurafsky, Luke Zettlemoyer, and Mike Lewis. 2020\.  Generalization through memorization: Nearest neighbor language models.  In _International Conference on Learning Representations_.
  * Kiesel et al. (2019) Johannes Kiesel, Maria Mestre, Rishabh Shukla, Emmanuel Vincent, Payam Adineh, David Corney, Benno Stein, and Martin Potthast. 2019.  SemEval-2019 task 4: Hyperpartisan news detection.  In _Proceedings of the 13th International Workshop on Semantic Evaluation_ , pages 829–839, Minneapolis, Minnesota, USA. Association for Computational Linguistics.
  * Lewis et al. (2020) Patrick Lewis, Ethan Perez, Aleksandra Piktus, Fabio Petroni, Vladimir Karpukhin, Naman Goyal, Heinrich Küttler, Mike Lewis, Wen-tau Yih, Tim Rocktäschel, Sebastian Riedel, and Douwe Kiela. 2020.  Retrieval-augmented generation for knowledge-intensive nlp tasks.
  * Liu et al. (2021) Jiachang Liu, Dinghan Shen, Yizhe Zhang, Bill Dolan, Lawrence Carin, and Weizhu Chen. 2021.  What makes good in-context examples for gpt-$3$?  _arXiv preprint arXiv:2101.06804_.
  * Lu et al. (2021) Yao Lu, Max Bartolo, Alastair Moore, Sebastian Riedel, and Pontus Stenetorp. 2021\.  Fantastically ordered prompts and where to find them: Overcoming few-shot prompt order sensitivity.  _arXiv preprint arXiv:2104.08786_.
  * Merity et al. (2016) Stephen Merity, Caiming Xiong, James Bradbury, and Richard Socher. 2016.  Pointer sentinel mixture models.  _arXiv preprint arXiv:1609.07843_.
  * Min et al. (2021a) Sewon Min, Mike Lewis, Hannaneh Hajishirzi, and Luke Zettlemoyer. 2021a.  Noisy channel language model prompting for few-shot text classification.  _arXiv preprint_.
  * Min et al. (2021b) Sewon Min, Mike Lewis, Luke Zettlemoyer, and Hannaneh Hajishirzi. 2021b.  Metaicl: Learning to learn in context.  _arXiv preprint arXiv:2110.15943_.
  * Pang and Lee (2005) Bo Pang and Lillian Lee. 2005.  Seeing stars: Exploiting class relationships for sentiment categorization with respect to rating scales.  In _Proceedings of the 43rd Annual Meeting of the Association for Computational Linguistics (ACL’05)_ , pages 115–124, Ann Arbor, Michigan. Association for Computational Linguistics.
  * Pennington et al. (2014) Jeffrey Pennington, Richard Socher, and Christopher Manning. 2014.  GloVe: Global vectors for word representation.  In _Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP)_ , pages 1532–1543, Doha, Qatar. Association for Computational Linguistics.
  * Radford et al. (2019) Alec Radford, Jeffrey Wu, Rewon Child, David Luan, Dario Amodei, Ilya Sutskever, et al. 2019.  Language models are unsupervised multitask learners.  _OpenAI blog_ , 1(8):9.
  * Rubin et al. (2021) Ohad Rubin, Jonathan Herzig, and Jonathan Berant. 2021.  Learning to retrieve prompts for in-context learning.  _arXiv preprint arXiv:2112.08633_.
  * Schick and Schütze (2021) Timo Schick and Hinrich Schütze. 2021.  Exploiting cloze-questions for few-shot text classification and natural language inference.  In _Proceedings of the 16th Conference of the European Chapter of the Association for Computational Linguistics: Main Volume_ , pages 255–269, Online. Association for Computational Linguistics.
  * Shin et al. (2020) Taylor Shin, Yasaman Razeghi, Robert L. Logan IV, Eric Wallace, and Sameer Singh. 2020.  AutoPrompt: Eliciting Knowledge from Language Models with Automatically Generated Prompts.  In _Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP)_ , pages 4222–4235, Online. Association for Computational Linguistics.
  * Socher et al. (2013) Richard Socher, Alex Perelygin, Jean Wu, Jason Chuang, Christopher D Manning, Andrew Y Ng, and Christopher Potts. 2013.  Recursive deep models for semantic compositionality over a sentiment treebank.  In _Proceedings of the 2013 conference on empirical methods in natural language processing_ , pages 1631–1642.
  * Speer et al. (2017) Robyn Speer, Joshua Chin, and Catherine Havasi. 2017.  Conceptnet 5.5: An open multilingual graph of general knowledge.  In _Thirty-first AAAI conference on artificial intelligence_.
  * Wang et al. (2018) Alex Wang, Amanpreet Singh, Julian Michael, Felix Hill, Omer Levy, and Samuel Bowman. 2018.  GLUE: A multi-task benchmark and analysis platform for natural language understanding.  In _Proceedings of the 2018 EMNLP Workshop BlackboxNLP: Analyzing and Interpreting Neural Networks for NLP_ , pages 353–355, Brussels, Belgium. Association for Computational Linguistics.
  * Wei et al. (2022) Jason Wei, Maarten Bosma, Vincent Zhao, Kelvin Guu, Adams Wei Yu, Brian Lester, Nan Du, Andrew M. Dai, and Quoc V Le. 2022.  Finetuned language models are zero-shot learners.  In _International Conference on Learning Representations_.
  * Zhang et al. (2015) Xiang Zhang, Junbo Zhao, and Yann LeCun. 2015.  Character-level convolutional networks for text classification.  _Advances in neural information processing systems_ , 28.
  * Zhao et al. (2021) Tony Z Zhao, Eric Wallace, Shi Feng, Dan Klein, and Sameer Singh. 2021.  Calibrate before use: Improving few-shot performance of language models.
  * Zhong et al. (2021) Ruiqi Zhong, Kristy Lee, Zheng Zhang, and Dan Klein. 2021.  Adapting language models for zero-shot learning by meta-tuning on dataset and prompt collections.  In _Findings of the Association for Computational Linguistics: EMNLP 2021_ , pages 2856–2878, Punta Cana, Dominican Republic. Association for Computational Linguistics.

Test Example | Label | LM Prediction |  |
---|---|---|---|---
Too few games could set back PSP launch - Sony exec Signs of a delay, or just managing expectations? The text topic is about | technology | sports |  |
Retrieved Context | Retrieved Value | kNN Prediction | Distance | Corpus
…References to the game are commonly brought up in other articles about… | software | technology | 33.5 | Wikitext-103
…While it would be easy to point an accusatory finger at Sony and blame them for killing the Dreamcast by overselling the PS2… there’s a certain level of intellectual dishonesty in such a stance… [ Sega ]’s poor U.S. support for … | hardware | technology | 33.7 | Wikitext-103
Table 6: An example from AGN where the kNN gives the correct prediction while
LM does not.

##  Appendix A Appendix

###  A.1 Case Study

We manually check examples where kNN-Prompt is better than LM to understand
why kNN-Prompt improves performance. As shown in Table 6, the language model
has to know the meaning of the entity "PSP" and "Sony", otherwise it may
associate "games" with a sport. kNN is able to match "Sony" in one of the
retrieved neighbors, resolving the ambiguity of the word "games".

###  A.2 Templates

Table 7 shows the template and verbalizer used for each dataset.

Dataset |  Template \+ input |  Verbalizer (Fuzzy verbalizer)
---|---|---
RTE |  Time Warner is the world’s largest media and Internet company.  question:  Time Warner is the world’s largest company.  true or false? answer: |  true (true, yes, correct, faithful, accurate…)
|  false (false, no, incorrect, wrong, untrue, unfaithful…)
CB |  question: Given that  What fun to hear Artemis laugh. She’s such a serious child. |  true (true, yes, correct, faithful, accurate…)
Is  I didn’t know she had a sense of humor.  true, false, or neither? Answer: |  false (false, no, incorrect, wrong, untrue, unfaithful…)
|  neither (neither, none, nothing)
Yahoo |  why doesn’t an optical mouse work on a glass table?  topic: |  society (society, culture, sociality, group, tribal, organization…)
|  science (science, math, scientist, knowledge, physics, bioscience…)
|  health (health, disease, obesity, medicine, nutrition, well-being…)
|  education (education, pedagogy, instruction, school, curriculum, college…)
|  computer (computer, internet, network, laptop, progammer, hardware…)
|  sports (sports, athletics, sportsman, play, football, basketball…)
|  business (business, finance, economics, fund, banking, investment…)
|  entertainment (entertainment, music, amusement, game, recreation…)
|  family (family, relationships, marriage, household, friendship…)
|  politics (politics, government, geopolitics, law, democracy, politician…)
AGN |  Economic growth in Japan slows down as the country experiences.  topic: |  politics (politics, government, geopolitics, law, democracy, politician…)
|  sports (sports, athletics, sportsman, play, football, basketball…)
|  business (business, finance, economics, fund, banking, investment…)
|  technology (technology, engineering, science, techinal, science, computer…)
HYP |  Are you sick of Republicans? Or just right-wingers in general? …  neutral or partisan? Answer: |  neutral (neutral, fair, objective, impartial, disinterested…)
|  partisan (partisan, biased, unfair, prejudiced, unjust…)
SST-2, CR, |  Illuminating if overly talky documentary.  It was |  great (great, good, gorgeous, legendary, perfect, phenomenal…)
MR, RT |  terrible (terrible, plain, poor, hideous, upset, awful…)
Table 7: The template and the example (colored black) used for each dataset.
We also include the standard verbalizer and (a sample of tokens used in the
fuzzy verbalizer).


# Breaking into the window
of primordial black hole dark matter with x-ray microlensing

Manish Tamta${}^{\href https://orcid.org/0009-0006-7088-8705}$
<EMAIL_ADDRESS>Nirmal Raj${}^{\href
https://orcid.org/0000-0002-4378-1201}$<EMAIL_ADDRESS>Prateek
Sharma${}^{\href https://orcid.org/0000-0003-2635-4643}$<EMAIL_ADDRESS>Indian Institute of Science, C. V. Raman Avenue, Bengaluru 560012, India

###### Abstract

Primordial black holes (PBHs) in the mass range
$10^{-16}-10^{-11}~{}M_{\odot}$ may constitute all the dark matter. We show
that gravitational microlensing of bright x-ray pulsars provide the most
robust and immediately implementable opportunity to uncover PBH dark matter in
this mass window. As proofs of concept, we show that the currently operational
NICER telescope can probe this window near $10^{-14}~{}M_{\odot}$ with just
two months of exposure on the x-ray pulsar SMC-X1, and that the forthcoming
STROBE-X telescope can probe complementary regions in only a few weeks. These
times are much shorter than the year-long exposures obtained by NICER on some
individual sources. We take into account the effects of wave optics and the
finite extent of the source, which become important for the mass range of our
PBHs. We also provide a spectral diagnostic to distinguish microlensing from
transient background events and to broadly mark the PBH mass if true
microlensing events are observed. In light of the powerful science case, i.e.,
the imminent discovery of dark matter searchable over multiple decades of PBH
masses with achievable exposures, we strongly urge the commission of a
dedicated large broadband telescope for x-ray microlensing. We derive the
microlensing reach of such a telescope by assuming sensitivities of detector
components of proposed missions, and find that with hard x-ray pulsar sources
PBH masses down to a few $10^{-17}~{}M_{\odot}$ can be probed.

##  I Introduction

One appealing contender for the make-up of the unidentified dark matter is
primordial black holes (PBHs), formed likely due to density perturbations
generated during the inflationary epoch of the universe Carr and Hawking
(1974); *KhlopovreviewPBH:2008qy; *CarrreviewPBH:2016drx;
*CarrreviewPBH:2020xqk; Green and Kavanagh (2021).

Hunted extensively by looking for signatures of their evaporation,
gravitational microlensing, accretion-induced distortion of the relic
radiation, gravitational waves from binary mergers, and dynamical effects in
stellar systems, they have left open a mass window between about
$10^{-16}-10^{-11}~{}M_{\odot}$ over which they can constitute 100% of the
dark matter; see Ref. Green and Kavanagh (2021) for the most up-to-date
constraints. In this paper we show that gravitational microlensing performed
at current and imminent x-ray telescopes can, for the very first time,
realistically probe this mass window. Our main result is shown in Figure 1,
which we will discuss in detail in Sec. III.2.

Figure 1: 90% C.L. constraints on primordial black hole dark matter from
observations of the x-ray pulsar SMC X-1 over 1.74 days at NICER, and
projected reaches of NICER (60 days on SMC-X1), the future STROBE-X (30 days
on SMC-X1), and our proposed X$\mu$ (30 days on a Crab-like hard x-ray pulsar
in the SMC). With one year of exposure at NICER, as obtained for other
individual sources, $f_{\rm PBH}$ about six times smaller than the 60-day
reach shown here can be constrained. Also shown are x-ray microlensing limits
using RXTE Bai and Orlofsky (2019), optical microlensing using Subaru-HSC
Croon  _et al._ (2020a), and PBH evaporation Green and Kavanagh (2021). See
Sec. III.2 for further details.

Microlensing is the temporary magnification of a background star due to the
gravitational field of a transiting body, with images typically unresolved. It
is a technique that, using stellar sources in the Milky Way and neighbouring
galaxies, has ruled out massive compact halo objects (MACHOs) and PBHs in the
mass range from $10^{-11}-10~{}M_{\odot}$ as the entire content of dark matter
Croon  _et al._ (2020a). The technique can also be applied, albeit in a non-
trivial way, to extended objects with various density distributions Henriksen
and Widrow (1995); Fairbairn  _et al._ (2017); Blinov  _et al._ (2020); Croon
_et al._ (2020a, b); Bai  _et al._ (2020); Ansari  _et al._ (2024). The
smallest PBH masses reached by microlensing were constrained by the Subaru-HSC
instrument Niikura  _et al._ (2019); Smyth  _et al._ (2020); Croon  _et al._
(2020a), which was sensitive to the short transit times of light PBHs.
However, the Subaru-HSC survey was limited by the twin effects of [i] the
finite apparent size of the source stars in its sky target, M31, being larger
than the apparent Einstein radius, yielding poorly focused light, and [ii]
transition from geometric to wave optics as the PBH Schwarschild radius
becomes comparable to or smaller than the wavelength of optical light as the
PBH mass is reduced. Therefore, broadly speaking, to probe PBH masses less
than $10^{-11}~{}M_{\odot}$ one must seek to microlens compact sources that
emit in wavelengths smaller than optical. Reference Bai and Orlofsky (2019)
recognized that accreting x-ray pulsars in the Magellanic Clouds provide just
such a source, which moreover furnish a steady flux above which transient
magnification of microlensing can be discerned, and are located far enough
from Earth to provide appreciable optical depth of intervening PBHs. In that
work, limits on atom-sized PBHs were derived from 10 days of observations at
the Rossi X-ray Timing Explorer (RXTE) satellite on x-ray pulsars in the
Magellanic Clouds, but these could only exclude the unphysical scenario of PBH
densities higher than that of dark matter. Future projections of such other
satellites as eXTP, AstroSat, Lynx, and Athena with 300 days of exposure were
shown to be more promising.

In this work, we will show that the ongoing Neutron Star Interior Composition
Explorer Mission (NICER), designed primarily to measure the masses and radii
of accreting x-ray pulsars, can constrain PBHs in the mass window as a
physical fraction of the dark matter population with merely two months of live
exposure. This is smaller than or comparable to the exposure already obtained
by NICER on multiple sources. Moreover, the future STROBE-X satellite, touted
as the spiritual successor of NICER, would require even less exposure for this
purpose thanks to its much larger effective area and wider coverage of x-ray
frequencies. We estimate the reaches of these telescopes as a proof of concept
that the observation of bright x-ray pulsars provide our best opportunity to
discover dark matter in the PBH mass window of
$10^{-16}-10^{-11}~{}M_{\odot}$. One main message of our paper is that the
science case is strong enough to fly a dedicated x-ray satellite for
microlensing. Such a telescope should have a large effective area of about
1–10 m2 and operate in the 0.1–1000 keV energy range, achievable traits as
seen in the designs of the proposed instruments STROBE-X Ray  _et al._ (2019),
LOFT-P Wilson-Hodge and Ray (2016) and Daksha Bhalerao  _et al._ (2022a);
*dakshabhalerao2022science. It should also continuously observe source
candidates for a few weeks or months. The costs of such a campaign are
completely warranted given the monumental nature of discovering dark matter in
an untouched region spanning five orders of magnitude. In the rest of the
paper, we will call this hypothetical future telescope “X$\mu$”, a name to
connote x-ray microlensing.

This paper is laid out as follows. In Section II we review the framework of
gravitational microlensing by point-like lenses, with emphasis on x-ray pulsar
sources and the effects of wave optics and finite source. Here we discuss the
identification of microlensing-induced magnification in the photon count rate
data obtained at x-ray telescopes, and provide a diagnostic for distinguishing
microlensing events from transient backgrounds, namely, the inspection of
photon frequency data. In Section III we derive event rates and summarize our
prescription for setting microlensing limits in x-ray telescopes, using which
we obtain limits on the population of PBHs with currently available NICER
data, and future reaches of NICER, STROBE-X and X$\mu$. In Section IV we
provide discussion on the scope of our study. In the appendix we provide some
background material for key formulae used in the paper, and briefly survey
alternative ideas in the literature for probing the PBH mass window. We
generally use natural units, $\hbar=c=1$, but in some expressions we will
restore $\hbar$ and $c$ for clarity.

Figure 2: Contours of the magnification factor in Eq. (3) for point-like
lenses in the plane of the wave/geometric optics demarcation parameter $w$
(Eq. (4)) and the impact parameter $y$, for the source sizes $a_{\rm S}$ as
indicated. See Sec. II for a discussion of the features here.

Figure 3: Contours of the source-specific energy-averaged magnification factor
in Eq. (2) for the x-ray pulsar SMC X-1 (source size: 20 km, distance from
Earth: 64 kpc) at NICER and STROBE-X, with their detection energy ranges as
indicated. See Sec. II for a discussion of the features here.

##  II X-ray Microlensing

###  II.1 Basic set-up

The geometric set-up of microlensing is illustrated in, e.g., Refs. Narayan
and Bartelmann (1996); Croon  _et al._ (2020b, a), and microlensing of x-ray
pulsars has been described in detail in Ref. Bai and Orlofsky (2019). Here we
briefly review the essentials, consigning to Appendix A derivations of
formulae.

Defining $x\equiv D_{\rm L}/D_{\rm S}$ as the ratio of the observer-lens
distance $D_{\rm L}$ to observer-source distance $D_{\rm S}$, the Einstein
radius for a point-like lens of mass $M$ is given by

$\displaystyle r_{\rm E}$ $\displaystyle=$
$\displaystyle\sqrt{\frac{4GMx(1-x)D_{\rm S}}{c^{2}}}$ $\displaystyle=$
$\displaystyle 54~{}{\rm
km}\bigg{[}\bigg{(}\frac{M}{10^{-15}M_{\odot}}\bigg{)}\bigg{(}\frac{D_{\rm
S}}{65~{}{\rm
kpc}}\bigg{)}\bigg{(}\frac{x(1-x)}{0.25}\bigg{)}\bigg{]}^{1/2}~{}.$

This quantity is the closest distance that source photons get to the lens when
it lies directly along the line of sight. As line-of-sight distances of
interest are generally much greater than transverse distances in the problem,
microlensing events may be visualized as projections on the lens-containing
transverse plane, the “lens plane”. It then becomes useful to express
distances in units of $r_{\rm E}$. The source radius in the lens plane is
$a_{\rm S}(x)\equiv xR_{\rm S}/r_{\rm E}$, and (in units of $r_{\rm E}$) the
distance from the lens center to the source center (i.e., the impact
parameter) is $y$. As a function of these quantities, the magnification
obtained at a telescope averaged over the energy range [$E_{\rm min},E_{\rm
max}$], weighted by the spectral energy distribution (SED) of the source
$\mathcal{F}(E)$ and the energy-dependent effective area of the telescope
$\mathcal{A}(E)$ is

$\overline{\mu}_{E}(y,a_{\rm S}(x))=\frac{\int_{E_{\rm min}}^{E_{\rm
max}}dE\mathcal{A}(E)\mathcal{F}(E)\mu(w,y,a_{\rm S}(x))}{\int_{E_{\rm
min}}^{E_{\rm max}}dE\mathcal{A}(E)\mathcal{F}(E)}~{},$ (2)

where

$\begin{split}&\mu(w,y,a_{\rm S}(x))=a_{\rm S}^{-2}e^{-y^{2}/(2a_{\rm
S}^{2})}\frac{\pi w}{1-e^{-\pi w}}\times\\\
&\int_{0}^{\infty}dzze^{-z^{2}/(2a_{\rm S}^{2})}I_{0}(yz/a_{\rm
S}^{2})\bigg{|}{}_{1}F_{1}\bigg{(}\frac{iw}{2},1;\frac{iwz^{2}}{2}\bigg{)}\bigg{|}^{2}\end{split}$
(3)

is a magnification factor that accounts for effects of both the finiteness of
the source and wave optics, with ${}_{1}F_{1}$ the confluent hypergeometric
function of the first kind. (We use the Python package mpmath mpmath
development team (2023) to evaluate ${}_{1}F_{1}$.) The intensity of the
source is here assumed to follow a Gaussian profile
$\propto\exp(-|\vec{y}-\vec{z}|^{2}/2a_{\rm S}^{2})$, and
$I_{0}(z)=(1/2\pi)\int_{0}^{2\pi}e^{zcos\theta}d\theta$ is the zeroth-order
modified Bessel function of the first kind Nakamura and Deguchi (1999).

The effect of wave optics is encapsulated by the parameter

$\displaystyle w$ $\displaystyle\equiv\frac{4GME_{\gamma}}{\hbar
c^{3}}=\frac{2R_{\rm Schw}E_{\gamma}}{\hbar c}~{}$ (4)
$\displaystyle\Rightarrow E_{\gamma}$ $\displaystyle=33.5~{}{\rm
keV}\bigg{(}\frac{10^{-15}M_{\odot}}{M}\bigg{)}~{}w~{},$

where $R_{\rm Schw}=2GM/c^{2}$ is the Schwarzschild radius of the PBH and
$E_{\gamma}$ is the photon energy. In the limit of $w\gg y^{-1}$ (where the
impact parameter $y$ is typically $\mathcal{O}(1)$) the extent of the lens
well exceeds the photon wavelength, and Eq. (3) reduces to the expression
obtained from geometric optics Nakamura and Deguchi (1999); Matsunaga and
Yamamoto (2006); Sugiyama  _et al._ (2020); Montero-Camacho  _et al._ (2019)
as seen by inspecting the behavior of ${}_{1}F_{1}$. In the limit of
$w\lesssim y^{-1}$ wave optics effects become important, and the magnification
tends to be suppressed for $w\ll y^{-1}$. Thus Eq. (4) also roughly marks the
smallest PBH mass that can be probed by an instrument, corresponding to the
largest energy it can detect, beyond which wave effects degrade the
sensitivity. Thus for {NICER, STROBE-X/LOFT-P, RXTE}, which reach energies of
{12, 30, 60} keV, the wave effects tend to suppress microlensing signals for
$M<\\{28,11,5.6\\}\times 10^{-16}~{}M_{\odot}$. Our proposed detector X$\mu$
would reach 1000 keV, hence PBH masses down to $3.4\times
10^{-17}~{}M_{\odot}$. The exact value of $M$ down to which a given instrument
can reach is determined by a few other factors, which will be discussed soon.

We depict the effects of finite source and wave optics in Figure 2 with
contours of the magnification factor in Eq. (3) in the space of $w$ and lens
impact parameter $y$, for source sizes $a_{\rm S}$ of 0.05 and 0.5. Scanning
from left to right in both panels, we see that $\mu$ is suppressed for $w\ll
1$, deep in the wave optics regime, peaks at some intermediary $w$, and
stabilizes at some $w\gg 1$ deep in the geometric optics regime. Smaller
impact parameters $y$ generally tend to produce larger magnifications, as
expected. Comparing across panels, the $a_{\rm S}=0.5$ case typically produces
smaller magnifications as expected: the more extended a source is on the lens
plane, the less it is focused by the lens and hence the weaker the
magnification Witt and Mao (1994); Croon  _et al._ (2020a). For $a_{\rm
S}=0.05$ large fluctuations in $\mu$ are visible in the region of transition
between wave and geometric optics, $w=\mathcal{O}(1-10)$, a reflection of the
rapid oscillation of the hypergeometric function in this region, best seen by
taking appropriate limits of the $a_{\rm S}$-independent, $w$-dependent piece
of the integrand in Eq. (3) Matsunaga and Yamamoto (2006):

$\frac{\pi w}{1-e^{-\pi
w}}\bigg{|}{}_{1}F_{1}\bigg{(}\frac{iw}{2},1;\frac{iwz^{2}}{2}\bigg{)}\bigg{|}^{2}=\begin{cases}1+\frac{\pi
w}{2}+\frac{w^{2}}{2}(\pi^{2}-3z^{2})\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ,w\ll 1~{},~{}\\\
\frac{1}{z\sqrt{4+z^{2}}}\bigg{[}2+z^{2}+2\sin\bigg{[}w\bigg{(}\frac{1}{2}z\sqrt{4+z^{2}}+\log\bigg{|}\frac{\sqrt{4+z^{2}}+z}{\sqrt{4+z^{2}}-z}\bigg{|}\bigg{)}\bigg{]}\bigg{]},\
w\gtrsim z^{-1}~{}.\end{cases}$ (5)

The white bands where $\mu\to 0$ depict regions where there is complete
destructive interference. For $a_{\rm S}=0.5$, however, these oscillations are
not visible since they are averaged out quickly via the tempering effect of
the finite source, captured in Eq. (3) by the modified Bessel function term in
the integrand; see the detailed illustrations in Ref. Matsunaga and Yamamoto
(2006).

In Figure 3 we show contours of the energy-averaged detector- and source-
specific magnification in Eq. (2) in the plane of the impact parameter $y$ and
fractional distance to the lens $x$. The source here is taken to be the x-ray
pulsar SMC X-1 in the Small Magellanic Cloud at a distance $d=64$ kpc, with
the source size, i.e., the radius of the emission region, taken to be $R_{\rm
S}=20$ km as done in Ref. Bai and Orlofsky (2019). The SED of this pulsar is
taken as Neilsen  _et al._ (2004)

$\displaystyle\mathcal{F}(E_{\gamma})=$
$\displaystyle\begin{cases}(E_{\gamma}/{\rm keV})^{-0.93}\ \ \ \ \ \ \ \ \ \ \
\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ,~{}E_{\gamma}\leq 6~{}{\rm keV},\\\
(E_{\gamma}/{\rm keV})^{-0.93}e^{-(E_{\gamma}-6~{}{\rm keV})/7.9~{}{\rm
keV}},~{}E_{\gamma}>6~{}{\rm keV}.\end{cases}$ (6)

The left and right panels depict respectively the currently operational X-ray
Timing Instrument (XTI) on NICER and the forthcoming STROBE-X satellite,
spanning energy ranges of [0.2, 12] keV and [0.2, 30] keV, whose effective
areas $\mathcal{A}(E)$ are given in Ref. Wilson-Hodge and Ray (2016). We
display two sets of contours corresponding to PBH masses $5\times
10^{-15}~{}M_{\odot}$ and $10^{-14}~{}M_{\odot}$, having Schwarschild radii of
(13.4 keV)-1 $\equiv 1.5\times 10^{-2}~{}$nm and (6.7 keV)-1 $\equiv 2.9\times
10^{-2}$ nm respectively.

For a given $y$ the values of $\bar{\mu}_{\rm E}$ obtained at STROBE-X are
seen to be generically larger than at NICER. This is because STROBE-X can
reach higher photon energies than NICER, so that it samples more of the
geometric optics-dominated (as opposed to wave optics-dominated) region of
microlensing, leading to overall stronger magnification. In both panels the
heavier PBH obtains higher magnification for comparable $(x,y)$ values, as
once again it lies more in the geometric optics region, i.e., $w$ is larger
for a given photon energy. As expected, the magnification increases as $y$ is
reduced. An interesting effect is the rate of variation of $\bar{\mu}_{\rm E}$
across $y$, which is faster (slower) for the heavier (lighter) PBH. This is
once again due to the wave vs geometric optics at play. As seen from Fig. 2,
the magnification varies slowly with $y$ in the wave optics ($w\ll y^{-1}$)
region and more quickly in the geometric optics ($w\gg y^{-1}$) region. The
contours in Fig. 3 rapidly go to $y=0$ beyond some value of $x=x_{\rm max}$.
This is the result of the finite source effect, which suppresses the
magnification for lenses too close to the source. If larger $\bar{\mu}_{\rm
E}$ values are desired, it comes with the price of smaller $x_{\rm max}$ in
order to obtain a small source size on the lens plane.

Figure 4:  Top: An 864-second segment (observation ID = 6535010301) of the
x-ray pulsar SMC-X1 at NICER-XTI, binned by 0.1 seconds. With horizontal lines
are shown the mean $B$ and the count rate 3 standard deviations $\sigma_{B}$
from it, and with red crosses are shown regions with 2 consecutive bins with
count rate greater than $B+3\sigma_{B}$. Bottom: Another segment (observation
ID = 6535010801) showing a transient event. To confirm this as an occurrence
unrelated to microlensing, such as an x-ray flare or interaction of
atmospheric electrons with the detector, we inspect the event in two windows
of energy (here with 0.2 second time-binning). Microlensing induced by PBHs in
the geometric optics regime would be achromatic and thus appear the same in
the two windows. See Sec. II.2 for further details.

###  II.2 Identifying microlensing in x-ray pulsar data

Having reviewed microlensing in the x-ray regime, we now turn to how
microlensing events may be identified in data. We will make use of information
on both count rates and energies of the photons detected at x-ray telescopes.

To uncover a PBH transit producing excess photon counts such as in
microlensing, we follow the statistical prescription in Ref. Bai and Orlofsky
(2019). Assuming that time-binned photon counts are independent events and
follow a Gaussian distribution, we demand that there are $N_{\rm consec}$ bins
with photon counts that are at least $N_{\sigma}$ standard deviations
($\sigma_{B}$) greater than the mean counts per second $B$. The values of
$N_{\rm consec}$ and $N_{\sigma}$ must be chosen prudently so that the signal
is statistically significant, i.e., the probability that such bins are
produced by the statistical fluctuations must be sufficiently minuscule. We
will soon show that $N_{\rm consec}=3$ and $N_{\sigma}=3$ are optimal choices,
which we will use for the rest of this work.

We must also ensure that a magnified signal (as defined below) has not simply
arisen from a large number of statistical samples, i.e., from the look-
elsewhere effect. The probability of obtaining 3 consecutive events above the
$3\sigma$ threshold should be smaller than

$\frac{t_{\rm bin}}{t_{\rm exp}}=1.9\times 10^{-8}\bigg{(}\frac{t_{\rm
bin}}{0.1~{}{\rm s}}\bigg{)}\bigg{(}\frac{60\ {\rm days}}{t_{\rm
exp}}\bigg{)}~{},$ (7)

where $t_{\rm exp}$ is the exposure time. This probability $\mathbb{P}$ indeed
satisfies the above condition for the 60-day exposures we consider, as it is
$\mathbb{P}(N_{\sigma})=(1-\Phi(N_{\sigma}))^{N_{\rm consec}}=2.5\times
10^{-9}$, where $\Phi(x)=\frac{1}{2}\bigg{(}1+{\rm erf}(x/\sqrt{2})\bigg{)}$
is the Gaussian cumulative distribution function (CDF) Bai and Orlofsky
(2019).

The minimum energy-averaged magnification required to detect microlensing
events at a given telescope, for count rates that are $n_{\sigma}\sigma_{B}$
away from the mean, is given as

$\bar{\mu}_{\rm
thresh}=\frac{1+N_{\sigma}\sigma_{B}/B}{1+n_{\sigma}\sigma_{B}/B}~{}.$ (8)

As we will see in Sec. III, a conservative and reasonable choice of
$n_{\sigma}$ is -1, which we will adopt. Variations in binning time $t_{\rm
bin}\to\widetilde{t}_{\rm bin}$ and bin counts $B\to\widetilde{B}$ can be
incorporated in Eq. (8) by the replacement
$\sigma_{B}/B\to(\sigma_{B}/B)/\sqrt{(\widetilde{B}/B)(\widetilde{t}_{\rm
bin}/t_{\rm bin})}$.

To justify our choices of $N_{\rm consec}$, $N_{\sigma}$ and $n_{\sigma}$
visually, we show in Figure 4 an 864-second sample, with $t_{\rm bin}$ = 0.1
sec, of the NICER-XTI data on SMC-X1 extracted using HEASoft v6.33.2 HEA  with
nicerl2 and nicerl3-lc pipelines. In this sample the mean $B=204.26$ cts/s,
which is indicated with a solid horizontal line, and the standard deviation
$\sigma_{B}=56.23$ cts/s; the 3$\sigma_{B}$ deviation from the mean is
indicated with a dashed horizontal line. Note that $\sqrt{Bt_{\rm bin}}=4.52$
is only slightly smaller than $\sigma_{B}t_{\rm bin}$, implying that the
assumption of Gaussian statistics is good and that intrinsic variability in
the count rate is small. The threshold magnification in Eq. (8) is then
$\bar{\mu}_{\rm thresh}=2.5$. We mark with red crosses bins that show 2
consecutive counts that are more than 3$\sigma_{B}$ from the mean. We find no
regions with 3 consecutive bins satisfying the criterion.

The count rate, and hence the threshold magnification in Eq. (8), is
determined by the source SED as well as the effective area of the detector.
For our proposed telescope X$\mu$, we assume an energy-dependent effective
area that is a combination of three parts: [i] for $E\in[0.2,50]$ keV we adopt
the $\mathcal{A}(E)$ of the Large Area Detector (LAD), to be used on STROBE-X
Ray  _et al._ (2019) and eXTP Feroci  _et al._ (2018); [ii] for $E\in[50,260]$
keV we take the $\mathcal{A}(E)$ profile of the cadmium zinc telluride “medium
energy” detector proposed to be used in Daksha Bhalerao  _et al._ (2022a);
*dakshabhalerao2022science, and scale the normalization up by a factor of 2,
[iii] for $E\in[260,980]$ keV we take the $\mathcal{A}(E)$ profile of the NaI
“high energy” detector of Daksha and again rescale by a factor of 2. The
energy-averaged detector area weighted by the source SED,
$\overline{\mathcal{A}}=\int_{E_{min}}^{E_{max}}dE\mathcal{F}(E)\mathcal{A}(E)/\int_{E_{min}}^{E_{max}}dE\mathcal{F}(E)$,
is 30.9 and 46.8 times bigger for STROBE-X and X$\mu$ respectively as compared
to NICER. Rescaling $\bar{\mu}_{\rm thresh}$ suitably by
$\sqrt{\overline{\mathcal{A}}}$ we obtain $\bar{\mu}_{\rm thresh}=1.21$ for
STROBE-X and $\bar{\mu}_{\rm thresh}=1.17$ for X$\mu$, which we use for
obtaining projections in Sec. III.

In selecting observation samples for analysis, care must be taken to remove
bins that are contaminated by x-ray flares and bursts, as well as atmospheric
backgrounds such as trapped electrons (TREL), precipitating electrons (PREL),
and low-energy electrons (LEEL) SCO . This may be done manually by visual
inspection for distinct rise-and-falls in photon counts, but to ascertain that
we are not discarding microlensing events, we also perform the following
procedure. Microlensing in the geometric optics regime (i.e., for PBHs larger
than the photonic wavelength) is achromatic: it produces source frequency-
independent magnification. We exploit this fact to look for similarities in
the light curve in two different energy windows for suspected flares or PREL
events. The bottom panel of Figure 4 shows an example of a suspected x-ray
flare in the SMC-X1 NICER data, with either panel displaying photon counts
with energies $>$ and $\leq$ 4 keV. (To obtain this plot we use information on
individual photon energies and detection timestamps, and then show the count
rate in 0.2 sec bins.) If this had been a microlensing event, these panels
would have looked alike, but they look extremely dissimilar. That the higher-
energy counts alone occur as an excess confirms that this event is indeed an
x-ray flare or burst.

A diagnostic like this serves not only to distinguish microlensing events from
background transients, but to also roughly inform us of the mass of the PBH
should a true microlensing event be observed. If the count rate vs time of a
suspected signal event corresponds to the characteristic shape of the light
curve expected from microlensing, and is seen to be identical – or more
practically, statistically consistent – in two or more energy windows, then we
may be sure that the transiting PBH is massive enough to be in the geometric
optics regime, where microlensing is indeed achromatic. The geometric vs wave
optics nature of microlensing may be further verified by extracting the lens
mass, at least broadly, by:

[i] comparing the event time scale with the lens transit time, roughly
2$r_{\rm E}$ divided by the transverse speed of dark matter. Equation (II.1)
gives $r_{\rm E}$ in terms of $M$ and $x$, if the dark matter speed is taken
as its typical value (about 200 km/s);

[ii] fitting the light curve to obtain the magnification, which contains
further information about $M$ and $x$ via Eq. (2).

The range of $x$ can be further narrowed to some $\mathcal{O}(0.1)$ value by
considering its probability distribution, which is the differential optical
depth $\pi r_{\rm E}^{2}(x)n_{\rm PBH}(x)dx$, where $n_{\rm PBH}$ is the PBH
number density along the line of sight to the source.

If the PBH mass is in the wave optics regime, confirmation of microlensing
would be unfortunately more complicated. This is because in this regime the
microlensing magnification is frequency-dependent, as discussed in Sec. II.1
and in, e.g., Refs. Nakamura and Deguchi (1999); Matsunaga and Yamamoto
(2006); Sugiyama  _et al._ (2020). An additional complication is that
magnifications are suppressed for impact parameters $y>w^{-1}$, as seen in
Sec. II.1. Also, the signal would be initially and finally achromatic during
the transit but chromatic when the lens is nearest to the source on the lens
plane. This may be seen from Eq. (5), where the sine term $\to 0$ for fast
oscillations. In this regime the detector energy resolution becomes important:
if it is smaller than the change in $w$ over which the magnification varies
appreciably for a suspected lens mass, chromatic microlensing may be measured.
Perhaps astrometric microlensing may lift the degeneracies discussed here, as
demonstrated for microlensing in optical frequencies Klüter  _et al._ (2020);
*astrometricmassOGLE:2022gdj, but this could be challenging for x-ray
microlensing due to uncertainties in pulsar emission and localization. We
leave the question of diagnosing microlensing signatures in the wave optics
regime to future investigation.

x-ray pulsar | net exposure (days) |  $D_{\rm S}$ (kpc) | ($\ell$, $b$) | $\sigma_{B}/B$
---|---|---|---|---
SMC X-1 | 1.74 | 64 Hilditch  _et al._ (2005) | $(300.41^{\circ},-43.56^{\circ})$ | 0.28
Cyg X-2 | 5.47 | 11 Ludlam  _et al._ (2022) | $(87.33^{\circ},-11.32^{\circ})$ | 0.02
Vela X-1 | 4.46 |  2 Vallenari  _et al._ (2023) | $(263.06^{\circ},3.93^{\circ})$ | 0.25
Crab pulsar | 4.76 |  2 Lin  _et al._ (2023) | $(184.56^{\circ},-5.78^{\circ})$ | 0.01
Table 1: X-ray pulsars in the NICER dataset NIC  with significant count rates
and small intrinsic variability $\sigma_{B}/B$, and the net telescope exposure
on them. Also given are their distances from Earth and location in Galactic
co-ordinates. Due to its distance SMC X-1 provides the greatest microlensing
optical depth, thereby dominating the total event rate. See Sec. III for
further details.

##  III Event rates and telescope sensitivities

Assuming that the PBH mass spectrum is monochromatic (i.e., that all PBHs have
a single mass), and that their velocities follow a Maxwell-Boltzmann
distribution, the differential rate of microlensing with respect to event
timescale $t_{\rm E}$ per source pulsar is given by Griest (1991)

$\displaystyle\frac{d\Gamma}{dt_{\rm E}}=$ $\displaystyle f_{\rm
PBH}\frac{2D_{\rm S}}{Mv^{2}_{0}}\int_{0}^{1}dx\rho_{\rm DM}(x)v_{\rm
E}^{4}(x)e^{-v_{\rm E}^{2}/v_{0}^{2}}\times$ (9)
$\displaystyle\int_{0}^{y_{\rm T}(x)}\frac{dy}{\sqrt{y_{\rm
T}^{2}-y^{2}}}\times\mathbb{P}(n_{\sigma})~{},$

where $v_{\rm E}\equiv 2r_{\rm E}\sqrt{y_{\rm T}^{2}-y^{2}}/t_{\rm E}$, with
$y_{\rm T}(x)$ the maximum impact parameter within which the magnification
$\geq\bar{\mu}_{\rm thresh}$ as illustrated in Fig. 3, $v_{0}$ is the halo
circular velocity $\simeq 240$ km/s, $f_{\rm PBH}$ is the mass fraction of
PBHs making up the dark matter density $\rho_{\rm DM}$, and
$\mathbb{P}(n_{\sigma})$ is the fraction of bins in the dataset with count
rate higher than $B+n_{\sigma}\sigma_{B}$ for 3 consecutive bins. We find that
$\mathbb{P}(-1)=0.596$ for a Gaussian CDF with $n_{\sigma}=-1$. (For
$n_{\sigma}=-2$ we have $\mathbb{P}(-2)=0.93$, which would be an aggressive
choice, and for $n_{\sigma}=0$ our event acceptance would be low with
$\mathbb{P}(0)=0.13$.) Note that in general the first integral in Eq. (9)
evaluates to non-zero values only up to some $x=x_{\rm max}$ since, as seen
from Fig. 3, $y_{\rm T}(x)\to 0$ above $x_{\rm max}$, thereby making the
second integral vanish.

We show results for two different spatial distributions of $\rho_{\rm DM}$,
ignoring the line-of-sight DM density in satellite galaxies (where some of our
pulsars are situated) as it contributes only about 10% to the event rate.
First we take the Einasto profile,

$\displaystyle\rho_{\rm Ein}(r)=\frac{M_{0}}{4\pi
r_{s}^{3}}e^{-(r/r_{s})^{\alpha}},$ (10) $\displaystyle
r=\sqrt{r_{\odot}^{2}+x^{2}D_{\rm S}^{2}-2r_{\odot}xD_{\rm S}\cos\ell\cos
b}~{},$

where $r_{\odot}=8.33$ kpc is the distance of the Sun from the Galactic
Center, and ($\ell$, $b$) are the Galactic co-ordinates of the source. Recent
studies Ou  _et al._ (2024) using photometry data from Gaia DR3, 2MASS and
WISE combined with SDSS-APOGEE DR17 spectra show that Milky Way circular
velocities for galactic radii $\leq$ 30 kpc are best fit by the above Einasto
profile with a normalization mass $M_{0}=6.2\times 10^{10}~{}M_{\odot}$, scale
radius $r_{s}=3.86$ kpc, and slope parameter $\alpha=0.91$, which we adopt. As
a cored Einasto profile is found to better fit the circular velocities
estimated in Ref. Ou  _et al._ (2024) than, say, a cuspy Navarro-Frenk-White
(NFW) profile, the virial mass of the Milky Way turns out to be smaller than
previous estimates, which is consistent with the findings of Refs. Jiao  _et
al._ (2023); Roche  _et al._ (2024) that use Gaia DR3 data at smaller galactic
radii. The upshot is that the use of Eq. (10) makes dark matter densities,
hence the microlensing optical depth, generally smaller than in earlier works
such as Refs. Niikura  _et al._ (2019); Croon  _et al._ (2020b, a).

Nevertheless, we also derive optimistic projections by assuming the NFW
profile,

$\rho_{\rm NFW}(r)=\frac{\rho_{0}}{(r/r_{s})(1+r/r_{s})^{2}}~{},$ (11)

to make direct comparisons with earlier literature and which may better
describe the Galactic halo in future and/or complementary data. To fix the
unknown parameters in Eq. (11), we [i] fix $\rho_{\odot}=0.44$ GeV/cm3 as the
dark matter density at the solar position as obtained from the best-fit of Eq.
(10); this ensures that dark matter densities at least near the Earth are
comparable in the two profiles we consider, [ii] take the mass of dark matter
within $r$ = 60 kpc as $4.7\times 10^{11}~{}M_{\odot}$ as estimated by the
SDSS survey in Ref. Xue  _et al._ (2008). These give $\rho_{0}=0.95$ GeV/cm3
and $r_{s}=11.46$ kpc. Other choices that fix NFW parameters, as well as the
best-fit generalized-NFW profile in Ref. Ou  _et al._ (2024), yield
constraints that are quite similar to those obtained with the best-fit Einasto
profile.

The total number of microlensing events expected in a telescope, summing over
pulsar targets labelled by $i$ with individual observation times $T^{i}_{\rm
obs}$, is now

$N_{\rm ev}=\sum_{i}T_{\rm obs}^{i}\int_{t_{{\rm min},i}}^{t_{{\rm
max},i}}dt_{\rm E}\frac{d\Gamma_{i}}{dt_{\rm E}}~{},$ (12)

where $t_{{\rm min},i}$ is the binning time (= 0.1 sec here) and $t_{{\rm
max},i}$ is the net exposure for the source $i$. These integration limits are
chosen as the shortest and longest timescales over which a microlensing event
can be observed at a telescope. Thus constraints on the unknowns $f_{\rm PBH}$
and $M$ may be derived by comparing $N_{\rm ev}$ with the observed number of
events under the no-PBH null hypothesis. For example, if zero events are
observed, using Poisson statistics the 90% C.L. limit can be obtained by
setting $N_{\rm ev}=2.3$. In practice, we evaluate the integral in Eq (12)
using the analytic form identified in the appendix of Ref. Croon  _et al._
(2020b).

###  III.1 Prescription for obtaining microlensing limits

Before we discuss our main results, let us first summarize the series of steps
for obtaining the constraints as described in the text up to this point.

(1) Select x-ray pulsar sources with high count rates, low intrinsic
variability, and possibly large distances to maximize the PBH microlensing
optical depth.

(2) Obtain data on count rate vs time and photon energies on the x-ray pulsar
sources, combining segments such as those in Fig. 4. Use appropriate data-
processing pipelines.

(3) Inspect the dataset for transient excesses. To verify them as non-
microlensing events, check the count rate in two or more different photon
energy windows such as in the bottom panel of Fig. 4.

(4) If the count rates in different energy windows are dissimilar, discard the
corresponding time bins. If they are similar, investigate further if the shape
of the light curve corresponds to a microlensing signature. Attempt to break
degeneracies in microlensing free parameters as discussed at the end of Sec.
II.2.

(5) From the subset of data with chromatic excesses removed, obtain the mean
and standard deviation of the count rate. Optimize choices of $N_{\rm
consec}$, $N_{\sigma}$ and $n_{\sigma}$. Then estimate the threshold
magnification $\bar{\mu}_{\rm thresh}$ from Eq. (8).

(6) Use this $\bar{\mu}_{\rm thresh}$, the effective area $\mathcal{A}(E)$ and
the source SED $\mathcal{F}(E)$ to obtain $y_{\rm T}$ vs $x$ from Eq. (2) as
in Fig. 3.

(7) Finally, use the microlensing event rate in Eq. (9) to estimate the total
number of events expected (Eq. (12)). Use appropriate statistics to report
limits at the desired confidence level.

###  III.2 Results

In Fig. 1 we display with dashed (dotted) curves the NFW (Einasto) profile 90%
C.L. limits obtained with current data at NICER, with effective area
$\mathcal{O}(10^{-2}-10^{-1})$ m2, on the pulsars listed in Table 1, after
removing transient excesses caused by flares, electron backgrounds, etc. These
pulsars were selected for the appreciable photon count rates they yielded at
NICER, bright as they are. Despite a somewhat lower exposure compared to Cyg
X-2, Vela X-1 and the Crab pulsar, the SMC X-1 pulsar dominates the net
microlensing event count in Eq. (12) due to its large distance from Earth that
results in a relatively high microlensing optical depth. From SMC X-1 count
rate data such as the sample in Fig. 4, using Eq. (8) we get the threshold
energy-averaged magnification $\bar{\mu}_{\rm thresh}=2.5$. We see that the
data accumulated so far at NICER could only set $f_{\rm PBH}<20$ in the mass
range of about $10^{-14}-10^{-13}~{}M_{\odot}$. If the exposure on SMC X-1
were increased to 60 days, we see that NICER can reach $f_{\rm PBH}=0.7$ for
$M=2\times 10^{-14}~{}M_{\odot}$ and can generally probe the mass range
$(1-5)\times 10^{-14}~{}M_{\odot}$ for $f_{\rm PBH}\leq 1$. Such an exposure
is justified by the enormous significance of the physics case here. We also
believe it is entirely feasible as this exposure is much less than that
obtained at NICER for some sources, e.g., 9–12 months Deneva  _et al._ (2019),
and comparable to that of other sources, e.g., PSR B1937+21, as seen in the
NICER data archive NIC .

We also show the 30-day reaches of future x-ray telescopes with effective
areas about an order of magnitude greater than that of NICER. For STROBE-X we
use SMC X-1 as the source. For X$\mu$ we assume a hard x-ray pulsar source
that is at $D_{\rm S}=64$ kpc, with intrinsic variability $\sigma_{B}/B$ that
of SMC X-1 (as in Table 1), and an energy spectrum that is the same as the
Crab pulsar Harding and Kalapotharakos (2017), which provides a flux orders of
magnitude higher than that of SMC X-1 for $10-1000$ keV energies. By placing
this source far away our count rate is $1/D_{\rm S}^{2}$-suppressed, but we
gain in microlensing optical depth. As mentioned below Eq. (6), these
telescopes can also probe photon energies higher than at NICER. We see in Fig.
1 that X$\mu$ could probe much smaller PBH masses than NICER, down to
$2.5\times 10^{-17}M_{\odot}$, while STROBE-X can reach down to about
$10^{-15}~{}M_{\odot}$. This is because these telescopes, by virtue of
detecting smaller x-ray wavelengths than NICER, can overcome the wave optics
effect and observe microlensing by smaller/lighter PBHs. Note that requiring
an excess over 3 consecutive 0.1 sec bins (as below Eq. (8)) implies requiring
a transit time across $r_{\rm E}$ of 0.3 sec, which is expected on average for
$M>10^{-15}~{}M_{\odot}$, whereas the X$\mu$ limits go to smaller lens masses.
This is possible by shrinking $t_{\rm bin}$ suitably which does not unduly
affect the counts per bin due to the large collecting power of the telescope,
nor the threshold magnification as per the discussion under Eq. (8). As such,
the microlensing event count may slightly increase if $t_{\rm min}$ in Eq.
(12) is set to the new $t_{\rm bin}$, but our X$\mu$ estimate uses $t_{\rm
min}=0.1$ sec and must be taken as a conservative projection.

STROBE-X and X$\mu$ also reach smaller $f_{\rm PBH}$ of $\mathcal{O}(0.1)$
than NICER with less run-time. This is due to their larger effective areas
that result in smaller threshold magnification, in turn giving greater event
rates as per Eq. (9). We see that the limits on $f_{\rm PBH}$ appear to be
proportional to $\sqrt{M}$ for large PBH masses. This may be broadly
understood as follows. The PBH velocities are roughly constant, so that the
only $M$-dependence in Eq. (9) is in the term outside the integrals. Since
$t_{\rm E}\propto\sqrt{M}$, Eq. (12) implies that $f_{\rm PBH}\propto\sqrt{M}$
for a fixed $N_{\rm ev}$. Our results may be compared with that of Ref. Bai
and Orlofsky (2019), which shows that with 300 days of exposure the future
eXTP satellite would reach down to $f_{\rm PBH}\simeq 0.1$, and Athena, Lynx
and AstroSat to $f_{\rm PBH}\simeq 0.3$. Shorter exposures such as we have
used will weaken the sensitivities of Ref. Bai and Orlofsky (2019)
proportionally.

##  IV Discussion and scope

In this work we have investigated the sensitivity of x-ray telescopes studying
x-ray pulsars to microlensing by sub-atomic size primordial black holes. Our
results are summarized in Figure 1. We have also described a spectral
diagnostic to confirm a microlensing signal in the geometric optics regime,
which can further be confirmed by measuring the timescale and magnification of
events. We re-emphasize that, while searches at the ongoing NICER and planned
STROBE-X telescopes would be definitely exciting, commissioning a new, large,
broadband x-ray satellite dedicated to gravitational microlensing surveys
would be even more worthwhile in light of the wealth of fundamental physics to
be mined.

X-ray microlensing in these telescopes would help to uncover not only point-
like lenses such as PBHs, but also, as mentioned in the Introduction, dark
matter in structures with extent comparable to the (point-like) Einstein
radius, which would produce non-trivial magnification curves. It may even be
possible to distinguish between the possibilities, such as microhalos of
various density distributions, boson stars, etc., via machine learning
techniques Crispim Romão and Croon (2024). Whatever be the type of lens, mass
functions other than the simple monochromatic one assumed here may be used to
set limits, such as done in Ref. Lehmann  _et al._ (2018);
*GortonMassFunc:2024cdm.

Our work is the first to point out that the PBH evaporation limit at around
$10^{-16}~{}M_{\odot}$, the lower end of the PBH mass window, may be probed
with a minimal microlensing setup involving hard x-ray pulsars; see Appendix B
for more sophisticated setups. But the PBH mass window itself may be wider
than previously supposed. If black hole evaporation, which has never been
observed, proceeds at a rate slower than Hawking’s prediction as may happen
via the memory burden effect Dvali  _et al._ (2020), then the extant limits on
PBH masses from evaporation (at $M\gtrsim 10^{-16}~{}M_{\odot}$ ) may be
greatly weakened Alexandre  _et al._ (2024). It is even possible that PBHs as
light as $10^{-28}-10^{-23}~{}M_{\odot}$ are allowed to comprise all the dark
matter Thoss  _et al._ (2024); *Dvali:2024hsb. To catch very light PBHs in
microlensing would require sources emitting photons with wavelengths even
smaller than x-rays. Perhaps gamma-ray pulsars shining copiously to give
sufficient statistics at such detectors as Fermi-LAT Smith  _et al._ (2023)
may be valuable. Even in the absence of evaporation-slowing effects, PBH
microlensing campaigns involving hard x-ray sources and gamma-ray pulsars
would be worthwhile: they automatically constrain non-PBH compact dark matter
structures that are smaller than the relevant Einstein radii. In this light
our X$\mu$ reach in Fig. 1 at low $M$ must be read by ignoring the evaporation
constraints.

All told, the time has come to coax dark matter out of one of its famed
hideouts.

## Acknowledgments

We are indebted to Paul Ray for key insights on the operation of NICER and
Abhisek Tamang for help with HeaSOFT. We further thank Varun Bhalerao,
Priyanka Gawade, Ranjan Laha, Surhud More, Suvodip Mukherjee, Avinash Kumar
Paladi, Akash Kumar Saha, Vibhor Kumar Singh, Abhishek Tiwari, Ujjwal Kumar
Upadhyay, Himanshu Verma, and Anna Watts for helpful discussion.

##  Appendix A Background material on microlensing

In this appendix we provide derivations for some formulae in Sec. II. For
detailed treatments of microlensing we refer the reader to Refs. Narayan and
Bartelmann (1996); Matsunaga and Yamamoto (2006).

We start with some generic notions. Consider the background metric
$g_{\mu\nu}$ with a gravitational potential $U$ due to a point-like lens,
given by

$ds^{2}\equiv g_{\mu\nu}dx^{\mu}dx^{\nu}=-(1+2U)dt^{2}+(1-2U)d\vec{r}^{2}~{}.$
(13)

As shown in Ref. Takahashi and Nakamura (2003), for $U\ll 1$ we can treat the
propagating degree of freedom of an electromagnetic wave as a massless scalar
field $\phi$ obeying

$\partial_{\mu}(\sqrt{-g}\hskip 2.84526ptg^{\mu\nu}\partial_{\nu}\phi)=0~{}.$
(14)

Setting $\phi(\vec{r},t)=\Phi(\vec{r})e^{-i\omega t}$, we get

$(\nabla^{2}+\omega^{2})\Phi(\vec{r})=4\omega^{2}U\Phi(\vec{r})~{}.$ (15)

We can now define an amplification factor in the frequency domain, $F$, as the
ratio of the solutions to Eq. (15) for non-zero and zero $U$, with the
magnification given by

$\mu(\omega,\vec{y})=|F(\omega,\vec{y})|^{2}$ (16)

for a source angular position $\vec{y}$ as defined below Eq. (II.1). Switching
variables to $w$ as defined in Eq. (4), we have Nakamura and Deguchi (1999)

$F(w,\vec{y})=\frac{w}{2\pi i}\int
d^{2}\vec{\rho}e^{iwT(\vec{\rho},\vec{y})}~{},$ (17)

where $T(\vec{\rho},\vec{y})$ is the time delay function

$T(\vec{\rho},\vec{y})=\frac{1}{2}|\vec{\rho}-\vec{y}|^{2}-\psi(\vec{\rho})$
(18)

for a dimensionless lensing potential $\psi(\vec{\rho})$. For a spherically
symmetric lens, $\psi(\vec{\rho})$ only depends on $\rho\equiv|\vec{\rho}|$.
Taking $\theta$ as the angle between $\vec{\rho}$ and $\vec{y}$, we now have

$F(w,y)=-iwe^{iwy^{2}/2}\int_{0}^{\infty}d\rho J_{0}(w\rho
y)xe^{iw(\frac{1}{2}\rho^{2}-\psi(\rho))}~{},$ (19)

where

$J_{0}(z)=\frac{1}{\pi}\int_{0}^{\pi}d\theta e^{iz\cos\theta}$ (20)

is the Bessel function of the first kind of zeroth order.

The lensing potential $\psi(\rho)$ is obtained by solving the convergence
equation Narayan and Bartelmann (1996)

$\vec{\nabla}^{2}_{\rho}\psi=2~{}\frac{\Sigma(\vec{\rho})}{\Sigma_{\rm
crit}}~{},$ (21)

where $\Sigma$ is a surface density obtained by projecting the lens’ density
onto the lens plane and $\Sigma_{\rm crit}\equiv c^{2}D_{\rm S}/(4\pi GD_{\rm
L}D_{\rm LS})$ is a critical mass density.

Point-like lenses. For lenses with extent $\ll r_{\rm E}$ such as PBHs,
$\psi(x)=\log x$, so that from Eqs. (16) and (19) and a bit of algebra, we
have

$\mu(w,y)=\frac{\pi w}{1-e^{-\pi
w}}\bigg{|}{}_{1}F_{1}\bigg{(}\frac{iw}{2},1;\frac{iwy^{2}}{2}\bigg{)}\bigg{|}^{2}~{},$
(22)

where we have used the relations

$\begin{split}\int_{0}^{\infty}x^{m}e^{-\alpha x^{2}}J_{n}(\beta
x)dx=\frac{\beta^{n}\Gamma(\frac{m+n+1}{2})}{2^{n+1}\alpha^{\frac{m+n+1}{2}}\Gamma(n+1)}\\\
\times{}_{1}F_{1}\bigg{(}\frac{m+n+1}{2},n+1;-\frac{\beta^{2}}{4\alpha}\bigg{)}~{},\end{split}$

and

$\Gamma(1+iy)\Gamma(1-iy)=\frac{\pi y}{\sinh(\pi y)}~{}.$

In the limit $y\rightarrow 0$, ${}_{1}F_{1}\rightarrow 1$ and we get the
maximum magnification during transit as

$\mu_{\rm max}=\frac{\pi w}{1-e^{-\pi w}}~{}.$

The effect of finite source size. To account for the finite extent of the
source, consider a Gaussian distribution of source intensity,

$W(\vec{y},\vec{r})=\exp\bigg{(}-\frac{|\vec{y}-\vec{r}|^{2}}{2a_{\rm
S}^{2}}\bigg{)}~{}.$ (23)

Then the intensity-averaged magnification

$\mu(w,y,a_{s})=\frac{\int d^{2}rW(y,r)\mu(w,r)}{\int d^{2}rW(y,r)}$ (24)

gives Eq. (3) under the assumption of circular symmetry, i.e., that $W$
depends only on $r\equiv|\vec{r}|$

##  Appendix B Other probes of the PBH mass window

We enumerate here alternative proposals in the literature to close the PBH
mass window.

[i] Interference fringes of the two microlensing images showing up as
modulations in the energy spectrum, a.k.a. “femtolensing”, with about 100 or
more gamma ray burst (GRB) sources in order to overcome the finite source
effect Katz  _et al._ (2018).

[ii] Differences in magnification as seen simultaneously by two observing
instruments separated by a finite distance, a.k.a. “parallax microlensing”
Nemiroff and Gould (1995); *Parallaxmicrolens1998. With more than 1000 GRBs,
the future Daksha system can probe the PBH mass window with one satellite each
orbiting the Earth and the Moon Gawade  _et al._ (2023).

[iii] Transits of light PBHs through the Solar System, estimated to occur
about once in a decade, may affect precision ephemerides Tran  _et al._
(2023).

[iv] Stellar capture of PBHs in dark matter-rich regions such as ultra-faint
dwarf galaxies, followed by the transmutation of the host star into a black
hole, suppresses the main sequence population in such regions Esser and
Tinyakov (2023); Esser  _et al._ (2024).

[v] Neutron star capture of PBHs followed by transmutation of the star into a
black hole Capela  _et al._ (2013). However, for this effect to be observable
the capture rate must be enhanced by large dark matter densities in nearby
regions. Globular clusters may provide one such setting as suggested in Ref.
Capela  _et al._ (2013), but the dark matter content of these systems is
highly uncertain for multiple reasons Garani  _et al._ (2023). In any case,
the PBHs are likely to end up in loosely bound orbits around the neutron star
and be disrupted by neighbouring stars in dense stellar environments Caiozzo
_et al._ (2024).

[vi] PBH transits of white dwarfs may deposit energy via dynamical friction
and trigger Type Ia-like supernovae Graham  _et al._ (2015), but the heating
of nuclear fuel may not occur faster than its cooling by various mechanisms in
sizeable portions of the star, making this an unobservable phenomenon for
$f_{\rm PBH}\leq 1$ Montero-Camacho  _et al._ (2019).

## References

  * Carr and Hawking (1974) B. J. Carr and S. W. Hawking, MNRAS 168, 399 (1974).
  * Khlopov (2010) M. Y. Khlopov, Res. Astron. Astrophys. 10, 495 (2010), arXiv:0801.0116 [astro-ph] .
  * Carr  _et al._ (2016) B. Carr, F. Kuhnel, and M. Sandstad, Phys. Rev. D 94, 083504 (2016), arXiv:1607.06077 [astro-ph.CO] .
  * Carr and Kuhnel (2020) B. Carr and F. Kuhnel, Ann. Rev. Nucl. Part. Sci. 70, 355 (2020), arXiv:2006.02838 [astro-ph.CO] .
  * Green and Kavanagh (2021) A. M. Green and B. J. Kavanagh, J. Phys. G 48, 043001 (2021), arXiv:2007.10722 [astro-ph.CO] .
  * Bai and Orlofsky (2019) Y. Bai and N. Orlofsky, Phys. Rev. D 99, 123019 (2019).
  * Croon  _et al._ (2020a) D. Croon, D. McKeen, N. Raj, and Z. Wang, Phys. Rev. D 102, 083021 (2020a), arXiv:2007.12697 [astro-ph.CO] .
  * Henriksen and Widrow (1995) R. N. Henriksen and L. M. Widrow, Astrophys. J. 441, 70 (1995), arXiv:astro-ph/9402002 [astro-ph] .
  * Fairbairn  _et al._ (2017) M. Fairbairn, D. J. E. Marsh, and J. Quevillon, Phys. Rev. Lett. 119, 021101 (2017), arXiv:1701.04787 [astro-ph.CO] .
  * Blinov  _et al._ (2020) N. Blinov, M. J. Dolan, and P. Draper, Physical Review D 101 (2020), 10.1103/physrevd.101.035002.
  * Croon  _et al._ (2020b) D. Croon, D. McKeen, and N. Raj, Phys. Rev. D 101, 083013 (2020b).
  * Bai  _et al._ (2020) Y. Bai, A. J. Long, and S. Lu, JCAP 09, 044 (2020), arXiv:2003.13182 [astro-ph.CO] .
  * Ansari  _et al._ (2024) A. Ansari, L. Singh Bhandari, and A. M. Thalapillil, Phys. Rev. D 109, 023003 (2024), arXiv:2302.11590 [hep-ph] .
  * Niikura  _et al._ (2019) H. Niikura, M. Takada, N. Yasuda, R. H. Lupton, T. Sumi, S. More, T. Kurita, S. Sugiyama, A. More, M. Oguri, and M. Chiba, Nature Astronomy 3, 524–534 (2019).
  * Smyth  _et al._ (2020) N. Smyth, S. Profumo, S. English, T. Jeltema, K. McKinnon, and P. Guhathakurta, Phys. Rev. D 101, 063005 (2020), arXiv:1910.01285 [astro-ph.CO] .
  * Ray  _et al._ (2019) P. S. Ray _et al._ (STROBE-X Science Working Group), (2019), arXiv:1903.03035 [astro-ph.IM] .
  * Wilson-Hodge and Ray (2016) C. A. Wilson-Hodge and e. a. Ray, Paul S., in  _Space Telescopes and Instrumentation 2016: Ultraviolet to Gamma Ray_, Society of Photo-Optical Instrumentation Engineers (SPIE) Conference Series, Vol. 9905, edited by J.-W. A. den Herder, T. Takahashi, and M. Bautz (2016) p. 99054Y, arXiv:1608.06258 [astro-ph.IM] .
  * Bhalerao  _et al._ (2022a) V. Bhalerao _et al._ , arXiv preprint arXiv:2211.12055 (2022a).
  * Bhalerao  _et al._ (2022b) V. Bhalerao _et al._ , arXiv preprint arXiv:2211.12052 (2022b).
  * Narayan and Bartelmann (1996) R. Narayan and M. Bartelmann, in  _13th Jerusalem Winter School in Theoretical Physics: Formation of Structure in the Universe_ (1996) arXiv:astro-ph/9606001 .
  * mpmath development team (2023) T. mpmath development team,  _mpmath: a Python library for arbitrary-precision floating-point arithmetic (version 1.3.0)_ (2023), http://mpmath.org/.
  * Nakamura and Deguchi (1999) T. T. Nakamura and S. Deguchi, Prog. Theor. Phys. Suppl. 133, 137 (1999).
  * Matsunaga and Yamamoto (2006) N. Matsunaga and K. Yamamoto, Journal of Cosmology and Astroparticle Physics 2006, 023–023 (2006).
  * Sugiyama  _et al._ (2020) S. Sugiyama, T. Kurita, and M. Takada, Mon. Not. Roy. Astron. Soc. 493, 3632 (2020), arXiv:1905.06066 [astro-ph.CO] .
  * Montero-Camacho  _et al._ (2019) P. Montero-Camacho, X. Fang, G. Vasquez, M. Silva, and C. M. Hirata, JCAP 08, 031 (2019), arXiv:1906.05950 [astro-ph.CO] .
  * Witt and Mao (1994) H. J. Witt and S. Mao, APJ 430, 505 (1994).
  * Neilsen  _et al._ (2004) J. M. Neilsen, R. C. Hickox, and S. D. Vrtilek, in  _American Astronomical Society Meeting Abstracts_ , American Astronomical Society Meeting Abstracts, Vol. 205 (2004) p. 102.10.
  * (28) “HEASARC tools,” https://heasarc.gsfc.nasa.gov/ftools/.
  * Feroci  _et al._ (2018) M. Feroci, M. Ahangarianabhari, G. Ambrosi, F. Ambrosino, A. Argan, M. Barbera, J. Bayer, P. Bellutti, B. Bertucci, G. Bertuccio, _et al._ , in  _Space Telescopes and Instrumentation 2018: Ultraviolet to Gamma Ray_ , Vol. 10699 (SPIE, 2018) pp. 281–295.
  * (30) “SCORPEON Background Model,” https://heasarc.gsfc.nasa.gov/docs/nicer/analysis_threads/scorpeon-overview/.
  * Klüter  _et al._ (2020) J. Klüter, U. Bastian, and J. Wambsganss, AAP 640, A83 (2020), arXiv:1911.02584 [astro-ph.IM] .
  * Sahu  _et al._ (2022) K. C. Sahu _et al._ (OGLE, MOA, PLANET, $\mu$FUN, MiNDSTEp Consortium, RoboNet), Astrophys. J. 933, 83 (2022), arXiv:2201.13296 [astro-ph.SR] .
  * Hilditch  _et al._ (2005) R. W. Hilditch, I. D. Howarth, and T. J. Harries, MNRAS 357, 304 (2005), arXiv:astro-ph/0411672 [astro-ph] .
  * Ludlam  _et al._ (2022) R. M. Ludlam _et al._ , Astrophys. J. 927, 112 (2022), arXiv:2201.11767 [astro-ph.HE] .
  * Vallenari  _et al._ (2023) A. Vallenari, A. G. Brown, T. Prusti, J. H. De Bruijne, F. Arenou, C. Babusiaux, M. Biermann, O. L. Creevey, C. Ducourant, D. W. Evans, _et al._ , Astronomy & Astrophysics 674, A1 (2023).
  * Lin  _et al._ (2023) R. Lin, M. H. van Kerkwijk, F. Kirsten, U.-L. Pen, and A. T. Deller, APJ 952, 161 (2023), arXiv:2306.01617 [astro-ph.HE] .
  * (37) “HEASARC tools,” https://heasarc.gsfc.nasa.gov/docs/nicer/nicer_archive.html.
  * Griest (1991) K. Griest, APJ 366, 412 (1991).
  * Ou  _et al._ (2024) X. Ou, A.-C. Eilers, L. Necib, and A. Frebel, MNRAS 528, 693 (2024), arXiv:2303.12838 [astro-ph.GA] .
  * Jiao  _et al._ (2023) Y. Jiao, F. Hammer, H. Wang, J. Wang, P. Amram, L. Chemin, and Y. Yang, Astron. Astrophys. 678, A208 (2023), arXiv:2309.00048 [astro-ph.GA] .
  * Roche  _et al._ (2024) C. Roche, L. Necib, T. Lin, X. Ou, and T. Nguyen, arXiv e-prints , arXiv:2402.00108 (2024), arXiv:2402.00108 [astro-ph.GA] .
  * Xue  _et al._ (2008) X. X. Xue _et al._ (SDSS), Astrophys. J. 684, 1143 (2008), arXiv:0801.1232 [astro-ph] .
  * Deneva  _et al._ (2019) J. S. Deneva _et al._ , Astrophys. J. 874, 160 (2019), arXiv:1902.07130 [astro-ph.HE] .
  * Harding and Kalapotharakos (2017) A. K. Harding and C. Kalapotharakos, arXiv preprint arXiv:1712.02406 (2017).
  * Crispim Romão and Croon (2024) M. Crispim Romão and D. Croon, (2024), arXiv:2402.00107 [astro-ph.CO] .
  * Lehmann  _et al._ (2018) B. V. Lehmann, S. Profumo, and J. Yant, JCAP 04, 007 (2018), arXiv:1801.00808 [astro-ph.CO] .
  * Gorton and Green (2024) M. Gorton and A. M. Green, (2024), arXiv:2403.03839 [astro-ph.CO] .
  * Dvali  _et al._ (2020) G. Dvali, L. Eisemann, M. Michel, and S. Zell, Phys. Rev. D 102, 103523 (2020), arXiv:2006.00011 [hep-th] .
  * Alexandre  _et al._ (2024) A. Alexandre, G. Dvali, and E. Koutsangelas, (2024), arXiv:2402.14069 [hep-ph] .
  * Thoss  _et al._ (2024) V. Thoss, A. Burkert, and K. Kohri, (2024), arXiv:2402.17823 [astro-ph.CO] .
  * Dvali  _et al._ (2024) G. Dvali, J. S. Valbuena-Bermúdez, and M. Zantedeschi, (2024), arXiv:2405.13117 [hep-th] .
  * Smith  _et al._ (2023) D. A. Smith _et al._ (Fermi-LAT), Astrophys. J. 958, 191 (2023), arXiv:2307.11132 [astro-ph.HE] .
  * Takahashi and Nakamura (2003) R. Takahashi and T. Nakamura, The Astrophysical Journal 595, 1039–1051 (2003).
  * Katz  _et al._ (2018) A. Katz, J. Kopp, S. Sibiryakov, and W. Xue, JCAP 12, 005 (2018), arXiv:1807.11495 [astro-ph.CO] .
  * Nemiroff and Gould (1995) R. J. Nemiroff and A. Gould, APJL 452, L111 (1995), arXiv:astro-ph/9505019 [astro-ph] .
  * Nemiroff (1998) R. J. Nemiroff, APSS 259, 309 (1998), arXiv:astro-ph/9806012 [astro-ph] .
  * Gawade  _et al._ (2023) P. Gawade, S. More, and V. Bhalerao, Mon. Not. Roy. Astron. Soc. 527, 3306 (2023), arXiv:2308.01775 [astro-ph.CO] .
  * Tran  _et al._ (2023) T. X. Tran, S. R. Geller, B. V. Lehmann, and D. I. Kaiser, (2023), arXiv:2312.17217 [astro-ph.CO] .
  * Esser and Tinyakov (2023) N. Esser and P. Tinyakov, Phys. Rev. D 107, 103052 (2023), arXiv:2207.07412 [astro-ph.HE] .
  * Esser  _et al._ (2024) N. Esser, S. De Rijcke, and P. Tinyakov, Mon. Not. Roy. Astron. Soc. 529, 32 (2024), arXiv:2311.12658 [astro-ph.GA] .
  * Capela  _et al._ (2013) F. Capela, M. Pshirkov, and P. Tinyakov, Phys. Rev. D 87, 123524 (2013), arXiv:1301.4984 [astro-ph.CO] .
  * Garani  _et al._ (2023) R. Garani, N. Raj, and J. Reynoso-Cordova, JCAP 07, 038 (2023), arXiv:2303.18009 [astro-ph.HE] .
  * Caiozzo  _et al._ (2024) R. Caiozzo, G. Bertone, and F. Kühnel, (2024), arXiv:2404.08057 [astro-ph.HE] .
  * Graham  _et al._ (2015) P. W. Graham, S. Rajendran, and J. Varela, Phys. Rev. D 92, 063007 (2015), arXiv:1505.04444 [hep-ph] .