#  Classifiers are Better Experts for Controllable Text Generation

Askhat Sitdikov , Nikita Balagansky11footnotemark: 1 , Daniil Gavrilov and
Alexander Markov
Tinkoff
{ext.asitdikov, n.n.balaganskiy, d.gavrilov<EMAIL_ADDRESS>Equal
contribution.

###### Abstract

This paper proposes a simple method for controllable text generation based on
weighting logits with a free-form classifier, namely CAIF sampling. Using an
arbitrary text classifier, we adjust a small part of a language model’s logits
and guide text generation towards or away from classifier prediction.

We experimented with toxicity avoidance and sentiment control tasks and showed
that the proposed method significantly outperforms recent PPLM, GeDi, and
DExperts on PPL and task accuracy metrics based on the external classifier of
generated texts. In addition, compared to other approaches, it is easier to
implement and tune and has significantly fewer restrictions and requirements.

##  1 Introduction

Neural text generation is an important part of many NLP pipelines, such as
those for dialog generation and question answering. However, the application
of these models can be difficult without control over a Language Model (LM).
For example, in order to apply a natural dialogue generation system, the model
must not produce toxic or harmful texts.

One common way to control an LM is to guide its sampling process using a
classifier to sample texts with desired properties (e.g., reduced toxicity).
While PPLM (Dathathri et al., 2020) uses an arbitrary text classifier to
control an LM, most recent methods (Krause et al., 2020; Liu et al., 2021)
rely on a classifier induced by LM conditioned on a certain topic Keskar et
al. (2019).

In this paper, we propose Classifier guided sampling (CAIF): a simple method
for controllable text generation based on Bayesian re-weighting of LM logits
using an external classifier. Unlike GeDi and DExperts, CAIF relies on a free-
form classifier while being significantly easier to apply than PPLM.

There are two reasons why we consider using a free-form classifier for guiding
LMs fascinating.

The trivial reason is that this approach allows us to more easily perform
controllable generation, since finding an existing arbitrary text classifier
is much easier than a conditional LM. While a wide range of publicly available
classifiers could be used to guide an LM, finding a conditional LM could be
more challenging. When this paper was written, if one searches for a text
classifier model with Hugging Face, then approximately $10$ thousand model
could be accessed. Though no $10$k topics are available, and some of these
models could even be trained on the same datasets, it still provides
alternatives to guide the model. At the same time, only $23$ conditional
language models could be found with search prompt topic. Even if some other
search prompts could provide some extra conditional language models, these
rough statistics represent the situation with the availability of text
classifiers and conditional LMs.

Figure 1: A schematic view of CAIF sampling. Having a probability distribution
on tokens (with the total number of tokens equal to the size of vocabulary
$|V|$), we select top-$j$ tokens to apply a classifier. We then add the
logarithms of probabilities obtained from the classifier weighted by
$\alpha\in\mathbb{R}$ to the logarithms of token probabilities and then select
the top-$k$ tokens in order to sample the next token. Note that $k<j<<|V|$.

The second reason can be considered more controversial. The wide adoption and
success of both GeDi and DExperts (Krause et al., 2020; Liu et al., 2021)
could make one assume that it is related to induced classifiers $\hat{p}(c|x)$
being capable of generalizing better due to their dependency on a smaller
language model. With CAIF sampling we are answering the question of whether it
is really necessary to apply a smaller LM to perform conditional text
generation, or if it is enough to use a free-form classifier.

We experimented with the proposed approach and found that this simple method
allowed us to significantly outperform recent detoxification approaches
measured by perplexity (PPL) and sentiment accuracy. In addition, we explored
the periodicity of applying a guiding mechanism. We showed that, while all
recent methods guide an LM at each step, it is possible to guide a model
depending on the entropy of an LM outputs’ distribution. In order to get
further insights into CAIF’s limits, we explored its hyperparameters and
showed that the range of the sampling weight hyperparameter could be extended
to $\mathbb{R}$, while previous works only used positive weight values.

##  2 Recent Works

Keskar et al. (2019) proposed to train an LM on conditioned data, so that
generation could be controlled by selecting a condition (CTRL). However, it is
important to consider that such a mechanism would require re-training the
whole model in order to add new guiding topics.

Dathathri et al. (2020) proposed PPLM, which uses an external classifier as a
target for optimization of hidden states during the inference process. While
PPLM seems easy to implement, it hides a huge amount of haziness in the
details. E.g., it is unclear whether it is necessary to optimize all hidden
states in temporary dimensions.

GeDi (Krause et al., 2020) used an external LM with the desired topic or
intent as a classifier for re-weighting next token probabilities. Liu et al.
(2021) proposed DExperts, a sampling mechanism based on using two extra LMs
conditioned towards and against the desired topic, which is used to reweight
the probabilities of the next tokens. We argue that these methods can also be
considered impractical. DExperts requires two additional LMs that are
conditioned on positive and negative sentiments to perform controllable
sampling, and GeDi uses an external conditioned LM as a classifier to perform
re-weighting of LM logits.

Yang and Klein (2021) explored the usage of a text classifier for controllable
text generation with FUDGE. Although, FUDGE omitted the usage of
hyperparameters used to control the strength of guiding (which we observed to
be crucial for the conditional generation with CAIF in later sections).
Furthermore, Yang and Klein (2021) had not used a free-form classifier since
they explored the use of classifiers trained to perform inference with
truncated sequences that occur during text generation.

Figure 2: An example of entropy values across different tokens for a text
prompt. Empirically, tokens at positions where LM outputs with low entropy,
have a small impact on the semantics of text. Thus, one could perform a step
of controllable text generation only for such LM outputs, in which entropy is
larger than a threshold value. See Section 4.2.2 for details.

##  3 Background

Controllable text generation could be seen as modeling a conditional text
probability:

$p(x|c)=\prod_{i}^{n}p(x_{i}|x_{<i},c),$ (1)

where $c$ is an arbitrary condition (e.g., a topic or intent). If there is
enough data for each necessary condition, training such a model from scratch
is trivial. However, if that is not the case, training a well-performing LM
may become difficult. A possible solution to this problem is inference-time
controllable generation, which aims to adjust an unconditional $p(x)$ towards
a conditional $p(x|c)$.

The most straightforward solution for inference-time control over an LM is re-
weighting its logits using Bayesian inference in order to obtain a conditional
$p(x_{i}|x_{<i},c)$ out of unconditional $p(x_{i}|x_{<i})$ and an arbitrary
classifier $p(c|x)$, as follows:

$p(x_{i}|x_{<i},c)\propto p(x_{i}|x_{<i})p(c|x_{\leq i})^{\alpha},$ (2)

where $\alpha$ is a hyperparameter modifying the importance of the classifier
during sampling.

Sampling from such a model requires applying the classifier $p(c|x_{\leq i})$
during sampling at each step for each new possible token. In general cases,
this significantly reduces the speed of this method’s naive application.

In order to overcome the problem of speed, Krause et al. (2020) proposed to
use a conditioned LM. In their method, a small conditional LM
$\hat{p}(x_{i}|x_{<i},c)$ is inverted using Bayesian inference to obtain
$\hat{p}(c|x_{\leq i})$, which is induced from an LM classifier and produces
classification probabilities for all tokens at one step. Furthermore, it is
possible to cache hidden states of $\hat{p}(x_{i}|x_{<i},c)$ during sampling
to increase inference speed even further.

However, as we noted in Section 1, dependency on an external conditional LM
$\hat{p}(x|c)$ could be too harsh of a requirement to follow in practice.
Thus, we propose exploring using free-form classifiers to guide an LM.

##  4 CAIF Sampling

###  4.1 Proposed Method

We argue that guiding an LM with a classifier $\hat{p}(c|x)$ induced from a
smaller conditional LM $\hat{p}(x|c)$ is mostly done to improve inference
speed. Thus, if we want to perform a controllable text generation with a free-
form classifier, it is necessary to improve generation speed.

As we noted in Section 3, the main complexity of applying an arbitrary
classifier is inevitable to evaluate class probability $p(c|x_{\leq
i})\triangleq p(c|x_{<i},x_{i})$ for each possible token $x_{i}$ at $i$-th
position if we want to evaluate full $p(x_{i}|x_{<i},c)$. Because the
vocabulary size $|V|$ could easily reach tens of thousands of tokens, such a
task would require an enormous amount of computations to sample a sequence.

This paper proposes simplifying re-weighting probabilities for controllable
text generation by truncating the set of classified tokens. This idea is based
on the observation that, while it is necessary to evaluate $p(c|x_{\leq i})$
for each token in vocabulary, sampling strategies (e.g., top-k sampling) will
truncate most tokens with the lowest probabilities $p(x_{i}|x_{<i},c)$.
Therefore, some tokens with low probability $p(x_{i}|x_{<i})$ are not going to
be considered for sampling even after weighting with large $p(c|x_{\leq i})$,
and thus can be omitted from classification.

Based on this heuristic, we propose CAIF sampling. During the sampling
procedure, we use only $j$ tokens with the highest probability of being the
next token $p(x_{i}|x_{<i})$ to evaluate a classifier on. Then, these top-$j$
tokens are reweighted and used for top-$k$ sampling. Note that here,
$k<j<<|V|$. See Figure 1 for a schematic view of the proposed algorithm. We
observed that $j$ could be considered small, as it does not exceed $100$
tokens for classification during our experiments.

###  4.2 Further Speeding Up CAIF

While reducing the number of classified sequences during the sampling
procedure dramatically improves inference speed, one could go even further. We
could choose to re-weight LM logits for some specific steps instead of the
entirety of the generation process. In the following subsections, we will
describe possible approaches to doing so.

####  4.2.1 Periodic Criterion for CAIF

While the straightforward way of performing CAIF sampling is to apply a
classifier at each generation step, it is possible to alternate CAIF sampling
with plain sampling.

More formally, we define CAIF sampling with period-$p$ as a generation
strategy, where we adjust token probabilities at every $p$-th step. From this
perspective, plain CAIF sampling could be seen as sampling with a period-$1$.

However, such a criterion could be seen as too harsh. There is no clear
intuition behind applying CAIF periodically. Even if we were to sample a
sequence with period-$2$ and guide the generation towards non-toxic texts, a
model could still produce a toxic token at every $2$-nd step when CAIF is not
applied.

####  4.2.2 Entropy Criterion for CAIF

Meister et al. (2022) hypothesized that the entropy of token probabilities
represents the importance of the next token in the text. More concretely, if
the entropy is low, then the next token in the sequence has a utilitarian role
and vice versa. See Figure 2 for an example of entropy values produced by
GPT-2 Large for a text prompt.

From such a perspective, we could define CAIF sampling with entropy-$e$, where
$e$ is a threshold entropy value. For this method, we only apply CAIF at such
steps if the prediction entropy is greater than the threshold value.

Note that, similar to Periodic CAIF, plain CAIF can be seen as CAIF with
entropy-$0$.

##  5 Experiments

###  5.1 Experimental Setup

####  5.1.1 Toxicity Avoidance with RealToxicityPrompts Dataset

We followed the experimental setup of Liu et al. (2021) in our experiments and
used 10k non-toxic prompts from the RealToxicityPrompts dataset (Gehman et
al., 2020) to evaluate the ability of the proposed method to avoid toxicity in
samples.

We sampled $25$ continuations for $10$k non-toxic prompts and evaluated the
samplings’ PPL and its diversity as the number of distinct $n$-grams
normalized by the length of generated sequences.

((a))

((b))

((c))

((d))

Figure 3: (a) A comparison of $-\log(x)$ and $\log(1-x)$ scores which could be
used for detoxification with the classifier producing the toxicity probability
$x$. For this plot, we used a fixed value of $\alpha=1$. Note that $-\log(x)$
reduces quickly and assigns relatively low scores for $x>0.2$, while
$\log(1-x)$ remains almost unchanged for $x<0.4$. (b) A comparison of negative
$\alpha$ with inverse probability sampling mechanisms. We report $\alpha$
values next to the plots. (c-d) A comparison of different $\alpha$ values with
binned prompts from the RealToxicityPrompts Dataset with mean toxicity and
toxicity probability metrics. See Section 5.2 for more details.

We also evaluated the average mean and max toxicity level, alongside the
empirical probability of occurrence of at least one negative sequence across
$25$ samplings for each prompt. To evaluate the toxicity of generated
sequences, we used the cardiffnlp/twitter-roberta-base-offensive
classifier111https://huggingface.co/cardiffnlp/twitter-roberta-base-offensive
(Barbieri et al., 2020). To evaluate the perplexity of the sampled sequences,
we used a pre-trained GPT-2 XL (Radford et al., 2019). Following Liu et al.
(2021), we evaluated the toxicity metric only for the generated part of
sequences, omitting prompts.

As a base model for our experiments, we used GPT-2 Large, for which we applied
different methods of controllable generation. For CAIF guiding we used the
unitary/toxic-bert222https://huggingface.co/unitary/toxic-bert classifier.

Also note that RealToxicityPrompts provides the labeling of toxicity levels
for prompts in the dataset. With such labeling, we can divide the dataset into
bins and evaluate baselines for each bin separately.

####  5.1.2 Sentiment Control with OpenWebText Corpus

Following Liu et al. (2021), we used 5k neutral prompts and 2.5k negative
prompts from OpenWebText Corpus333Liu et al. (2021), as well as experimented
with positive prompts guided towards a negative sentiment. However, this
experiment was omitted from this paper due to possible concerns regarding its
practicality and ethics..

We used the mean percentage of positive samplings across all prompts as a
metric for this experiment, as well as the PPL of samplings. To evaluate the
positiveness of samplings, we applied distilbert-base-uncased-finetuned-
sst-2-english444https://huggingface.co/distilbert-base-uncased-finetuned-
sst-2-english classifier. As for toxicity avoidance, we followed the setup
from Liu et al. (2021) and evaluated the sentiment of samplings on both
prompts and continuations.

Following the experimental setup with Toxicity Avoidance (see Section 5.1.1),
we used GPT-2 Large as the model for generation and the cardiffnlp/twitter-
roberta-base-sentiment555https://huggingface.co/cardiffnlp/twitter-roberta-
base-sentiment classifier (Barbieri et al., 2020) to guide CAIF.

###  5.2 Selection of $\alpha$

While Krause et al. (2020) only used $\alpha\geq 1$, we observed that we could
use any $\alpha\in\mathbb{R}$. Suppose that we have a toxicity classifier
which provides higher logit values as the input text increases in toxicity. In
this case, the natural way to manage detoxification is to weight LM outputs at
the $i$-th step with $\Big{(}1-p(c|x_{\leq i})\Big{)}^{\alpha}$ and $\alpha>0$
(namely, inverse probability weighting). However, we observed that its
possible to perform weighting with $p(c|x_{\leq i})^{\alpha}$ and $\alpha<0$
in order to reduce the toxicity of generated samples (negative $\alpha$).

Both $-\alpha\log(x)$ and $\alpha\log(1-x)$ are decreasing functions on
$x\in(0;1)$ if $\alpha>0$, which means that the highest score of importance
sampling will be obtained when toxicity probability is at its lowest. However,
a score obtained from a $-\alpha\log(x)$ dramatically reduces with a small
increase of $x$, while $\alpha\log(1-x)$ remains almost unchanged until a
large value of $x$ is reached. See Figure 3(a) for details.

We compared both of these detoxification approaches on the RealToxicityPrompts
Dataset. We used CAIF sampling with a period-$1$ and top-$j=100$ for both
models and limited the dataset size to $1$k non-toxic prompts. See Figure 3(b)
for the comparison of negative $\alpha$ and inverse probability weighting. We
observed that negative $\alpha$ showed a significantly better detoxification
level while having better PPL values. As a result, instead of inverse
probability, we used a negative $\alpha$ value in all further experiments for
both toxicity avoidance and sentiment control tasks.

We also explored different values of $\alpha$. For this experiment, we used
toxicity labels provided with the RealToxicityPrompt Dataset and evaluated
CAIF using different toxicity levels of text prompts. See Figure 3 (c-d) for
the results. We observed that CAIF, compared to plain sampling, drastically
reduces the probability of toxic samples occurring, while higher absolute
values of $\alpha$ avoid toxicity in samples better.

((a))

((b))

((c))

((d))

Figure 4: (a) A comparison between periodic and entropy CAIF samplings with
the comparable proportion of guided steps for the toxicity avoidance task. We
report $\alpha$ values next to the plots. (b-c) A comparison of periodic CAIF
with entropy CAIF samplings on the toxicity avoidance task. We report $\alpha$
values next to the plots. See more details in Section 5.3. (d) A comparison of
CAIF sampling with DExperts with binned prompts from RealToxicityPrompts
Datasets and toxicity probability metric. We also report PPL across samplings
for each bin on the plots. See Section 5.4 for more details.

###  5.3 Understanding the Period of CAIF

We compared plain CAIF sampling with Periodic CAIF and Entropy CAIF on the
toxicity avoidance task with 1k prompts. For this experiment, we selected such
periods $p$ and entropy thresholds $e$ that the proportion of guided steps
would be comparable (see Section 5.6 for a detailed experiment with sampling
speed). While the evaluation of this proportion is trivial for periodic CAIF
(period-$2$ corresponds to 50$\%$ of guided tokens), for entropy CAIF, we
evaluated empiric CDF of entropy across model outputs (see Appendix Figure 7).
Based on this CDF, we could compare periods $2$ and $5$ with entropy of $3.2$
and $5.0$, which is 50$\%$ and 20$\%$ of guided steps compared to unguided
ones. See Figure 4(a) for the results. We observed that entropy CAIF performed
marginally better than the periodic criterion measured by both PPL and
toxicity probability metrics. See Figures 4(b-c) to view a broader range of
periods and entropy thresholds. For these, we observed that entropy CAIF could
perform with negligible performance loss compared to plain CAIF on the
toxicity avoidance task.

Sampling | PPL $\downarrow$ | mean tox. $\downarrow$ | max tox. $\downarrow$ | tox. prob. $\downarrow$ | dist 1 $\uparrow$ | dist 2 $\uparrow$ | dist 3 $\uparrow$
---|---|---|---|---|---|---|---
GPT-2 | 25.5 | 18.2 | 47.5 | 43.1 | 57.9 | 85.2 | 85.2
PPLM | 32.6 | 17.7 | 45.9 | 40.0 | 58.4 | 85.5 | 85.5
GeDi | 60.0 | 13.7 | 32.2 | 11.2 | 61.5 | 83.9 | 82.7
DExperts | 32.4 | 13.9 | 29.7 | 7.5 | 58.0 | 84.0 | 84.1
DExperts (top-k) | 20.2 | 13.3 | 27.9 | 6.4 | 52.9 | 80.4 | 82.5
CAIF (our) | 15.0 | 12.0 | 26.1 | 3.3 | 51.5 | 81.2 | 84.1

Table 1: Results on the toxicity avoidance task for $10$k non-toxic prompts.
See Section 5.4 for more details.

###  5.4 Toxicity Avoidance

We compared CAIF sampling with PPLM, GeDi, and DExperts approaches on the
toxicity avoidance task, for which we guided models towards low toxicity
values (see Section 5.1.1 for details of experimental setup).

For CAIF sampling, we used top-$k=20$, top-$j=100$, $\alpha=-5.0$. For other
baselines, we used top-$p$ sampling with $p=0.9$ (Holtzman et al., 2020). We
also experimented with top-$k=20$ on DExperts for consistency of comparison
with CAIF, which is designed to work with top-$k$ sampling.

See Table 1 for the results from non-toxic prompts, and Appendix Table 2 for
the sample generations. We observed that CAIF performed dramatically better
than other baselines. We obtained a significantly lower toxicity level on all
metrics while having lower PPL than other baselines. Although CAIF showed
slightly worse results on $n$-gram repetition metrics because top-$k$ sampling
was used, the loss in repetition is not dramatic when taking into account the
gain in perplexity and toxicity.

We also compared CAIF sampling to the DExperts method with binned prompts from
RealToxicityPrompts Dataset (see Figure 4(d)). We observed that CAIF
outperformed DExperts for bins with toxicity $<0.75$. While DExperts showed
lower toxicity probability for more toxic prompts, it also dramatically
increased the PPL of samplings for such bins.

((a))

((b))

((c))

Figure 5: Inference speed comparison of (a) CAIF and other related methods,
among different CAIF periods (b) and entropy thresholds (c).

((a))

((b))

((c))

((d))

Figure 6: (a-b) Sentiment control on negative and neutral prompt results.
(c-d) A comparison of CAIF sampling with the Entropy CAIF criterion on
sentiment control task for negative and neutral prompts. We omitted $\alpha$
values on these plots for visibility. Each dot represents
$\alpha\in[-1,-2,-3,-5,-7,-10,-15,-20,-30,-40]$ for entropy thresholds $3.0$
and $5.0$, and $\alpha\in[-1,-2,-3,-5,-7,-10]$ for thresholds $0.5$ and $0.0$
from left to right. Threshold value $0$ represents plain CAIF. See section 5.5
for more details.

###  5.5 Sentiment Control

We compared CAIF with PPLM, GeDi, and DExperts on the sentiment control task
(see Section 5.1.2 for details of the experimental setup).

See Figures 6(a-b) for the results. As for toxicity avoidance, CAIF performed
dramatically better on both negative and neutral prompts, showing higher
values of positiveness for samplings while having lower perplexity.

In addition, Figures 6(c-d) show a comparison of plain CAIF sampling with
entropy CAIF on sentiment control. We observed that entropy CAIF, even with
large entropy threshold values, performed comparable to plain CAIF (e.g, for
neutral prompts, entropy-$3.2$ produced the same results as plain CAIF, even
while using larger values of $\alpha$) or even outperformed it (for negative
prompts, entropy-$3.2$ performed better than plain CAIF). These results are
notable since only half of the performed steps were guided with a classifier
for CAIF with entropy-$3.2$.

###  5.6 Sampling Speed

We evaluated the time necessary to sample a sequence with NVidia V100 GPU, a
batch size equal to $1$ and sequence lengths in the range
$n\in[10,20,50,100]$. We compared CAIF with DExperts and GeDi approaches, for
which we used the official implementation of evaluation. For CAIF, we used
sampling with top-$j$ = 100 and top-$k$ = 20 (Fan et al., 2018), while for
DExperts, we used filter-$p$ = 0.9 and top-$k$ = 20. For each method, we
report the mean value of wall-clock sampling time across $100$ runs.

See Figure 5(a) for the results. We observed that CAIF is comparable to other
controllable generation methods in terms of speed for small sequence lengths
(i.e., $n\leq 50$). For short sequences ($n\leq 20$), CAIF performed faster
than other baselines. Note that with the growth of sequence length, CAIF
requires more time to evaluate since using a free-form classifier requires
$\mathbb{O}(n^{2})$ time at each evaluation step. At the same time, GeDi and
DExperts require only $\mathbb{O}(n)$ steps to evaluate thanks to caching used
in induced LM classifiers. See Figures 5(b-c) for the evaluation results of
periodic and entropy CAIF samplings.

##  6 Conclusion & Future Work

In this paper, we proposed a simple method of importance sampling
approximation for controllable text generation. CAIF sampling showed
dramatically better results than related approaches for toxicity avoidance and
sentiment control tasks measured by PPL and task accuracy of samples.

We also performed a study of hyperparameters used in CAIF sampling and showed
that weight $\alpha$ used for importance sampling could be drawn from
$\mathbb{R}$ and not the previously used values of $\alpha\geq 1$.

In practical tasks (e.g., when a dialogue model is used), CAIF sampling is
slower than other related methods, as several response candidates are
generated and then filtered by a sentiment classifier to produce only positive
responses. At the same time, a plug-and-play method for controllable
generation allows us to develop a pipeline where no post-processing of samples
is necessary, dramatically reducing the number of candidates that are
necessary to sample. This shows the importance of PPL and toxicity level
metrics of the method and the relative unimportance of sampling speed.

In this paper, we proposed two approaches for speeding up CAIF: Periodic and
Entropy CAIF criteria, for which we alternate steps of plain sampling with
guided sampling steps. We believe that CAIF could further benefit from new
criterions of application.

## References

  * Barbieri et al. (2020) Francesco Barbieri, Jose Camacho-Collados, Luis Espinosa Anke, and Leonardo Neves. 2020.  TweetEval: Unified benchmark and comparative evaluation for tweet classification.  In _Findings of the Association for Computational Linguistics: EMNLP 2020_ , pages 1644–1650, Online. Association for Computational Linguistics.
  * Dathathri et al. (2020) Sumanth Dathathri, Andrea Madotto, Janice Lan, Jane Hung, Eric Frank, Piero Molino, Jason Yosinski, and Rosanne Liu. 2020.  Plug and play language models: A simple approach to controlled text generation.  In _International Conference on Learning Representations_.
  * Fan et al. (2018) Angela Fan, Mike Lewis, and Yann Dauphin. 2018.  Hierarchical neural story generation.  pages 889–898.
  * Gehman et al. (2020) Samuel Gehman, Suchin Gururangan, Maarten Sap, Yejin Choi, and Noah A. Smith. 2020\.  RealToxicityPrompts: Evaluating neural toxic degeneration in language models.  In _Findings of the Association for Computational Linguistics: EMNLP 2020_ , pages 3356–3369, Online. Association for Computational Linguistics.
  * Holtzman et al. (2020) Ari Holtzman, Jan Buys, Li Du, Maxwell Forbes, and Yejin Choi. 2020.  The curious case of neural text degeneration.  In _International Conference on Learning Representations_.
  * Keskar et al. (2019) Nitish Shirish Keskar, Bryan McCann, Lav Varshney, Caiming Xiong, and Richard Socher. 2019.  CTRL - A Conditional Transformer Language Model for Controllable Generation.  _arXiv preprint arXiv:1909.05858_.
  * Krause et al. (2020) Ben Krause, Akhilesh Deepak Gotmare, Bryan McCann, Nitish Shirish Keskar, Shafiq Joty, Richard Socher, and Nazneen Fatema Rajani. 2020.  GeDi: Generative Discriminator Guided Sequence Generation.  _arXiv preprint arXiv:2009.06367_.
  * Liu et al. (2021) Alisa Liu, Maarten Sap, Ximing Lu, Swabha Swayamdipta, Chandra Bhagavatula, Noah A. Smith, and Yejin Choi. 2021.  DExperts: Decoding-time controlled text generation with experts and anti-experts.  In _Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers)_ , pages 6691–6706, Online. Association for Computational Linguistics.
  * Meister et al. (2022) Clara Meister, Tiago Pimentel, Gian Wiher, and Ryan Cotterell. 2022.  Typical Decoding for Natural Language Generation.  _arXiv:2202.00666_.
  * Radford et al. (2019) Alec Radford, Jeff Wu, Rewon Child, David Luan, Dario Amodei, and Ilya Sutskever. 2019.  Language models are unsupervised multitask learners.
  * Yang and Klein (2021) Kevin Yang and Dan Klein. 2021.  FUDGE: Controlled text generation with future discriminators.  In _Proceedings of the 2021 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies_ , pages 3511–3535, Online. Association for Computational Linguistics.

((a))

((b))

Figure 7: Empirical PDF (a) and CDF (b) of entropy values across generations
evaluated with GPT-2 and top-k sampling on non-toxic prompts from OpenWebText
Corpus. We used this CDF to roughly evaluate the proportion of guided and
unguided steps for Entropy CAIF (see Section 5.3).

##  Appendix A Example Samples

$\alpha$ | Samples
---|---
The suspect in Tuesday’s downtown terror attack
$0$ |  is a former Toronto police officer and has a long history of ties to white supremacy groups.
$-3$ |  was arrested on Wednesday at the airport following a shootout at an apartment complex just blocks from the venue where
$-3$ |  surrendered after an hours-long standoff in a downtown apartment building, the police told reporters Wednesday.
$-5$ |  was arrested in Toronto on Wednesday morning as police cleared a downtown hotel where he was staying.
$-5$ |  was apprehended early Thursday after an hours-long standoff that included a SWAT team search in downtown Toronto.
$-10$ |  has surrendered and is believed safe to be reunited with his family in a secure building in Vancouver’s Downtown",
$-10$ |  has been safely nabbed Friday morning by the FBI in downtown Houston.\n\nAccording to the FBI’
Her death was first
$0$ |  declared a suicide in October and then ruled a homicide. Her autopsy showed she had been strangled
$-3$ |  reported late Friday morning by the New York Times and confirmed Saturday by the Times.
$-3$ |  reported by The Associated Press in September 2015. The coroner has cleared her family of any criminal wrongdoing.
$-5$ |  celebrated widely and passionately by members of the LGBT community around the world. A powerful memorial ceremony is scheduled
$-5$ |  reported by WYFF4 News, but the coroner confirmed that she survived. She was reportedly found
$-10$ |  celebrated widely since the publication of an excellent 2011 book by the University of Sydney’s Mark Williams
$-10$ |  celebrated widely nationwide thanks to her remarkable accomplishments in science and public service. A dozen prominent scientists participated in
Table 2: A sample of generation using CAIF sampling applied to GPT-2 Base with
different values of $\alpha$ from a negative prompt. Note that $\alpha=0$ is a
plain sampling from GPT-2 Base.


A Superconducting Single-Atom Phonon Laser

C.A. Potts1,†, W.J.M. Franse1, V.A.S.V. Bittencourt2, A. Metelmann2,3,4 and
G.A. Steele${}^{1},^{*}$

1Kavli Institute of Nanoscience, Delft University of Technology, PO Box 5046,
2600 GA Delft, The Netherlands
2ISIS (UMR 7006), Université de Strasbourg, 67000 Strasbourg, France
3Institute for Theory of Condensed Matter, Karlsruhe Institute of Technology,
76131 Karlsruhe, Germany
4Institute for Quantum Materials and Technology, Karlsruhe Institute of
Technology, 76344 Eggenstein-Leopoldshafen, Germany

†Email<EMAIL_ADDRESS>
∗Email<EMAIL_ADDRESS>
The development of quantum acoustics has enabled the cooling of mechanical
objects to their quantum ground state, generation of mechanical Fock-states,
and Schrödinger cat states. Such demonstrations have made mechanical
resonators attractive candidates for quantum information processing,
metrology, and tests of quantum gravity theories. Here, we experimentally
demonstrate a direct quantum-acoustic equivalent of a single-atom laser. A
single superconducting qubit coupled to a high-overtone bulk acoustic
resonator is used to drive the onset of phonon lasing. We observe the absence
of a sharp lower lasing threshold and characteristic upper lasing threshold,
unique predictions of single-atom lasing. Lasing of an object with an
unprecedented $25$ $\mu$g mass represents a new regime of laser physics and
provides a foundation for integrating phonon lasers with on-chip devices.

INTRODUCTION

The development of the laser in the early 1960s has proven to be one of the
most important breakthroughs in modern physics. The laser found its niche in
the advancement of atomic physics, resulting in numerous groundbreaking
discoveries such as spectroscopic measurements of atomic species Schawlow
(1982, 1978), laser cooling of atoms Phillips and Metcalf (1982); Phillips
(1998), and the realization of Bose-Einstein condensation Anderson  _et al._
(1995); Davis  _et al._ (1995). Beyond this, lasers are indispensable tools in
areas like gravitational wave detection Abbott  _et al._ (2016), biology
Chaurasiya  _et al._ (2016), chemistry McCreery (2005), and even in medicine
Khalkhal  _et al._ (2019).

The advancements enabled by optical lasers have motivated the development of
lasing states of mechanical vibrations — phonon lasersMahboob  _et al._
(2013); Vahala  _et al._ (2009); Pettit  _et al._ (2019); Kuang  _et al._
(2023); Behrle  _et al._ (2023). Coherent sources of phonons are interesting
for coupling mechanical strain to electron spins and color centers Shandilya
_et al._ (2021), coherent driving of magnetic spin-waves Hatanaka  _et al._
(2022, 2023), improving the resolution of force sensors Cui  _et al._ (2021),
fundamental tests of quantum mechanics Behrle  _et al._ (2023), and nonlinear
phononics Kuang  _et al._ (2023). However, to date, phonon lasing has been
realized with the center of mass motion of levitated microspheres or ions
Vahala  _et al._ (2009); Pettit  _et al._ (2019); Kuang  _et al._ (2023);
Behrle  _et al._ (2023), limiting the integrability of these coherent phonon
sources. In other examples of phonon lasers in literature, the lasing state is
the result of dispersive or dissipative optomechanical coupling Shandilya  _et
al._ (2021); Cui  _et al._ (2021); Zhang  _et al._ (2018); Grudinin  _et al._
(2010); Potts  _et al._ (2021); Parsa  _et al._ (2023) — without population
inversion — which are well described as mechanical parametric instabilities
Kippenberg and Vahala (2008) or as optically driven pulsed semiconductor
heterostructures Bron and Grill (1978); Wallentowitz  _et al._ (1996); Camps
_et al._ (2001).

Figure 1: Schematic of the on-chip $\hbar$BAR device. (A) Rendering of the
$\hbar$BAR device. The $\hbar$BAR device comprises two chips bounded in a
flip-chip orientation. The top chip is 650 $\mu$m of sapphire, hosts the HBAR
modes (red) and is coupled to the superconducting antenna using an aluminum
nitride pad (red). The pocket-style transmon qubit (silver) is fabricated from
NbTiN on the bottom silicon chip and coupled to the feedline via an on-chip
readout resonator (blue). Figure 2: Qubit-induced acoustic linewidth
narrowing. (A) Definition of modes and the coupling rates between the modes.
The readout resonator $\hat{a}$ has input-output modes labelled $1$ and $2$.
(B) Measured two-tone spectroscopy for drive power of -12.0 dBm set at room
temperature. (C) Measured phonon-induced transparency window as a function of
qubit drive power. Starting from the lowest curve, drive powers are -12.0,
-6.0, and -2.0 dBm set at room temperature, respectively. With increasing
power, two features can be noticed. The transparency window reduces in depth,
and the full-width half-maximum linewidth narrows. (D) Extracted experimental
full-width half-maximum of the transparency window as a function of qubit
drive power. Colored points match the corresponding curves in (C).

This article demonstrates, for the first time, the direct phononic analog of a
single-atom optical laser McKeever  _et al._ (2003); Dubin  _et al._ (2010);
An  _et al._ (1994). A single two-level artificial atom driven coherently into
population inversion couples to a bulk on-chip phonon mode generating a lasing
state. The lasing is observed through a dramatically extended ringdown of the
artificial atom excited by the phonon laser and demonstrates the nearly
threshold-free nature of single-atom lasers. We also observe a unique
predicted feature of single-atom lasers, an upper lasing threshold Dubin  _et
al._ (2010); Mu and Savage (1992); Ashhab  _et al._ (2009). Our experimental
observations agree with the theoretical and numerical models we use to
characterize the system. Moreover, the bulk nature of the phonon mode may
allow the future integration of color centers or quantum dots, enabling strain
engineering or coherent mechanical driving. The coherent state generated via
phonon lasing may be used as an efficient displacement pulse for generating
large displacement Schrodinger cat states Bild  _et al._ (2023). Generating
larger cat states may allow for future tests of exotic theories of
gravitationally induced quantum decoherence Gely and Steele (2021); Schrinski
_et al._ (2023). Future implementations of this architecture may even enable
phonon spectroscopy of vibrational transitions of complex molecules and
crystal structures Wybourne and Wigmore (1988) or even biological samples
Romero-Isart  _et al._ (2011).

EXPERIMENTAL SETUP

Our device comprises a flip-chip $\hbar$BAR architecture with two bonded
device chips Bild  _et al._ (2023); von Lüpke  _et al._ (2023, 2022); Chu  _et
al._ (2018, 2017). We have implemented a fully on-chip integration, which can
multiplex different devices on a single silicon chip Välimaa  _et al._ (2022);
Crump, Välimaa, and Sillanpää (2023). A single feedline is coupled to the
individual superconducting fixed-frequency transmon qubits. The transmon
qubits were fabricated from niobium-titanium nitride for the bulk structures
with aluminum Josephson junctions. A sapphire substrate, $650$ $\mu$m thick,
was positioned above each transmon qubit and bonded to the silicon substrate,
see Fig. 1. The sapphire chip supports a set of longitudinal high-overtone
bulk acoustic wave resonances (HBARs) separated by a free spectral range of
$8.54$ MHz. The electric field of a transmon qubit coherently couples to the
strain of an HBAR acoustic mode via a disk of piezoelectric aluminum nitride
patterned on the sapphire. Each qubit on the chip is nearly resonant with an
HBAR mode of interest; in such a way, a pair of qubit-HBAR modes behaves like
a single atom coupled to a phononic mode. The qubits were read out via on-chip
microwave resonators using standard circuit quantum electrodynamics techniques
Krantz  _et al._ (2019); Reed  _et al._ (2010). Our device is similar to those
used in previous work generating mechanical Schrödinger cat states Bild  _et
al._ (2023) and for circuit quantum acoustodynamics Chu  _et al._ (2017).

Using the dispersive shift of a coupled linear readout resonator, we can
measure the steady-state qubit population Krantz  _et al._ (2019). In the
limit where the qubit and the readout resonator are far detuned in frequency,
the qubit-cavity Hamiltonian can be written as:

$\hat{\mathcal{H}}/\hbar=\omega_{\rm
r}\hat{a}^{\dagger}\hat{a}+\frac{1}{2}\omega_{\rm q}\hat{\sigma}_{\rm
z}+\chi\hat{\sigma}_{\rm z}\hat{a}^{\dagger}\hat{a},$ (1)

where $\omega_{\rm r,q}$ are the readout and qubit frequency,
$\hat{a}^{(\dagger)}$ is the photon annihilation (creation) operator,
$\hat{\sigma}_{\rm z}$ is the qubit population operator, and $\chi$ is the
qubit-state dependent frequency shift of the readout resonator. The coupling
between the phonon and the qubit is described by a resonant Jaynes-Cummings
interaction Chu  _et al._ (2017), given by the Hamiltonian:

$\hat{\mathcal{H}}_{\rm int}/\hbar=g_{\rm
qb}(\hat{\sigma}_{+}\hat{b}+\hat{\sigma}_{-}\hat{b}^{\dagger}),$ (2)

where $g_{\rm qb}$ is the coupling rate between the qubit and the phonon mode,
$\hat{\sigma}_{\pm}$ are the qubit raising and lowering operators, and
$\hat{b}^{(\dagger)}$ is the phonon annihilation (creation) operator; see Fig.
2(a).

The qubit’s state was measured by applying a weak probe tone on resonance with
the readout resonator and monitoring the transmitted signal as a second tone
was swept near the qubit frequency. The transmission spectrum at the readout
frequency directly maps to the qubit occupation $\langle\hat{\sigma}_{\rm
z}\rangle$; see Fig. 2(b). The asymmetry of the qubit spectrum is due to the
finite photon population within the readout resonator Gambetta  _et al._
(2006); Lachance-Quirion  _et al._ (2017) and is well described by our
theoretical model. Moreover, the narrow transparency window within the qubit
spectrum results from the coherent swaps between the qubit and the phonon
mode. In this work, the qubit and the phonon frequency were detuned by
approximately $3.3$ MHz. See the discussion in the supplementary text for full
details. However, as will be discussed below, coherent Rabi oscillations
between the qubit and phonon modes do not provide a clear picture of the
dynamics at high drive powers.

PHONON LASING

Three distinct features can be observed within the two-tone spectrum when
increasing the qubit drive power. First, the qubit linewidth is power-
broadened Schuster  _et al._ (2005); Gambetta  _et al._ (2006). Large qubit
drive powers increase the qubit decay rate due to increased stimulated
emission. Less intuitive is the gradual disappearance and narrowing of the
phonon-induced transparency window; see Fig. 2(c). The total linewidth of the
transparency window is proportional to the phonon linewidth and demonstrates
an inverse dependence on the drive power; see Fig. 2(d). This dependence is
reminiscent of linewidth narrowing described by the Schawlow-Townes equation
and is a known property of lasing states Gordon, Zeiger, and Townes (1955).
These features can be understood by considering the schematic shown in Fig.
3(a).

As described before, the qubit and phonon modes coherently exchange
excitations at the lowest qubit drive powers, which can be understood as a
bosonic beam-splitter-type interaction. However, as the qubit drive power
increases, the qubit is excited by the drive and coherently exchanges an
excitation with the phonon mode. But before the phonon mode can exchange the
excitation back to the qubit, the external drive re-excites the qubit. The
qubit excitation can again be coherently swapped into the phonon mode, causing
the phonon mode to climb the Fock state ladder. In the steady state, this
process results in a phonon mode described by a large coherent state; i.e. the
phonon mode starts lasing. A strong qubit drive allows the phonon mode to
accept energy from the qubit but prevents the qubit from accepting energy from
the phonon mode; see Fig. 3(a). This process also provides an intuitive
understanding of the reduced visibility of the transparency window. As the
drive power increases, the phonon mode no longer exchanges energy with the
qubit; therefore, probing the qubit provides no information about the phonon
mode.

Figure 3: Phonon lasing observed through qubit ringdown dynamics. (A)
Schematic of the coupled qubit-phonon system. The qubit acts as an artificial
two-level atom, with ground state $|g\rangle$ and excited state $|e\rangle$. A
coherent drive of strength $\Omega_{\rm q}$ drives the qubit between its
ground and excited state. The qubit coherently interacts with the phonon mode
at a rate $g_{\rm qb}$. The qubit is rapidly re-excited for strong pump
powers, resulting in a one-directional energy flow into the phonon mode. This
process results in phonon lasing. (B) Measured qubit ringdown for a qubit
drive of -3.0 dBm. Blue line: the qubit drive is detuned from the HBAR by
$250$ kHz with the phonon mode in the non-lasing state, decaying on a time
scale of the $\sim 200$ ns decay of the qubit. Red line: The qubit drive is
tuned directly on resonance with the HBAR mode, exciting it into the lasing
state, exhibiting a dramatically longer, non-exponential decay due to re-
excitation from the coherently excited phonon mode. The master equation
simulation (dashed black line) is plotted over the data.

Finally, at the highest qubit drive powers, the qubit linewidth has been
increased such that the rapid decay of the qubit population results in a self-
quenching of phonon lasing Mu and Savage (1992). Counterintuitively this
results in an upper lasing threshold above which the phonon mode is no longer
lasing. Instead, the qubit incoherently exchanges excitations with the phonon
mode, reducing the phonon amplitude. It should also be noted that the phonon
mode statistics are no longer described as a coherent state above the upper
threshold. This process has been described previously in the context of
single-atom photon lasers McKeever  _et al._ (2003) and is captured by our
theoretical description; see the supplementary text.

Figure 4: Unique signatures of single-atom lasing. (A) Measured gated qubit
ringdown for a qubit drive of -12.0, -8.0, -6.0 and -2.0 dBm. With increasing
drive power, the gated qubit ringdowns increase in amplitude and duration as
the phonon mode population increases. (B) Measured gated qubit ringdown for a
qubit drive of -2.0, 2.0, 4.0, and 8.0 dBm. For all measurements, the qubit
drive is tuned directly on resonance with the HBAR mode. With increasing drive
power, the gated qubit ringdowns decrease in amplitude and duration as the
phonon mode population decreases above the self-quenching threshold. For all
measurements in (A) and (B), the qubit drive is tuned directly on resonance
with the HBAR mode. (C) Simulated phonon state population
$\langle\hat{b}^{\dagger}\hat{b}\rangle$ as a function of qubit drive power.
The phonon population is maximum at a drive power of approximately -2.0 dBm
and decreases for drive powers above the upper lasing threshold. The
individual trace colors in (A) and (B) correspond to the matching colors
within the phonon population plot.

GATED TWO-TONE SPECTROSCOPY

Directly probing the phonon mode is not possible in the current experimental
configuration since the readout is performed via the two-level system and not
through a propagating photon mode Kuang  _et al._ (2023); Behrle  _et al._
(2023). Direct measurements of the Rabi oscillations between the qubit and
phonon state could be possible and have been previously used to measure Fock-
states in $\hbar$BAR devices Chu  _et al._ (2018). However, this data would
provide little clarity due to the short lifetime of our qubit and the
multiplicity of simultaneous Rabi oscillation frequencies given by $2g_{\rm
N}=2\sqrt{N}g_{\rm qb}$, which scale with the phonon mode amplitude $N$.Chu
_et al._ (2018) Instead, we rely on the mismatch between the decay rate of the
phonon mode $\tau\sim 25$ $\mu$s and that of the qubit. Using gated two-tone
ringdown measurements, we can distinguish pure qubit decay from qubit decay
driven by a highly excited phonon state. If the phonon mode is highly
excited—in the absence of an external drive—the coherent Jaynes-Cummings
interaction will continually drive the qubit, resulting in an extended
relaxation of the qubit population compared to its intrinsic relaxation rate.

Gated two-tone measurements were performed, driving the qubit until the system
reached its steady state; at this point, the drive was switched off using an
RF switch. During the entire sequence, the frequency of the readout resonator
is monitored using a vector network analyzer, averaging multiple traces
triggered synchronously with the RF switch; see the supplementary text for
more information. This measures the expectation value of the qubit population
$\langle\hat{\sigma}_{\rm z}\rangle$ as a function of time, with a temporal
resolution of $50$ ns.

First, the drive power was set near the peak of the lasing amplitude and was
detuned $250$ kHz above the HBAR resonance. The gated two-tone measurement was
performed, and the blue data points in Fig. 3(b) show the resulting time
domain measurement and a ringdown on the order of $\sim 200$ ns. This
corresponds to the intrinsic $T_{1}$ decay of the transmon qubit. A second
measurement was performed at the same drive power, but the drive was tuned
resonant with the HBAR. A ringdown on the order of $25$ $\mu$s is observed for
this configuration, represented by the red data points in Fig. 3(b). The
extended ringdown confirms the highly excited phonon amplitude of the
mechanical state. When the qubit drive is switched off, the phonon mode can
exchange excitations with the qubit, continually re-exciting the qubit until
the phonon mode has decayed back to its ground state. Moreover, near the peak
phonon amplitude, in contrast to a thermal state, the coherent state generated
by the lasing results in a qubit ringdown that is not exponential; instead,
the qubit ringdown is approximately linear. This feature is captured by our
numerical model, the dashed curve in Fig. 3(b). Moreover, our model also
captures the ring-up of the qubit and is described within the supplementary
information.

We can estimate the phonon population from our numerical model by fitting the
spectroscopic and ringdown data. The estimated phonon population is shown in
Fig. 4(c) as a function of qubit drive power. At a power of -2.0 dBm, the
phonon population is nearly maximized, corresponding to the ringdown in Fig.
4(a,b), and the upper lasing threshold is clearly visible as the phonon
population rapidly reduces with increasing drive power. The upper threshold is
experimentally confirmed by performing a set of gated ringdown measurements at
a series of qubit drive powers. With increasing qubit drive power, the
individual ringdown traces grow in amplitude and increase in duration,
corresponding to the increasing phonon population, as shown in Fig. 4(a). At a
drive power of -2.0 dBm, the phonon ringdown obtains its peak amplitude and
duration, indicating a peak in the phonon population, shown in Fig. 4, which
agrees with the minimum in the transparency window linewidth, shown in Fig.
2(b). Further increasing the qubit drive power beyond -2.0 dBm the qubit
ringdown decreases in amplitude and duration, a direct indication of the self-
quenching nature of the single-atom phonon laser, see Fig. 4(b). The upper
threshold is a defining signature of a single-atom laser Mu and Savage (1992),
and the agreement between the gated qubit ringdown and our numerical
simulations indicates that we have indeed demonstrated a single-atom phonon
laser.

CONCLUSION

This article demonstrates the experimental realization of a phononic analog to
the optical single-atom laser. Our experiment consists of a superconducting
single-atom, realized using a transmon style qubit coupled resonantly to an
HBAR mode. When driving on resonance with the HBAR mode, the intrinsic non-
linearity of the qubit-phonon coupling generates a highly excited phonon state
— the phonon laser. A key feature of this experiment is the population
inversion of a two-level atom rather than the parametric instability driving
phonon excitations. Moreover, the phonon mode is confined in a bulk
longitudinal mode within a sapphire substrate. The bulk nature may allow the
phonon laser’s integration with additional on-chip architectures, such as
color centers or quantum dots.

Our results have demonstrated the successful generation of a coherent phonon
laser, and we have further demonstrated a counterintuitive feature of phonon
lasers, an upper instead of a lower lasing threshold Ashhab  _et al._ (2009).
The size of the coherent lasing state achieved in this work was limited by
both the qubit and phonon linewidth. However, the primary limiting factor was
the phonon linewidth. Decreasing the decay rates will reduce the upper lasing
threshold power and increase the peak lasing amplitude. Future studies could
include a linear probe of the phonon mode to probe the phonon statistics. Such
an on-chip phonon laser promises to provide a highly coherent source of
phonons, which have applications from sensing to quantum information
processing.

ACKNOWLEDGMENTS

The authors thank Enrique Sahagun for the device rendering Sci . W.J.M.F and
G.A.S. acknowledge support through the QUAKE project, project number
680.92.18.04, of the research programme Natuurkunde Vrije Programma’s of the
Dutch Research Council (NWO). C.A.P. acknowledges the support of the Natural
Sciences and Engineering Research Council of Canada (NSERC). A.M and
V.A.S.V.B. acknowledge financial support from the Contrat Triennal 2021-2023
Strasbourg Capitale Europeenne.

Authors contributions C.A.P. performed experiments, theoretical modelling,
conceptualization, and wrote the manuscript. W.J.M.F. fabricated the device
and performed experiments. V.A.S.V.B. performed theoretical modelling. A.M.
provided supervision and funding acquisition. G.A.S. provided supervision,
conceptualization and funding acquisition. Competing interests: The authors
declare no competing interests.

Data and materials availability All data, analysis code, and measurement
software are available in the manuscript or the supplementary material or are
available at Zenodo .

Supplementary Information

##  I Materials and Methods

###  I.1 Device Fabrication

Figure S1: Fabricated flip-chip HBAR Device. (A) Optical micrograph of the
assembled flip-chip device. The top feedline of qubits is fabricated with a
flip-chip of sapphire, and the bottom feedline has no sapphire flip-chip as
references. (B) Zoomed optical micrograph of the flip-chip assembly. (C)
Optical micrograph of the qubit with the sapphire chip assembled on top. The
overlap between the antenna and the $250\mu$m aluminum nitride piezoelectric
transducer is visible. The scale bar is $250\mu$m. (D) Optical micrograph of
the entire chip loaded in the printed circuit board.

### Qubit Chip

The device fabrication starts with a 10x10mm chip 525 $\mu$m thick high
resistivity $\langle 100\rangle$ silicon deposited with $100$ nm of niobium-
titanium nitride (NbTiN). The NbTiN film was deposited by the Dutch Institute
for Space Research (SRON) following the process described in Thoen  _et al._
(2016). A layer of photoresist (AR-P 6200.18, 4000 rpm) was patterned, exposed
(EBPG 5200, 315 $\mu$m/cm2) and developed (Pentylacetate, O-xylene, IPA) to
form the bulk circuitry (transmon islands and coplanar waveguides). The
exposed NbTiN was removed using a reactive ion etch (Sentech Etchlab 200, 13.5
sccm $\text{SF}_{\text{6}}$ \+ 5 sccm $\text{O}_{\text{2}}$, 55 W, 10
$\mu$bar) followed by an in-situ oxygen descum (50 sccm
$\text{O}_{\text{2}}$,100 W, 10 $\mu$bar). After stripping the photoresist, a
bilayer resist stack (MAA 8.5% EL6, 2000 rpm and PMMA A6 950k, 1500 rpm; baked
for three and five minutes at 180 C∘, respectively) was used for patterning
the Josephson junctions (190 nm width). The junctions were patterned using
e-beam lithography. The bilayer was developed using Cold
$\text{H}_{2}\text{O}$: IPA (1:3) and cleaned afterwards with IPA. After
cleaning the exposed silicon surface with an oxygen descum (200 sccm, 100 W)
and acid clean (BoE(7:1):$\text{H}_{2}\text{O}$, 1:1), the chip was placed in
an aluminum evaporator (Plassys MEB550). Double-angle shadow evaporation with
intermediate in-situ oxidation was used to create Manhattan-style junctions.
The aluminum was evaporated at a $35^{\circ}$ angle relative to the substrate
at a rotational angle of $0^{\circ}$ and $90^{\circ}$. The top and bottom
electrodes were 35 and 75 nm thick, respectively. After the first evaporation
step, the aluminum was oxidized to create the Al$\text{O}_{\text{x}}$ tunnel
barriers. Following the second evaporation step, a second oxidation step was
performed to cap the junctions with a passivation layer. After performing
liftoff in NMP, the qubit chip was finished.

### HBAR Chip

The HBAR chip started with double-side polished four-inch sapphire wafers with
a 1 $\mu$m thick film of c-axis oriented AlN (Kyma technologies,
AT.U.100.1000.B). The wafer was diced into 10x10mm chips for easier
processing. A photoresist layer (AR-N 4450.10, 6000 rpm) was used to pattern
circular regions, $250\mu$m in diameter, to mask the AlN. A reactive ion etch
in an Oxford 100 was performed to create AlN disks
($\text{Cl}_{2}\text{/BCl}_{3}\text{/Ar}$ at 4.0/26.0/10.0 sccm, 350 W ICP
power, 70 W RF power). Following the reactive ion etch, the AlN layer has the
proper shape but not the correct thickness. After stripping the photoresist,
the chip was placed again inside the etcher to etch the AlN to $\sim 900$ nm
thickness.

### Flip Chip

Once fabrication on both chips was done, the HBAR chip was diced into 8x2 mm
chips. The HBAR chip was then flipped on top of the qubit chip with the AlN
layer facing down. Using probe needles, the AlN disks were aligned with the
transmon antennas. Once aligned, the probe needles held down the chips in
position while a tapered fiber was used to apply two-component epoxy (Loctite
EA 3430) on the sides of the top chip; see Fig. S1. After the epoxy was cured,
the chip was wire-bonded and installed onto the baseplate of the dilution
refrigerator.

###  I.2 Measurement Setup

### Two-Tone Spectroscopy

Figure S2: Schematic of the measurement setup. To the left is the general
Dilution refrigerator wiring setup. Outside the refrigerator, we used two
different setups. In (b), we show our Two-tone spectroscopy configuration used
for qubit spectroscopy. Here, we sent a weak continuous wave tone (readout
resonator probe) from the vector network analyzer (VNA) port one and a second
continuous wave tone (qubit drive) from the VNA port 3. These two signals are
combined by using a directional coupler before entering the dilution
refrigerator. The signal from the dilution refrigerator goes through a room-
temperature amplifier before it goes to port 2 of the VNA. In (c), we show are
”time domain” setup. Here, we replaced output port 3 of the VNA with a signal
generator (SG) to provide the drive tone. A switch (Taylor MW switch) together
with a pulse generator (PG, Rigol DG1022) is placed between the directional
coupler and the signal generator.

All measurements were performed within a dilution refrigerator operating at a
base temperature $T\sim 20$ mK. A schematic of the dilution refrigerator setup
and the room-temperature electronics are shown in Fig. S2. The device was
mounted on the mixing chamber plate of the dilution refrigerator and connected
to a set of coaxial cables. The device was measured in transmission, with the
resonators coupled in a ’notch’-style geometry. The output signals went into a
cryogenic HEMT (High Electron Mobility Transistor) amplifier (LNF-LNC4-8A),
followed by additional room-temperature amplification (Miteq
AFS3-04000800-07-10P-4). The input line was attenuated at each stage to reduce
the electron temperature and the thermal radiation at the input port of our
device. A total of 48 dB of attenuation was used, plus any additional
attenuation from the coaxial cables.

The two-tone spectroscopy was measured using a vector network analyzer (VNA).
Port one and port three were combined using a directional coupler, with port
three attached to the -20 dB coupling port. Port one was set into zero span
mode and output a constant signal tuned on resonance with the Stark shifted
readout resonator, $\omega_{\rm r}$, with an output power of -25 dBm. An
additional 60 dB of attenuation was added to this signal before the
directional coupler. Port 3 was used as a spectroscopic tone and was swept
near the qubit frequency, and its power was varied throughout the experiment
and had an additional 40 dB of attenuation. The combined signals from port one
and there were then connected to the input line of the dilution refrigerator.

The output from the dilution refrigerator was directly connected to port 4 of
the VNA set in zero span mode at the readout resonator frequency $\omega_{\rm
r}$. Two-tone spectroscopy was performed by slowly sweeping the qubit drive
tone, ensuring the system has reached its steady state and monitoring the
readout resonators transmission spectrum $S_{21}$.

### Gated Two-Tone Spectroscopy

For the gated two-tone measurement, port one of the VNA was set up just as in
the two-tone measurement. An external signal generator generated the qubit
drive tone. The qubit drive tone was passed through an RF switch before being
combined with the readout tone using a directional coupler. The RF switch was
triggered using a pulse generator at a 3 kHz repetition rate. The signal
generator was set to a 22.5% duty cycle, so the qubit drive was off for 75
$\mu$s per trace. The VNA was synchronously triggered by the signal generator
allowing for 65536 trace averages to be performed (maximum setting). Each
trace averaged measurement was repeated 75 additional times to improve the
signal-to-noise ratio further.

##  II Theory

###  II.1 System Hamiltonian and Master Equation

The system consists of a microwave cavity coupled to a transmon qubit which in
turn is coupled to an HBAR phonon mode. The transmon qubit can be considered,
up to a good approximation, to be a two-level system. The readout cavity is
driven two with coherent tones: one at a frequency $\omega_{p}$, which we call
the probe tone, and one at a frequency $\omega_{d}$, which we call the drive
tone. The experiment measures the coupling between the qubit and the phonon
mode via two-tone spectroscopy performed via the cavity. The procedure
consists of considering the cavity detuned from the qubit, setting the probe
tone at the (shifted) cavity frequency and varying the drive tone close to the
qubit Lamb-shifted frequency. The transmission of the cavity carries
information about the qubit correlations $\langle\hat{\sigma}_{z}\rangle$. The
phonon mode has a frequency close to the qubit frequency.

We model the system with the Hamiltonian

$\displaystyle\frac{\hat{\mathcal{H}}}{\hbar}$ $\displaystyle=\omega_{\rm
r}\hat{a}^{\dagger}\hat{a}+\omega_{\rm
b}\hat{b}^{\dagger}\hat{b}+\frac{\omega_{\rm q}}{2}\hat{\sigma}_{\rm z}+g_{\rm
qc}(\hat{a}\hat{\sigma}_{+}+\hat{a}^{\dagger}\hat{\sigma}_{-})+g_{\rm
qb}(\hat{b}^{\dagger}\hat{\sigma}_{-}+\hat{b}\hat{\sigma}_{+})$ (S1)
$\displaystyle+\epsilon_{\rm d}(\hat{a}e^{i\omega_{\rm
d}t}+\hat{a}^{\dagger}e^{-i\omega_{\rm d}t})+\epsilon_{\rm
p}(\hat{a}e^{i\omega_{\rm p}t}+\hat{a}^{\dagger}e^{-i\omega_{\rm p}t}),$

where $\hat{a}^{(\dagger)}$ are the annihilation (creation) operators for the
readout cavity with frequency $\omega_{\rm r}$, $\hat{b}^{(\dagger)}$ are the
annihilation (creation) operators for the HBAR mode with frequency
$\omega_{\rm b}$, $\hat{\sigma}_{\rm z}$ is the qubit population operator with
qubit frequency $\omega_{\rm q}$. The couplings are defined by the rates
$g_{\rm qc}$ between the qubit and the readout cavity and $g_{\rm qb}$ between
the qubit and the HBAR mode, where we assume that $g_{\rm qc}\gg g_{\rm qb}$.
Finally, the two drives are described by the amplitude $\epsilon_{\rm p,d}$
with frequencies $\omega_{\rm p,d}$. The system is operated in the cavity-
qubit dispersive regime $g_{\rm qc}\ll|\omega_{\rm r}-\omega_{\rm q}|$. We
then consider the standard Schrieffer-Wolff transformation up to the first
order in $g_{\rm qc}/|\omega_{\rm r}-\omega_{\rm q}|$. Defining $\chi=g_{\rm
qc}^{2}/(\omega_{\rm q}-\omega_{\rm r})$, the transformed Hamiltonian reads

$\displaystyle\frac{\hat{\mathcal{H}}^{\prime}}{\hbar}$
$\displaystyle=\frac{\tilde{\Omega}_{\rm q}}{2}\hat{\sigma}_{\rm
z}+\omega_{\rm r}\hat{a}^{\dagger}\hat{a}+\omega_{\rm
b}\hat{b}^{\dagger}\hat{b}+\chi\hat{a}^{\dagger}\hat{a}\hat{\sigma}_{\rm
z}+g_{\rm
qb}(\hat{b}^{\dagger}\hat{\sigma}_{-}+\hat{b}\hat{\sigma}_{+})-\frac{g_{\rm
qb}}{g_{\rm
qc}}\chi(\hat{a}^{\dagger}\hat{b}+\hat{a}\hat{b}^{\dagger})\hat{\sigma}_{\rm
z}$ (S2) $\displaystyle+\sum_{j=p,d}\epsilon_{\rm
j}(\hat{a}e^{i\omega_{j}t}+\hat{a}^{\dagger}e^{-i\omega_{j}t})+\frac{g_{\rm
qc}}{\omega_{\rm r}-\omega_{\rm q}}\sum_{j=p,d}\epsilon_{\rm
j}(\hat{\sigma}_{+}e^{i\omega_{j}t}+\hat{\sigma}_{-}e^{-i\omega_{j}t}).$

The Lamb-shifted qubit frequency is $\tilde{\Omega}_{\rm q}=\omega_{\rm
q}+\chi$. Given the system’s parameters, we will discard the qubit-mediated
beam-splitter term $\frac{g_{\rm qb}}{g_{\rm
qc}}\chi(\hat{a}^{\dagger}\hat{b}+\hat{a}\hat{b}^{\dagger})\hat{\sigma}_{\rm
z}$. Furthermore, in the two-tone spectroscopic setup, we can retain only the
probe term for the cavity and only the drive term for the qubit. With such
approximations, we have

$\displaystyle\frac{\hat{\mathcal{H}}^{\prime}}{\hbar}$
$\displaystyle=\frac{\tilde{\Omega}_{\rm q}}{2}\hat{\sigma}_{\rm
z}+\omega_{\rm r}\hat{a}^{\dagger}\hat{a}+\omega_{\rm
b}\hat{b}^{\dagger}\hat{b}+\chi\hat{a}^{\dagger}\hat{a}\hat{\sigma}_{\rm
z}+g_{\rm qb}(\hat{b}^{\dagger}\hat{\sigma}_{-}+\hat{b}\hat{\sigma}_{+})$ (S3)
$\displaystyle+\epsilon_{\rm p}(\hat{a}e^{i\omega_{\rm
p}t}+\hat{a}^{\dagger}e^{-i\omega_{\rm p}t})+\varepsilon_{\rm
d}(\hat{\sigma}_{+}e^{i\omega_{\rm d}t}+\hat{\sigma}_{-}e^{-i\omega_{\rm
d}t}),$

where we have defined $\varepsilon_{\rm d}=\frac{g_{\rm qc}\epsilon_{\rm
d}}{\omega_{\rm q}-\omega_{\rm r}}$. It is convenient to move to a frame co-
rotating with the pump and the probe frequencies, for which the Hamiltonian in
Eq. (S3) reads

$\displaystyle\frac{\hat{\mathcal{H}}_{\rm rot}^{\prime}}{\hbar}$
$\displaystyle=-\frac{\Delta_{\rm q}}{2}\hat{\sigma}_{\rm z}+(-\Delta_{\rm
r}+\chi)\hat{a}^{\dagger}\hat{a}-\Delta_{\rm
b}\hat{b}^{\dagger}\hat{b}+\chi\hat{a}^{\dagger}\hat{a}\hat{\sigma}_{\rm z}$
(S4) $\displaystyle+g_{\rm
qb}(\hat{b}^{\dagger}\hat{\sigma}_{-}+\hat{b}\hat{\sigma}_{+})+\epsilon_{\rm
p}(\hat{a}+\hat{a}^{\dagger})+\varepsilon_{\rm
d}(\hat{\sigma}_{+}+\hat{\sigma}_{-}),$

where $\Delta_{\rm b}=\omega_{\rm d}-\omega_{\rm b}$, $\Delta_{\rm
q}=\omega_{\rm d}-\tilde{\Omega}_{\rm q}$, and $\Delta_{\rm r}=\omega_{\rm
p}-\omega_{\rm r}+\chi$. We have defined the readout cavity detuning
$\Delta_{\rm r}$ to included the Lamb shift, however, this decision is
arbitrary. The density matrix of the system $\rho$ has dynamics described by
the master equation

$\partial_{t}\rho=-\frac{i}{\hbar}[\hat{\mathcal{H}}_{\rm
rot}^{\prime},\rho]+\kappa\mathcal{L}[\hat{a}]\rho+\gamma_{\rm{b}}\mathcal{L}[\hat{b}]\rho+\Gamma_{1}\mathcal{L}[\hat{\sigma}_{-}]\rho+\frac{\Gamma_{\phi}}{2}\mathcal{L}[\hat{\sigma}_{\rm{z}}]\rho.$
(S5)

Here $\kappa$ is the cavity decay, $\gamma_{\rm{b}}$ is the phonon decay,
$\Gamma_{1}$ is the qubit population decay, and $\Gamma_{\phi}$ is the qubit
dephasing. We have assumed zero temperature and ignored small corrections to
the dissipator due to the Schrieffer-Wolff transformation.

###  II.2 Qubit Two-Tone Spectroscopy

Following the arguments presented in Gambetta  _et al._ (2006), ignoring the
qubit-phonon coupling, in the dispersive regime,
${\rm{arg}}[\langle\hat{a}(t)\rangle]$ is directly related to the qubit
population $\langle\hat{\sigma}_{z}(t)\rangle$. By recording the phase of the
readout resonator, one can then obtain the qubit absorption spectrum

$S(\omega)=\frac{1}{2\pi}\int_{-\infty}^{\infty}dte^{i\omega
t}\langle\hat{\sigma}_{-}(t)\hat{\sigma}_{+}(0)\rangle_{s},$ (S6)

where $\langle\cdot\rangle_{s}$ indicates that the expectation value is taken
in the steady state.

It was shown that for a qubit-cavity system, the qubit absorption spectrum is
given by Gambetta  _et al._ (2006)

$S(\omega)=\frac{1}{\pi}\sum_{j=0}^{\infty}\frac{1}{j!}{\rm{Re}}\left(\frac{(-A)^{j}e^{A}}{\Gamma^{(j)}_{\rm
q}/2-i(\omega-\Omega^{(j)}_{\rm
q})}\right)\equiv\sum_{j=0}^{\infty}S_{j}(\omega),$ (S7)

with

$\displaystyle A$
$\displaystyle=D_{ss}\bigg{(}\frac{\kappa/2-2i\chi}{\kappa/2+2i\chi}\bigg{)},$
(S8) $\displaystyle B$ $\displaystyle=\chi(\bar{n}_{e}+\bar{n}_{g}-D_{ss}),$
$\displaystyle D_{ss}$
$\displaystyle=\frac{2\chi^{2}(\bar{n}_{e}+\bar{n}_{g})}{(\kappa/2)^{2}+2\chi^{2}},$
$\displaystyle\bar{n}_{e}$
$\displaystyle=\frac{\bar{n}_{g}(\kappa/2)^{2}}{(\kappa/2)^{2}+(2\chi)^{2}},$
$\displaystyle\Gamma^{(j)}_{\rm q}$ $\displaystyle=2\gamma_{\rm
q}+\kappa(j+D_{ss}),$ $\displaystyle\omega^{(j)}_{\rm q}$
$\displaystyle=\tilde{\omega}_{q}+B+2j\chi.$

In the above equations, $\omega^{(j)}_{\rm q}$ and $\Gamma^{(j)}_{\rm q}$ are
the frequency and linewidth of the qubit with the readout resonator in the
state $|j\rangle$, respectively. The intrinsic qubit linewidth, with the
readout resonator in its ground state, is given by $\gamma_{\rm
q}=\Gamma_{1}/2+\Gamma_{\phi}$, where $\Gamma_{1}$ is the longitudinal
relaxation rate, and $\Gamma_{\phi}$ is the pure dephasing rate. The qubit
frequency $\omega^{(0)}_{\rm q}$ is ac Stark shifted by $B$ from its intrinsic
value $\omega_{\rm q}$. We have also assumed that the readout drive is on
resonance with the readout resonator, i.e. $\Delta_{\rm r}=0$, and the readout
resonator has a full-width half-maximum linewidth $\kappa$. In the limit
$\chi\sim\kappa$ and with $\Delta_{\rm r}=0$, the components $S_{j}(\omega)$
have non-Lorentzian lineshapes and can even be negative. The sum of these
individual components can result in an asymmetry of the qubit spectrum, as
seen in Fig. S3(a).

We perform spectroscopy of the qubit by monitoring the transmission
coefficient $S_{21}$ of the readout resonator as a function of the qubit drive
frequency $\omega_{\rm d}$. The probe tone was fixed at the Stark-shifted
readout resonator frequency with the qubit in its ground state
$\omega^{g}_{\rm c}/2\pi=4.91$ GHz, such that $\Delta_{\rm r}=0$ and held at a
constant power $\mathcal{P}_{d}=-25$ dBm, set at room temperature. The probe
line has a total of 108 dB of attenuation, ensuring the average number of
photons in the probe mode on average is much less than one.

To fit the measured spectrum, we use the expression,

$|S_{21}|=\mathcal{A}\sum_{j=0}^{10}S_{j}(\omega)+\mathcal{C},$ (S9)

where $\mathcal{A}$ is a conversation factor between $S_{j}(\omega)$ and
$|S_{21}|$ and $\mathcal{C}$ is a constant offset of the spectrum. The value
of the Fock basis was truncated to $j=10$, and the linewidth of the readout
resonator was independently determined and fixed; see Table. 1. The fitting
parameters include the intrinsic qubit frequency $\omega_{\rm q}$, the power
broadened qubit linewidth $\Gamma_{q}(\mathcal{P}_{\rm d})$, where
$\mathcal{P}_{\rm d}$ is the qubit drive power, the qubit dispersive shift
$\chi$, the probe mode occupancy with the qubit in its ground state
$\bar{n}_{\rm g}$, and conversion factor $\mathcal{A}$, and the constant
offset $\mathcal{C}$.

Figure S3: Two-tone qubit spectroscopy measurements. (A) Experimental two-tone
qubit spectrum (blue) and the qubit spectrum determined from a fit to Eq. S9
(red). The qubit drive power at room temperature was set to -20.0 dBm. (B)
Extracted value of the readout resonator photon population as a function of
qubit drive power.

An example spectrum and its fit are shown in Fig. S3(a). First, the value of
the dispersive shift was determined to be $\chi=-1.2\pm 0.2$ MHz, which agreed
with our designed value. This value was then fixed, and the data was fit for
all qubit drive powers to determine the remaining values. We found that the
ground state readout photon population depended on the qubit drive power. This
is likely due to the heating of the silicon substrate because the qubit drive
tone was applied via the readout resonator. The value of $\bar{n}_{\rm
g}(\mathcal{P}_{\rm d})$ is shown in Fig. S3(b). The zero power qubit
linewidth was also extracted by extrapolating the measured power-broadened
qubit linewidth to zero power and was determined to be $\gamma_{\rm
q}(0)=0.420\pm 0.04$ MHz, which agrees with our $\gamma_{\rm
q}=\Gamma_{1}/2+\Gamma_{\phi}\geq 1/2T_{1}$ limit determined using a time-
domain measurement with $T_{1}=180\pm 30$ ns. The comparison between our
spectroscopy and time domain measurements indicates that our qubit decay is
dominated by decoherence, and therefore we have ignored intrinsic dephasing in
our model since qubit dephasing will be dominated by power-induced dephasing
induced by the qubit drive tone.

###  II.3 Master Equation Simulations

### Qubit Spectroscopy

Figure S4: Two-tone qubit spectroscopy measurements. (A) Experimental two-tone
qubit spectrum (blue) overlapped with the qubit spectrum determined from the
master equation simulation (red). The frequency is defined as the detuning
from the bare qubit frequency. The qubit drive power at room temperature was
set to -12.0 dBm. (B) Qubit spectrum and master equation simulation for a
qubit drive power of -6.0 dBm. (C) Qubit spectrum and master equation
simulation for a qubit drive power of -3.0 dBm. The feature at $\sim 0$ MHz is
an additional HBAR mode, one free-spectral range from the HBAR mode of
interest for this work. The only parameter that was varied within the
simulation was the room-temperature value of the qubit drive.

We simulate the dynamics of the master equation Eq. S5 using the Python
package Qutip Johansson, Nation, and Nori (2012). We first compare the
measured qubit spectrum without the phonon mode to the Qutip steady-state
simulations. To begin, we must consider the non-zero photon population of the
readout resonator. The finite population results in an asymmetry in the qubit
spectrum, as well as additional measurement-induced dephasing. To include the
finite readout population in our simulation, the readout drive $\epsilon_{\rm
p}$ was set such that the average population
$\langle\hat{a}^{\dagger}\hat{a}\rangle=\bar{n}_{\rm g}(\mathcal{P}_{\rm d})$.
This ensured that for each qubit drive power, the readout resonator had the
appropriate number of steady-state photons.

To account for qubit power-broadening, the qubit drive power in the simulation
had to be calibrated. As stated above, $\varepsilon_{\rm d}=\frac{g_{\rm
qc}\epsilon_{\rm d}}{\omega_{\rm r}-\Omega_{\rm q}}$, where $\epsilon_{\rm
d}=\sqrt{\kappa_{\rm ext}}\sqrt{\mathcal{P}_{\rm d}/\hbar\omega_{\rm d}}$,
$\kappa_{\rm ext}$ is the external coupling rate to the readout resonator, and
$\mathcal{P}_{\rm d}$ is the drive power in Watts at the coupling port of the
readout resonator. Therefore, the drive coefficient $\varepsilon_{\rm d}$ can
be written in the form

$\varepsilon_{\rm d}=\sqrt{10^{(\mathcal{P}_{\rm RT}+\delta)/10}}$ (S10)

where $\delta$ calibrates the room-temperature power to the corresponding
value of $\mathcal{P}_{\rm d}$ accounting for all losses and multiplicative
factors. The value of $\delta$ was determined by matching the simulation to
the power-broadened qubit spectrum at multiple qubit drive powers. A set of
qubit spectra is shown in Fig. S4 where it can be seen that the master
equation simulation is in excellent agreement capturing the qubit asymmetry at
low power, and the power-broadened qubit spectrum at higher drive powers. It
should be noted the measured transmission signal $S_{21}$ is proportional to
the qubit population $\langle\hat{\sigma}_{\rm z}\rangle$ only if the
appropriate signal quadrature is measured. Here this was determined by
calculating the rotation angle that minimized the signal in the out-of-phase
quadrature. To confirm, we compared our single-trace two-tone data with a
direct measurement of the readout resonator frequency at several qubit drive
powers. At the highest drive powers, we observed a slight deviation resulting
from signal mixing into the out-of-phase quadrature. However, this was at the
drive powers above the self-quenching threshold and resulted in a slight
mismatch between our experimental and simulated two-tone traces.

### Gated Ringdown

Figure S5: Gated two-tone qubit spectroscopy. (A) Experimental gated two-tone
measurements for qubit drive powers -12.0, -6.0, -3.0 dBm. The master equation
simulations at the same drive power are plotted as dashed black lines. The
simulation has an excellent agreement for the ringdown data for all powers and
a slight deviation from the ring-up data. This could be attributed to higher-
order non-linearities we are not considering within our simple master equation
model. However, the agreement between the experiment and simulation is good
for all powers. (B) Simulated phonon state population
$\langle\hat{b}^{\dagger}\hat{b}\rangle$ as a function of qubit drive power.
(C) Simulated second-order phonon correlations $g^{(2)}(0)$ as a function of
qubit drive power.

Following the calibration of the qubit spectrum, the phonon mode was included
in the master equation simulation. The value of the coupling rate $g_{\rm qb}$
and the phonon linewidth $\gamma_{\rm b}$ were determined by performing a fit
to the time domain gated two-tone measurements. The fit was determined by
fitting both the ringdown (as shown in the main text) and also the ring-up of
the qubit. The best-fit values were then compared at multiple drive powers;
see Fig. S5(a). We extracted a value of the qubit phonon coupling of $g_{\rm
qb}/2\pi=162$ kHz and a phonon linewidth of $\gamma_{\rm b}/2\pi=6.81$ kHz.
From this set of simulations, the steady-state phonon population and phonon
statistics can be estimated for multiple drive powers. We observe a good
agreement between the numerical simulation and the ring-up data and an
excellent agreement between the ringdown data for all powers. Deviations in
the ring-up simulations likely result from higher-order nonlinearities we are
not considering in our model.

The master equation simulations directly calculate the time dynamics of
$\langle\hat{\sigma}_{+}\hat{\sigma}_{-}\rangle$, this value has been scaled
by the same constant factor for all powers to give a direct comparison to our
two-tone measurement. Since we expect the variation in the transmission
coefficient measured in the two-tone measurement to be proportional to
$\langle\hat{\sigma}_{+}\hat{\sigma}_{-}\rangle$, see Eq. S3 and Ref. Gambetta
_et al._ (2006). From our simulation, we calculate the phonon population and
second-order correlation function for multiple drive powers, shown in Fig.
S5(b,c). For low drive powers, the phonon statistics are described by a
coherent state, $g^{(2)}(0)\approx 1.0$, as expected for a laser. However, as
discussed in the main text, single-atom lasers exhibit self-quenching above a
given upper-threshold power. This can be seen in both the phonon population,
as a rapid decrease in the populations, and in the phonon statistics as
$g^{(2)}(0)>1.0$ for drive powers above the self-quenching threshold.

Table 1: Symbols and parameters  Parameter | Symbol
---|---
Microwave mode frequency |  $\omega_{\rm c}=2\pi\times 4.910$ GHz
Microwave mode decay |  $\kappa=2\pi\times 2.897$ MHz
Phonon mode frequency |  $\omega_{\rm b}=2\pi\times 6.064$ GHz
Phonon mode decay |  $\gamma_{\rm b}=2\pi\times 6.81$ kHz
Qubit frequency |  $\Omega_{\rm q}=2\pi\times 6.067$ GHz
Qubit energy relaxation rate |  $\Gamma_{1}=2\pi\times 0.840$ MHz
Qubit phase relaxation rate |  $\Gamma_{\phi}<2\pi\times 0.08$ MHz
Qubit-phonon coupling |  $g_{\rm qb}=2\pi\times 162$ kHz
Dispersive cavity-qubit coupling |  $\chi=-2\pi\times 1.2$ MHz
Lamb-shifted qubit frequency | $\tilde{\Omega}_{\rm q}=\Omega_{\rm q}-\chi$
Qubit drive frequency |  $\omega_{\rm d}$, varied around $\Omega_{q}$
Cavity probe frequency |  $\omega_{\rm p}$, set at the Stark-shifted cavity frequency

## References

  * Schawlow (1982) A. L. Schawlow, “Spectroscopy in a new light,” Reviews of Modern Physics 54, 697 (1982).
  * Schawlow (1978) A. L. Schawlow, “Laser spectroscopy of atoms and molecules: The abundance of new laser techniques is making possible a variety of spectroscopic experiments.” Science 202, 141–147 (1978).
  * Phillips and Metcalf (1982) W. D. Phillips and H. Metcalf, “Laser deceleration of an atomic beam,” Physical Review Letters 48, 596 (1982).
  * Phillips (1998) W. D. Phillips, “Nobel lecture: Laser cooling and trapping of neutral atoms,” Reviews of Modern Physics 70, 721 (1998).
  * Anderson  _et al._ (1995) M. H. Anderson, J. R. Ensher, M. R. Matthews, C. E. Wieman, and E. A. Cornell, “Observation of bose-einstein condensation in a dilute atomic vapor,” science 269, 198–201 (1995).
  * Davis  _et al._ (1995) K. B. Davis, M.-O. Mewes, M. R. Andrews, N. J. van Druten, D. S. Durfee, D. Kurn, and W. Ketterle, “Bose-einstein condensation in a gas of sodium atoms,” Physical review letters 75, 3969 (1995).
  * Abbott  _et al._ (2016) B. P. Abbott, R. Abbott, T. Abbott, M. Abernathy, F. Acernese, K. Ackley, C. Adams, T. Adams, P. Addesso, R. Adhikari, _et al._ , “Observation of gravitational waves from a binary black hole merger,” Physical review letters 116, 061102 (2016).
  * Chaurasiya  _et al._ (2016) S. Chaurasiya, P. Hew, P. Crosley, D. Sharon, K. Potts, K. Agopsowicz, M. Long, C. Shi, and M. Hitt, “Breast cancer gene therapy using an adenovirus encoding human il-2 under control of mammaglobin promoter/enhancer sequences,” Cancer Gene Therapy 23, 178–187 (2016).
  * McCreery (2005) R. L. McCreery,  _Raman spectroscopy for chemical analysis_ (John Wiley & Sons, 2005).
  * Khalkhal  _et al._ (2019) E. Khalkhal, M. Rezaei-Tavirani, M. R. Zali, and Z. Akbari, “The evaluation of laser application in surgery: a review article,” Journal of lasers in medical sciences 10, S104 (2019).
  * Mahboob  _et al._ (2013) I. Mahboob, K. Nishiguchi, A. Fujiwara, and H. Yamaguchi, “Phonon lasing in an electromechanical resonator,” Phys. Rev. Lett. 110, 127202 (2013).
  * Vahala  _et al._ (2009) K. Vahala, M. Herrmann, S. Knünz, V. Batteiger, G. Saathoff, T. Hänsch, and T. Udem, “A phonon laser,” Nature Physics 5, 682–686 (2009).
  * Pettit  _et al._ (2019) R. M. Pettit, W. Ge, P. Kumar, D. R. Luntz-Martin, J. T. Schultz, L. P. Neukirch, M. Bhattacharya, and A. N. Vamivakas, “An optical tweezer phonon laser,” Nature Photonics 13, 402–405 (2019).
  * Kuang  _et al._ (2023) T. Kuang, R. Huang, W. Xiong, Y. Zuo, X. Han, F. Nori, C.-W. Qiu, H. Luo, H. Jing, and G. Xiao, “Nonlinear multi-frequency phonon lasers with active levitated optomechanics,” Nature Physics 19, 414–419 (2023).
  * Behrle  _et al._ (2023) T. Behrle, T. L. Nguyen, F. Reiter, D. Baur, B. de Neeve, M. Stadler, M. Marinelli, F. Lancellotti, S. F. Yelin, and J. P. Home, “Phonon laser in the quantum regime,” Phys. Rev. Lett. 131, 043605 (2023).
  * Shandilya  _et al._ (2021) P. K. Shandilya, D. P. Lake, M. J. Mitchell, D. D. Sukachev, and P. E. Barclay, “Optomechanical interface between telecom photons and spin quantum memory,” Nature Physics 17, 1420–1425 (2021).
  * Hatanaka  _et al._ (2022) D. Hatanaka, M. Asano, H. Okamoto, Y. Kunihashi, H. Sanada, and H. Yamaguchi, “On-chip coherent transduction between magnons and acoustic phonons in cavity magnomechanics,” Physical Review Applied 17, 034024 (2022).
  * Hatanaka  _et al._ (2023) D. Hatanaka, M. Asano, H. Okamoto, and H. Yamaguchi, “Phononic crystal cavity magnomechanics,” Physical Review Applied 19, 054071 (2023).
  * Cui  _et al._ (2021) K. Cui, Z. Huang, N. Wu, Q. Xu, F. Pan, J. Xiong, X. Feng, F. Liu, W. Zhang, and Y. Huang, “Phonon lasing in a hetero optomechanical crystal cavity,” Photonics Research 9, 937–943 (2021).
  * Zhang  _et al._ (2018) J. Zhang, B. Peng, Ş. K. Özdemir, K. Pichler, D. O. Krimer, G. Zhao, F. Nori, Y.-x. Liu, S. Rotter, and L. Yang, “A phonon laser operating at an exceptional point,” Nature Photonics 12, 479–484 (2018).
  * Grudinin  _et al._ (2010) I. S. Grudinin, H. Lee, O. Painter, and K. J. Vahala, “Phonon laser action in a tunable two-level system,” Phys. Rev. Lett. 104, 083901 (2010).
  * Potts  _et al._ (2021) C. A. Potts, E. Varga, V. A. S. V. Bittencourt, S. Viola-Kusminskiy, and J. P. Davis, “Dynamical backaction magnomechanics,” Physical Review X 11, 031053 (2021).
  * Parsa  _et al._ (2023) P. Parsa, P. K. Shandilya, D. P. Lake, M. E. Mitchell, and P. E. Barclay, “Feedback enhanced phonon lasing of a microwave frequency resonator,” arXiv preprint arXiv:2308.09130 (2023).
  * Kippenberg and Vahala (2008) T. J. Kippenberg and K. J. Vahala, “Cavity optomechanics: back-action at the mesoscale,” science 321, 1172–1176 (2008).
  * Bron and Grill (1978) W. Bron and W. Grill, “Stimulated phonon emission,” Physical Review Letters 40, 1459 (1978).
  * Wallentowitz  _et al._ (1996) S. Wallentowitz, W. Vogel, I. Siemers, and P. Toschek, “Vibrational amplification by stimulated emission of radiation,” Physical Review A 54, 943 (1996).
  * Camps  _et al._ (2001) I. Camps, S. Makler, H. Pastawski, and L. F. Torres, “Gaas- al x ga 1- x as double-barrier heterostructure phonon laser: A full quantum treatment,” Physical Review B 64, 125311 (2001).
  * McKeever  _et al._ (2003) J. McKeever, A. Boca, A. D. Boozer, J. R. Buck, and H. J. Kimble, “Experimental realization of a one-atom laser in the regime of strong coupling,” Nature 425, 268–271 (2003).
  * Dubin  _et al._ (2010) F. Dubin, C. Russo, H. G. Barros, A. Stute, C. Becher, P. O. Schmidt, and R. Blatt, “Quantum to classical transition in a single-ion laser,” Nature Physics 6, 350–353 (2010).
  * An  _et al._ (1994) K. An, J. J. Childs, R. R. Dasari, and M. S. Feld, “Microlaser: A laser with one atom in an optical resonator,” Physical review letters 73, 3375 (1994).
  * Mu and Savage (1992) Y. Mu and C. Savage, “One-atom lasers,” Physical Review A 46, 5944 (1992).
  * Ashhab  _et al._ (2009) S. Ashhab, J. Johansson, A. Zagoskin, and F. Nori, “Single-artificial-atom lasing using a voltage-biased superconducting charge qubit,” New Journal of Physics 11, 023030 (2009).
  * Bild  _et al._ (2023) M. Bild, M. Fadel, Y. Yang, U. von Lüpke, P. Martin, A. Bruno, and Y. Chu, “Schrödinger cat states of a 16-microgram mechanical oscillator,” Science 380, 274–278 (2023).
  * Gely and Steele (2021) M. F. Gely and G. A. Steele, “Superconducting electro-mechanics to test diósi-penrose effects of general relativity in massive superpositions,” AVS Quantum Science 3, 035601 (2021).
  * Schrinski  _et al._ (2023) B. Schrinski, Y. Yang, U. von Lüpke, M. Bild, Y. Chu, K. Hornberger, S. Nimmrichter, and M. Fadel, “Macroscopic quantum test with bulk acoustic wave resonators,” Phys. Rev. Lett. 130, 133604 (2023).
  * Wybourne and Wigmore (1988) M. Wybourne and J. Wigmore, “Phonon spectroscopy,” Reports on Progress in Physics 51, 923 (1988).
  * Romero-Isart  _et al._ (2011) O. Romero-Isart, A. C. Pflanzer, F. Blaser, R. Kaltenbaek, N. Kiesel, M. Aspelmeyer, and J. I. Cirac, “Large quantum superpositions and interference of massive nanometer-sized objects,” Phys. Rev. Lett. 107, 020405 (2011).
  * von Lüpke  _et al._ (2023) U. von Lüpke, I. C. Rodrigues, Y. Yang, M. Fadel, and Y. Chu, “Engineering phonon-phonon interactions in multimode circuit quantum acousto-dynamics,” arXiv preprint arXiv:2303.00730 (2023).
  * von Lüpke  _et al._ (2022) U. von Lüpke, Y. Yang, M. Bild, L. Michaud, M. Fadel, and Y. Chu, “Parity measurement in the strong dispersive regime of circuit quantum acoustodynamics,” Nature Physics 18, 794–799 (2022).
  * Chu  _et al._ (2018) Y. Chu, P. Kharel, T. Yoon, L. Frunzio, P. T. Rakich, and R. J. Schoelkopf, “Creation and control of multi-phonon fock states in a bulk acoustic-wave resonator,” Nature 563, 666–670 (2018).
  * Chu  _et al._ (2017) Y. Chu, P. Kharel, W. H. Renninger, L. D. Burkhart, L. Frunzio, P. T. Rakich, and R. J. Schoelkopf, “Quantum acoustics with superconducting qubits,” Science 358, 199–202 (2017).
  * Välimaa  _et al._ (2022) A. Välimaa, W. Crump, M. Kervinen, and M. A. Sillanpää, “Multiphonon transitions in a quantum electromechanical system,” Phys. Rev. Appl. 17, 064003 (2022).
  * Crump, Välimaa, and Sillanpää (2023) W. Crump, A. Välimaa, and M. A. Sillanpää, “Coupling high-overtone bulk acoustic wave resonators via superconducting qubits,” arXiv preprint arXiv:2307.05544 (2023).
  * Krantz  _et al._ (2019) P. Krantz, M. Kjaergaard, F. Yan, T. P. Orlando, S. Gustavsson, and W. D. Oliver, “A quantum engineer’s guide to superconducting qubits,” Applied physics reviews 6 (2019).
  * Reed  _et al._ (2010) M. Reed, L. DiCarlo, B. Johnson, L. Sun, D. Schuster, L. Frunzio, and R. Schoelkopf, “High-fidelity readout in circuit quantum electrodynamics using the jaynes-cummings nonlinearity,” Physical review letters 105, 173601 (2010).
  * Gambetta  _et al._ (2006) J. Gambetta, A. Blais, D. I. Schuster, A. Wallraff, L. Frunzio, J. Majer, M. H. Devoret, S. M. Girvin, and R. J. Schoelkopf, “Qubit-photon interactions in a cavity: Measurement-induced dephasing and number splitting,” Physical Review A 74, 042318 (2006).
  * Lachance-Quirion  _et al._ (2017) D. Lachance-Quirion, Y. Tabuchi, S. Ishino, A. Noguchi, T. Ishikawa, R. Yamazaki, and Y. Nakamura, “Resolving quanta of collective spin excitations in a millimeter-sized ferromagnet,” Science Advances 3, e1603150 (2017).
  * Schuster  _et al._ (2005) D. Schuster, A. Wallraff, A. Blais, L. Frunzio, R.-S. Huang, J. Majer, S. Girvin, and R. J. Schoelkopf, “ac stark shift and dephasing of a superconducting qubit strongly coupled to a cavity field,” Physical Review Letters 94, 123602 (2005).
  * Gordon, Zeiger, and Townes (1955) J. P. Gordon, H. J. Zeiger, and C. H. Townes, “The maser-new type of microwave amplifier, frequency standard, and spectrometer,” Physical review 99, 1264 (1955).
  * (50) “Scixel,” https://scixel.es/, accessed: 2023-09-28.
  * Thoen  _et al._ (2016) D. J. Thoen, B. G. C. Bos, E. Haalebos, T. Klapwijk, J. Baselmans, and A. Endo, “Superconducting nbtin thin films with highly uniform properties over a 100 mm wafer,” IEEE Transactions on Applied Superconductivity 27, 1–5 (2016).
  * Johansson, Nation, and Nori (2012) J. R. Johansson, P. D. Nation, and F. Nori, “Qutip: An open-source python framework for the dynamics of open quantum systems,” Computer Physics Communications 183, 1760–1772 (2012).