# Will the Prince Get True Love’s Kiss?
On the Model Sensitivity to Gender Perturbation over Fairytale Texts

Christina Chance 1 Da Yin 1 Dakuo Wang 2 Kai-Wei Chang 1
1 University of California, Los Angeles 2 Northeastern University

###### Abstract

Recent studies show that traditional fairytales are rife with harmful gender
biases. To help mitigate these gender biases in fairytales, this work aims to
assess learned biases of language models by evaluating their robustness
against gender perturbations. Specifically, we focus on Question Answering
(QA) tasks in fairytales. Using counterfactual data augmentation to the
FairytaleQA dataset, we evaluate model robustness against swapped gender
character information, and then mitigate learned biases by introducing
counterfactual gender stereotypes during training time. We additionally
introduce a novel approach that utilizes the massive vocabulary of language
models to support text genres beyond fairytales. Our experimental results
suggest that models are sensitive to gender perturbations, with significant
performance drops compared to the original testing set. However, when first
fine-tuned on a counterfactual training dataset, models are less sensitive to
the later introduced anti-gender stereotyped text.

##  1 Introduction

Fairytales, traditionally an oral form of storytelling, are used in various
cultures as a way to pass cultural norms and practices down through
generations. They are used in the classroom and at home to teach children
reading comprehension, story structure, and develop cultural literacy Westland
(1993).

However, it is known that there are strong gender biases within fairytales,
specifically embodied through stereotypes. Included in the cultural norms
defined in fairytales are gender roles and expectations; however, while
cultural norms have evolved over time, these fairytales have not, yet are
still purposed in the same way as decades earlier Isaza et al. (2023). In many
of these fairytales, the storyline consists of a brave, strong prince rescuing
a distressed, helpless princess with true love’s kiss. These stories are
filled with gender biases that cast harmful and limiting stereotypes on
various demographics. Repeatedly presenting children with gender bias
stereotypes has a negative impact on their confidence and places limitations
on their ability Pawłowska (2021).

In NLP, fairytales are useful for assessing narrative comprehension of models
due to the quantity and diversity of fairytales as well as their well-studied
use in education. Although existing question answering (QA) models perform
well on fairytale datasets like FairytaleQA Xu et al. (2022), we are curious
how much these models rely on learned gender stereotypes and if these models
will have consistent performance when presented with anti-gender stereotypes.
Inspired by the literature on gender bias evaluation and mitigation Maudslay
et al. (2019), we create counterfactual datasets to disrupt any learned
gender-biased correlations from the pre-trained Language Models (LMs) and pre-
trained Large LMs (LLMs). Specifically, we conduct our studies on FairytaleQA,
a narrative comprehension dataset for children in kindergarten to eighth
grade.

Figure 1: Original and counterfactual test example using the LLM-assisted
rule-based translation approach. The prediction of the FairytaleQA model
significantly changes after gender perturbation.

We use three different approaches to perform data augmentation, including
rule-based translation, LLM rewriting, and LLM-assisted rule-based
translation. The last two approaches leverage the power of LLMs to support
comprehensive rewriting for any text-domain. These approaches perform gender
perturbations by swapping gendered nouns _queen_ : _king_ while preserving the
ground truth labels.

The evaluation experiment initially tests pre-trained language models (LMs)
fine-tuned on the original FairytaleQA dataset. These models are then assessed
on counterfactual test data using different approaches. The results reveal a
consistent drop in performance, indicating a learned bias in the pre-trained
LMs. Next, we assess pre-trained LMs fine-tuned on the counterfactual
FairytaleQA dataset, testing them on the corresponding test data. Although
there’s a slight dip in the original FairytaleQA test set’s performance,
consistent improvements are observed across counterfactual test sets. This
suggests that while the overall model accuracy may decrease marginally, the
model becomes more robust and inclusive. Furthermore, when these models are
fine-tuned on a combined random 50% original and 50% counterfactual
FairytaleQA dataset, they outperform models solely fine-tuned on the
counterfactual dataset. This demonstrates that fine-tuning on both
counterfactual and original data supports both normative and counterfactual
gender roles. In essence, this study introduces an innovative approach to
counterfactual data augmentation, indicating that biases in pre-trained LMs
can be mitigated through fine-tuning on counterfactual data.

##  2 Related Works

Gender Biases in Fairytales. Within education and the social sciences, work
assessing the impact of gender bias in children’s stories has shown a
detrimental impact on children’s self-esteem. Westland (1993) showed that both
girls and boys age 9 to 11 benefited from stories that featured characters who
shared their gender identity as a hero. This work has led to the re-framing of
many stories within the classroom Temple (1993), like Hayik (2015) who showed
that introducing anti-sexist picture books to young girls led to them
beginning to challenge the status quo and push back on the gender biases they
were experiencing in their life, displaying the effect of these stories.

Language Model Gender Bias. Language models capture subtle and overt biases
from the training corpus which propagates through the use of the model Bender
et al. (2021). Many works have evaluated gender bias in contextualized word
embeddings and have presented various approaches around removing gender
associations in non-gendered words Basta et al. (2019); Zhao et al. (2019);
Bolukbasi et al. (2016); Cheng et al. (2022). Other methods have been
suggested, such as debasing co-reference resolution Zhao et al. (2018) or
adversarial learning to debias dialogue generation Liu et al. (2020), but no
approaches have had success in complete debiasing Gira et al. (2022). Although
these approaches have reduced gender biases in LM, they address only
occupational biases. Occupation bias refers to a form of discrimination based
on a person’s job or occupation, for example the assumption that all nurses
are female and all doctors are male. We chose to focus on FairytaleQA and
fairytale texts because the gender biases found in these texts, including
stereotypes and microaggressions, are out-of-domain from biases used in
current bias mitigation approaches. Many debiasing methods are not well-suited
to handle these specific biases present in fairytales.

Counterfactual Data Augmentation. Proposed by Lu et al. (2019), Counterfactual
Data Augmentation (CDA) is a corpus augmentation strategy that performs
transformations on the data to break underlying gender-biased correlations in
the model while preserving ground truth labels and accuracy. CDA is used in
various works to address occupational bias Maudslay et al. (2019). Many works
aimed to mitigate occupational bias as these biases are more apparent in word
embeddings. Other works have suggested improvements on the original CDA method
including Maudslay et al. (2019) which proposed Counterfactual Data
Substitution (CDS) which addresses duplication of text and name intervention.
Our goal in this work is to create a CDA approach that supports perturbations
beyond those developed to address occupation bias, including stereotype biases
and microagressions in which the biases are more present in latent themes
throughout the storylines. We use the work done by Zhao et al. (2018) as our
framework for the CDA approach.

##  3 Approaches & Evaluation

We utilize CDA to perform gender perturbations for the FairytaleQA dataset. We
perturb all pronouns and any gendered word, such as _princess_ or _seamstress_
, to its binary opposite gender, _prince_ and _tailor_ , respectively. These
gender perturbations are applied to the fairytale section, the question, and
the answer. We assess various approaches to CDA to find the most precise and
robust approach. The approaches presented vary within those two assessment
qualities as rule-based translation allows for more controlled augmentations,
and LLM rewriting allows for a more robust and expansive dictionary of gender
pairs.

Bias Scoring. The bias score delineates performance disparity. In our study,
we argue that the biases inherent in fairytales are not only perpetuated but
also intensified by the model’s pre-existing biases. We propose that
incorporating anti-stereotype examples during the finetuning process can
mitigate these biases. To assess debiasing effectiveness, we verify that the
model maintains consistency in output despite gender augmentations, signifying
a reduction in biased correlations. Moreover, when the model generates
accurate responses, we demonstrate that debiasing enhances overall
performance, especially for question types that require model reasoning.

Consideration of Names During CDA. We treat proper names as gender-neutral in
our approaches for several reasons. In the pursuit of gender debiasing
language models, we aim to break gendered associations with proper names. For
instance, assigning he/him pronouns to a name like _Cinderella_ challenges the
model’s default female association with the name. Moreover, language models
are primarily trained on Eurocentric and Western text, whereas the FairytaleQA
dataset is culturally diverse. Assuming gender based on names from cultures or
regions not covered in the model’s training data can introduce additional
biases. While some cultures have naming conventions, there are often
exceptions, and some names are gendered differently across cultures, making
accurate predictions challenging without sufficient cultural context.
Expecting the model to predict gender accurately across various cultures
contradicts the purpose of our work. To address this, future iterations of our
approach will explore the anonymization of proper names.

Rule-based translation. The rule-based translation approach to developing the
counterfactual dataset follows the approach in Zhao et al. (2018). Utilizing a
dictionary of in-domain gendered word pairs such as "seamstress: tailor",
gendered entities are swapped to the binary counterpart gender. The original
dictionary was curated by Amazon MTurk workers, but the dictionary used in
this work was modified to be in the domain of fairytales by the authors. The
methodology for this approach is further explained in Appendix A.1. This
approach allows intentional control over what words are being modified as well
as what they are being modified to. The limitation of this approach is that
the translation is based on a static dictionary.

LLM text rewriting. The LLM text rewriting approach uses the power and
knowledge of LLMs like ChatGPT to perform gender word translations. We use a
prompt, as shown in Table 4, to instruct generative LLMs to perform gender
augmentation on the fairytale section, question, and answer while maintaining
the original formatting. This approach allows for a larger scope for possible
word augmentation. One limitation of this approach is, while the prompt
specifies that only gendered nouns should be modified, the model also modifies
gendered adjectives and lacks consistency in what words are modified. In the
example below, we see that the LLM (i.e., ChatGPT in this work), modified
adjectives pertaining to a non-gendered noun "couple".
Original: "they were a very canty and contented couple, for they had enough to
live on, and enough to do ."
LLM Perturbed: "they were a very cheerful and contented couple, for they had
enough to live on, and enough to do ."

We additionally conduct human evaluation to verify the quality of swaps by
rating the perturbed examples on a scale from 1-5 on criteria including the
quality of the gender swaps, consistency of the storyline, consistency of the
gender swaps, and grammar. The results and details are reported in Appendix
A.2. We found that the LLM does well at maintaining the content of the story
and preserves grammatical correctness, but assumes the gender of non-gendered
words and performs unnecessary perturbations.

LLM assisted rule-based translation. The LLM-assisted rule-based translation
approach combines the precision of rule-based translation with the
adaptability of LLM text rewriting, overcoming some limitations of both
methods. Initially, an empty dictionary is used. Using POS tagging with NLTK
as the tokenizer, when the program encounters a noun or pronoun, it checks if
the word is in the dictionary. If the word is in the dictionary, the standard
rule-based translation is applied. If not, the word and a prompt (as described
in Table 5) are processed through a generative LLM to generate the opposite
binary gender word. This pair is then added to the dictionary, which is saved
and reused in subsequent runs. The approach’s drawback lies in the
computational and financial costs, as well as the unpredictability and
inconsistency of LLMs.

##  4 Experiments

We used two pre-trained LMs as our base models for fine-tuning on FairytaleQA:
T5 Raffel et al. (2020) and BART Lewis et al. (2020). For both models, we set
the number of epochs to 4, the learning rate to $5\times 10^{-5}$, and the
seed to 88 for reproducibility. We chose our hyperparameters and LMs based on
the prior work done by Xu et al. (2022) in order to attempt to reproduce those
results as our base for testing. In the original work, they chose BART as the
backbone of their fine-tuned models since it had the best performance for the
QA task using NarrativeQA. In our own analysis, we found that finetuned T5
actually outperformed finetuned BART for the FairytaleQA task, so we
additionally used T5. We used the ChatGPT API (`gpt-3.5-turbo`) as our LLM
model for augmentation since the ChatGPT API system is built on the GPT 3.5
architecture OpenAI (2023). We assess these models on the original and
counterfactual FairytaleQA and report the ROUGE-L Lin (2004) F1 scores as the
model performance. Additionally, we had a training/validation/testing split of
8:1:1 that was taken from the original dataset, in which the testing data is
unseen by the model at test time.

To assess the sensitivity of the models fine-tuned on the FairytaleQA dataset,
we perform three augmentation methods on the training, validation, and test
datasets in which we swap gendered nouns and pronouns, such as occupations or
familial titles, to the opposite gender. We do not consider proper names such
as _Cinderella_ as all names should be considered gender-neutral. For this
work, we are assuming a binary gender but in future work, plan to extend to
neutral gendered nouns and pronouns. To perform this augmentation, we use the
approaches mentioned in Section 3. We run two sets of experiments to assess
the bias in the dataset. The first experiment assesses the sensitivity of the
model fine-tuned with original data and the second experiment assesses the
sensitivity of the model fine-tuned with counterfactual data.

The size of the test set is small due to the difficulties of recruiting more
educational experts and of obtaining more examples. Additionally, we further
stratify the test set by question types as seen in the question type breakdown
in Table 3. We use this stratification to further access trends in
performance. This is further explained in Appendix A.3. In many tables, we
flag statistically significant values however, overall due to the small test
set it is difficult for that to occur. We therefore discuss performance based
on change in accuracy.

| Question
---
Type
Original |  | Rule-
---
Based
| LLM
---
Rewrite
| LLM-Assisted
---
Rule-Based
ALL | 65.29 | 64.38* | 63.53* | 62.66*
Setting | 89.61 | 87.87 | 87.92 | 85.25*
Character | 85.67 | 83.86 | 79.77* | 82.10*
Action | 74.70 | 74.48 | 72.84* | 72.08*
Outcome Res. | 56.94 | 53.80 | 55.00 | 57.46
Feeling | 49.41 | 48.47 | 47.49 | 43.75
Causal Rel. | 56.98 | 56.40 | 56.64 | 55.29*
Prediction | 35.57 | 34.98 | 35.28 | 33.31

Table 1: ROUGE-L F1 scores for the T5 model fine-tuned on the original
FairytaleQA dataset and tested on each CDA approach. * values are
statistically significant to the 95% confidence.

Gender Bias in Fairytale QA Models. We assess T5 and BART fine-tuned on the
original FairytaleQA training and validation data and test on the original and
counterfactual test data using each approach to assess the baseline biases in
the dataset. In Table 1, we see across all augmentation approaches a
significant drop in the performance of the T5 model compared to the original
test data suggesting that the model possesses some learned biases. We
additionally witness fairly consistent drops across all question types as
well, with some question types such as character and action having more
pronounced performance drops. In Table 9 for BART, we also witness consistent
changes in the performance of the model with some counterfactual data
outperforming the original data. Both tables suggest that the small
perturbation of changing the gender of characters in these fairytales has an
impact on models’ performance for the task of question answering.

AllSettingCharacterActionOutcome Res.FeelingCausal
Rel.Prediction$-2$$0$$2$$4$$6$Performance DifferenceOriginalRule-BasedLLMLLM-
Assisted Rule-Based

Figure 2: Performance difference of ROUGE-L F1 scores between T5 model fine-
tuned on 50% original + 50% counterfactual FairytaleQA and T5 model fine-tuned
on original FairytaleQA , a positive value showing an increase in performance.
Each colored bar represents the test set augmented with the given approach.

Fine-Tune with Gender CDA. We fine-tune T5 and BART using three different
combinations of the original and counterfactual FairytaleQA datasets to
observe the impact of integrating counterfactual training and validation into
the original sets. In the first combination, we use the complete
counterfactual training and validation sets. The second consists of random 50%
of the original and 50% of the counterfactual training and validation sets. We
avoid the duplication of questions and maintain the distribution of question
types in the dataset. The third is the full original and full counterfactual
training and validation FairytaleQA combined. We evaluate the models using the
same test data as the previous experiment for all three training and
validation combinations. We opt for the last two sets for fine-tuning to
prevent potential overfitting caused by doubling the training size when
combining the full and counterfactual sets.

In Figure 3, we compare the T5 model’s performance after fine-tuning on either
the counterfactual or the original training/validation set. The results
indicate improved performance across all counterfactual test sets. Notably,
the model fine-tuned on the random 50% counterfactual and 50% original
training/validation set (depicted in Figure 2, chart b) shows a smaller
performance drop for the original test set. For detailed ROUGE-L F1 scores of
the T5 model, refer to Table 6, and for the BART model, consult Table 7.

We additionally perform a quantitative analysis in Appendix A.4 on the
generated answers of the models finetuned on the original and counterfactual
training set to assess model bias. We do this by assessing the semantic
similarity of the generated output to see if the model outputs answers that
are significantly different, suggesting a bias of the model.

##  5 Conclusion

Training Set | Original |  | Rule-
---
Based
| LLM
---
Rewrite
| LLM-Assisted
---
Rule-Based
Original | 65.29 | 64.38 | 63.53 | 62.66
Augmented | 64.56 | 64.8 | 63.54 | 63.44
1/2 Orig. +1/2 Aug. | 65.04 | 65.07 | 64.19 | 63.28
Orig. + Aug. | 64.84 | 64.63 | 63.24 | 63.02

Table 2:  ROUGE-L F1 scores for the BART model fine-tuned on different
training sets augmented using each CDA approach.

In this work, we assessed the gender bias in pre-trained LMs for the
FairytaleQA dataset by analyzing the performance of the model on the
counterfactual FairytaleQA dataset generated using various approaches of CDA
(e.g., ChatGPT and rule-based). We found that the models were sensitive to
gender-perturbed data, but when fine-tuned on a combination of the original
and counterfactual data, had improved performance. We suggest that including
counterfactual data is good practice and with anticipated benefits in
downstream tasks and presented a novel approach to CDA that is generalizable
and adaptable across a variety of domains. More specifically, in the context
of fairytale text, this inclusion can allow for more gender-inclusive and
diverse stories in downstream tasks like generation.

## Limitations

We position our work in the normative gender binary which ignores other
marginalized groups like the non-binary and gender non-conforming people. In
future works, we plan to assess LMs on a more inclusive set of gender biases.

Additionally, we are still limited to the textual understanding of LLMs and
the limitations of common NLP tools. Its ability to handle less common words
impacts the gender augmentation results. For example, the NLTK tokenizer split
"didn’t" into "didn" and "t". ChatGPT assumed "didn" was a gendered word and
therefore produced the opposite gendered word of "dida". We chose to use NLTK
because it allowed us to create a regex tokenizer that supported the special
characters that appeared in the dataset which other tokenizers did not
support.

Furthermore, we only consider a singularity approach to gender bias. However,
there are more salient and intersectional forms of gender biases in fairytales
that contribute to the detrimental impact on young children like those around
beauty standards. Cultural expectations of beauty align with other forms of
bias like fatphobia, ageism, and colorism. Additionally present in fairytales
are themes of elitism and classism, all having significant impact on the
framing of class and wealth for children Panttaja (1993). Attempting to
mitigate one dimension of gender bias is a disservice Lalor et al. (2022) and
in future works, we plan to address many other dimensions with the
understanding that many of these dimensions intersect other "-isms" and
require more than small perturbations to mitigate Hopkins (1980).

## Ethics Statement

The goal of this work is to assess the gender biases learned in a model in the
context of fairytale text. The work aims to bring light to the impact and
usefulness of counterfactual data augmentation in helping mitigate gender
biases and provide anti-bias examples to the model. While our work is centered
on the normative view of gender, it can hopefully provide framing to assess
these biases outside of the normative view.

## References

  * Basta et al. (2019) Christine Basta, Marta R. Costa-jussà, and Noe Casas. 2019.  Evaluating the underlying gender bias in contextualized word embeddings.  In _Proceedings of the First Workshop on Gender Bias in Natural Language Processing_ , pages 33–39, Florence, Italy. Association for Computational Linguistics.
  * Bender et al. (2021) Emily M. Bender, Timnit Gebru, Angelina McMillan-Major, and Shmargaret Shmitchell. 2021.  On the dangers of stochastic parrots: Can language models be too big? In _Proceedings of the 2021 ACM Conference on Fairness, Accountability, and Transparency_ , FAccT ’21, page 610–623, New York, NY, USA. Association for Computing Machinery.
  * Bolukbasi et al. (2016) Tolga Bolukbasi, Kai-Wei Chang, James Zou, Venkatesh Saligrama, and Adam Kalai. 2016\.  Man is to computer programmer as woman is to homemaker? debiasing word embeddings.
  * Cheng et al. (2022) Lu Cheng, Nayoung Kim, and Huan Liu. 2022.  Debiasing word embeddings with nonlinear geometry.  In _Proceedings of the 29th International Conference on Computational Linguistics_ , pages 1286–1298, Gyeongju, Republic of Korea. International Committee on Computational Linguistics.
  * Gira et al. (2022) Michael Gira, Ruisu Zhang, and Kangwook Lee. 2022.  Debiasing pre-trained language models via efficient fine-tuning.  In _Proceedings of the Second Workshop on Language Technology for Equality, Diversity and Inclusion_ , pages 59–69, Dublin, Ireland. Association for Computational Linguistics.
  * Hayik (2015) Rawia Hayik. 2015.  Diverging from traditional paths: Reconstructing fairy tales in the efl classroom.  _Diaspora, Indigenous, and Minority Education_ , 9(4):221–236.
  * Hopkins (1980) Thomas J. Hopkins. 1980.  A conceptual framework for understanding the three isms’—racism, ageism, sexism.  _Journal of Education for Social Work_ , 16(2):63–70.
  * Isaza et al. (2023) Paulina Toro Isaza, Guangxuan Xu, Akintoye Oloko, Yufang Hou, Nanyun Peng, and Dakuo Wang. 2023.  Are fairy tales fair? analyzing gender bias in temporal narrative event chains of children’s fairy tales.
  * Lalor et al. (2022) John Lalor, Yi Yang, Kendall Smith, Nicole Forsgren, and Ahmed Abbasi. 2022.  Benchmarking intersectional biases in NLP.  In _Proceedings of the 2022 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies_ , pages 3598–3609, Seattle, United States. Association for Computational Linguistics.
  * Lewis et al. (2020) Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Veselin Stoyanov, and Luke Zettlemoyer. 2020.  BART: Denoising sequence-to-sequence pre-training for natural language generation, translation, and comprehension.  In _Proceedings of the 58th Annual Meeting of the Association for Computational Linguistics_ , pages 7871–7880, Online. Association for Computational Linguistics.
  * Lin (2004) Chin-Yew Lin. 2004.  ROUGE: A package for automatic evaluation of summaries.  In _Text Summarization Branches Out_ , pages 74–81, Barcelona, Spain. Association for Computational Linguistics.
  * Liu et al. (2020) Haochen Liu, Wentao Wang, Yiqi Wang, Hui Liu, Zitao Liu, and Jiliang Tang. 2020\.  Mitigating gender bias for neural dialogue generation with adversarial learning.  In _Proceedings of the 2020 Conference on Empirical Methods in Natural Language Processing (EMNLP)_ , pages 893–903, Online. Association for Computational Linguistics.
  * Lu et al. (2019) Kaiji Lu, Piotr Mardziel, Fangjing Wu, Preetam Amancharla, and Anupam Datta. 2019\.  Gender bias in neural natural language processing.
  * Maudslay et al. (2019) Rowan Hall Maudslay, Hila Gonen, Ryan Cotterell, and Simone Teufel. 2019.  It’s all in the name: Mitigating gender bias with name-based counterfactual data substitution.  In _Proceedings of the 2019 Conference on Empirical Methods in Natural Language Processing and the 9th International Joint Conference on Natural Language Processing (EMNLP-IJCNLP)_ , pages 5267–5275, Hong Kong, China. Association for Computational Linguistics.
  * OpenAI (2023) OpenAI. 2023.  Chatgpt.  https://openai.com/blog/chatgpt/.  Accessed on May 3, 2023.
  * Panttaja (1993) Elisabeth Panttaja. 1993.  Going up in the world: Class in "cinderella".  _Western Folklore_ , 52(1):85–104.
  * Pawłowska (2021) Joanna Pawłowska. 2021.  Gender stereotypes presented in popular children’s fairy tales.  _Society Register_ , 5:155–170.
  * Raffel et al. (2020) Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J. Liu. 2020.  Exploring the limits of transfer learning with a unified text-to-text transformer.
  * Temple (1993) Charles Temple. 1993.  "what if beauty had been ugly?" reading against the grain of gender bias in children’s books.  _Language Arts_ , 70(2):89–93.
  * Westland (1993) Ella Westland. 1993.  Cinderella in the classroom. children’s responses to gender roles in fairy-tales.  _Gender and Education_ , 5(3):237–249.
  * Xu et al. (2022) Ying Xu, Dakuo Wang, Mo Yu, Daniel Ritchie, Bingsheng Yao, Tongshuang Wu, Zheng Zhang, Toby Li, Nora Bradford, Branda Sun, Tran Hoang, Yisi Sang, Yufang Hou, Xiaojuan Ma, Diyi Yang, Nanyun Peng, Zhou Yu, and Mark Warschauer. 2022.  Fantastic questions and where to find them: FairytaleQA – an authentic dataset for narrative comprehension.  In _Proceedings of the 60th Annual Meeting of the Association for Computational Linguistics (Volume 1: Long Papers)_ , pages 447–460, Dublin, Ireland. Association for Computational Linguistics.
  * Zhang et al. (2020) Tianyi Zhang, Varsha Kishore, Felix Wu, Kilian Q. Weinberger, and Yoav Artzi. 2020\.  Bertscore: Evaluating text generation with bert.
  * Zhao et al. (2019) Jieyu Zhao, Tianlu Wang, Mark Yatskar, Ryan Cotterell, Vicente Ordonez, and Kai-Wei Chang. 2019.  Gender bias in contextualized word embeddings.  In _Proceedings of the 2019 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 1 (Long and Short Papers)_ , pages 629–634, Minneapolis, Minnesota. Association for Computational Linguistics.
  * Zhao et al. (2018) Jieyu Zhao, Tianlu Wang, Mark Yatskar, Vicente Ordonez, and Kai-Wei Chang. 2018\.  Gender bias in coreference resolution: Evaluation and debiasing methods.  In _Proceedings of the 2018 Conference of the North American Chapter of the Association for Computational Linguistics: Human Language Technologies, Volume 2 (Short Papers)_ , pages 15–20, New Orleans, Louisiana. Association for Computational Linguistics.

##  Appendix A Appendix

###  A.1 Rule-Based Translation Methodology

Following the approach of Zhao et al. (2018), we hand curate a dictionary of
gendered noun pairs in the domain of fairytale text, such as the gendered pair
_heir_ : _heiress_ and additionally add all pronoun pairs. We include both
words in a pair as a key, so _heir_ : _heiress_ would additionally be in the
dictionary. Also, we do not include proper nouns in this dictionary. We then
iterate through each token in the data checking if the token is in this
dictionary. If the token is in the dictionary as a key, we take the value of
the key-value pair to replace the key in the text. We also have special checks
for the pronoun "her" in which if the token word is her and part of speech is
pronoun personal, we swap that with _him_ otherwise we swap it with _his_.

###  A.2 CDA Human Evaluation.

To evaluate the quality of the perturbations, we perform human evaluation on a
subset of the data. The evaluator was one of the authors of the paper. In this
evaluation, we take a subset of the same 50 samples from the test data and
evaluate them on four criteria on a scale of 1 (not at all) to 5 (always). The
criteria assess the following:

  * •

Quality of swap. Does the gendered word pair semantically and contextually
make sense and are the correct words swapped?

  * •

Consistency of storyline. Does the storyline remain the same and make sense
despite the gender perturbations?

  * •

Consistency of swaps. Does the approach perturb the same word with the same
counterfactual pair every time?

  * •

Grammar. Is the story grammatically correct?

Using this criterion, we assessed the LLM rewriting approach that uses
ChatGPT. While the consistency of the content and grammatical correctness had
perfect average scores of 5.0/5.0, the quality of swaps scored an average of
4.08/5.0 and the consistency of swaps a 4.76/5.0. Across various examples of
the same fairytale section, there is an inconsistency in which words are
augmented and how they are augmented. We also witnessed that the LLM assumed
gender of words that are non-gendered like the words "pink" and "blue" or the
words "angel" and "demon". There was also an instance of rewording the story
so that the female character did not go off to war. We additionally assessed
the LLM-assisted rule-based translation approach also using ChatGPT and we
witnessed increase performance in quality swap (4.64/5.0) and consistency of
swap (4.86/5.0) but there was a drop in grammatical accuracy (4.5/5.0) due to
an issue with possessive pronouns. The issue with possessive pronouns is
plural pronouns are at times getting swapped with singular pronouns. In a
later iteration of the work prior to getting released, this issue will be
addressed.

###  A.3 Question Types Analysis

To better understand the change in performance amongst different question
types, we further classify the question types into abstractive and extractive
questions. We define abstractive question types as those in which the answer
is not explicitly in the model but requires the model to use the context
provided in the section. Abstractive question types include outcome
resolution, causal relationship, and prediction. Extractive question types are
those in which the answer is explicitly given in the text. These question
types include setting, character, action, and feeling.

Based on this classification, while we see in Table 1 an overall drop across
both classes of questions for T5, we witness that abstractive questions have a
smaller performance drop compared to extractive questions. A possible cause is
that the model has to reason beyond learned bias correlation in order to
successfully predict the answer. Due to this, the model is better at
abstracting and drawing conclusions from the text.

###  A.4 LLM Output Quantitative Assessment

Using the outputs of the models fine-tuned on the original FairytaleQA
dataset, we compare the generated output of the original test data with that
of the gender-perturbed test data to see what type of changes are present in
the predicted answer. We first collect the samples in which the ROUGE-L f1
score has a different accuracy compared to its unperturbed pair. We then use
the BERTscore Zhang et al. (2020) to assess the semantic similarity of the
generated answer from the original and counterfactual data as we found that
due to the gender perturbations, the ROUGE-L score does not successfully
capture similarity in output. Using the BERTscore, we expect that the
comparative BERTscore for the predicted answers in which only the gender
differs have an 1.0 BERTscore. With this understanding, we set a threshold of
0.5 for the BERTscore and flag the examples whose comparative BERTscores are
lower than 0.5. Within this set of test examples, we found that there were
very few instances of explicit bias produced by the model. For some examples,
the model produced unrelated text for some counterfactual test examples.
Examples of this behavior are in Table 8. In other instances, the model
produced more detailed answers that better aligned with the ground truth
answers.

Evaluation of Augmented Gendered Adjectives by LLM. To provide a transparent
quality check for the different CDA approaches used, we found word error rates
that align with the number of incorrectly modified adjectives and nouns in
both the LLM rewriting and LLM-assisted rule-based translation approaches.
Roughly for LLM rewriting the count of modified adjectives and nouns is 2872
and the word error rate compared to rule-based translation as the ground truth
is 0.0630 and match error rate is 0.0618. Roughly for LLM-assisted rule-based
translation, the count of modified adjectives and nouns is 2638 and the word
error rate compared to rule-based translation as the ground truth is 0.0537
and match error rate is 0.0537. These counts and metrics are for the testing
dataset which has 1007 examples. The word error rate and match error rate
account for all possible changes made including the adjectives that weren’t
gendered nouns and pronouns. These error rates are relatively small. In
further iterations, we plan to address the error rates for the LLM-assisted
rule-based translation approach.

| Question
---
Type
| Rule-
---
Based
| LLM
---
Rewrite
| LLM-
---
Assisted
Rule-
Based
| Total
---
Count
ALL | 99 | 119 | 132 | 1007
Setting | 2 | 2 | 4 | 62
Character | 3 | 11 | 5 | 103
Action | 22 | 27 | 33 | 315
Outcome Res. | 10 | 10 | 11 | 78
Feeling | 0 | 0 | 1 | 106
Causal Rel. | 54 | 54 | 64 | 278
Prediction | 8 | 15 | 14 | 65
Table 3: Question type count for outputs flagged as significantly modified
based on Appendix A.4 approach and the total number of questions per type in
test set. Rewrite the original text changing all gendered pronouns and nouns
referencing people to the opposite gender and maintain the format of the text:
---
[Original]: there once lived a poor widow who supported herself and her only
son by gleaning in the fields the stalks of grain that had been missed by the
reapers . he had big blue eyes , and fair golden curls , and he loved his good
mother very dearly , and was never more pleased than when she allowed him to
help her with her work . <SEP> how did the poor widow support herself and her
son ? <SEP> gleaning in the fields the stalks of grain that had been missed by
the reapers . </s> by gleaning in the fields the stalks of grain that had been
missed by the reapers . <SEP> action <SEP> explicit
[Rewritten]: there once lived a poor widower who supported himself and his
only daughter by gleaning in the fields the stalks of grain that had been
missed by the reapers . she had big blue eyes , and fair golden curls , and
she loved her good father very dearly , and was never more pleased than when
he allowed her to help him with his work . <SEP> how did the poor widower
support himself and his daughter? <SEP> gleaning in the fields the stalks of
grain that had been missed by the reapers . </s> by gleaning in the fields the
stalks of grain that had been missed by the reapers . <SEP> action <SEP>
explicit
[Original]: it so happened that the great man was walking in his garden with
his daughter madge that morning , so that when he suddenly looked up and saw a
little boy before him , he said , kindly , " well , my child , what can i do
for you ? " " if you please , sir , " said the boy , bravely , although he was
frightened at meeting the squire face to face , " i want you to give me some
work to do , so that i can earn money . " " to buy food for my mother , sir .
we are very poor , and since she is no longer able to work for me i wish to
work for her . " <SEP> what was the name of the man’s daughter ? <SEP> madge .
</s> madge . <SEP> character <SEP> explicit
[Rewritten]: it so happened that the great woman was walking in her garden
with her son madge that morning , so that when she suddenly looked up and saw
a little girl before her , she said , kindly , " well , my child , what can i
do for you ? " " if you please , ma’am , " said the girl , bravely , although
she was frightened at meeting the squire face to face , " i want you to give
me some work to do , so that i can earn money . " " to buy food for my father
, ma’am . we are very poor , and since he is no longer able to work for me i
wish to work for him . " <SEP> what was the name of the woman’s son ? <SEP>
madge . </s> madge . <SEP> character <SEP> explicit
[Original]:
Table 4:  Prompt for the LLM text rewriting approach. The fairytale, question,
and answer set is passed and the model performs gender augmentation of that
set.
Providing a pair of words, if the first word is gendered, the paired word is
the opposite gender of the original word, if the first word is gender neutral,
the paired word is the same word as the first word. Provide the word to
complete the pair.
---
prince -> princess
daughter -> son
bus -> bus
person -> person
teacher -> teacher
Table 5:  Prompt for the LLM-assisted rule-based translation approach. Each
noun in the fairytale, question, and answer set is passed and the model
produces the word pair based on the input.

| Augmented Data |  | 50% Original +
---
50% Augmented Data
| Full Original +
---
Full Augmented Data
| Question
---
Type
Orig. |  | Rule-
---
Based
| LLM
---
Rewrite
| LLM-
---
Assisted
Rule-
Based
Orig. |  | Rule-
---
Based
| LLM
---
Rewrite
| LLM-
---
Assisted
Rule-
Based
Orig. |  | Rule-
---
Based
| LLM
---
Rewrite
| LLM-
---
Assisted
Rule-
Based
ALL | 64.56 | 64.80 | 63.54 | 63.44 | 65.04 | 65.07 | 64.19 | 63.28 | 64.84 | 64.63 | 63.24 | 63.09
Setting | 90.15 | 88.66 | 86.69 | 86.13 | 89.61 | 88.40 | 88.54 | 84.06 | 90.18 | 88.88 | 86.61 | 84.46
Character | 84.12 | 85.18 | 83.09 | 82.98 | 85.02 | 87.24 | 81.95 | 83.75 | 84.65 | 84.41 | 80.16 | 84.07
Action | 74.38 | 74.44 | 72.66 | 73.01 | 74.59 | 74.29 | 73.92 | 73.19 | 76.11 | 75.67 | 74.58 | 73.22
Outcome Res. | 57.83 | 56.79 | 55.06 | 58.03 | 56.57 | 54.52 | 55.36 | 54.91 | 56.71 | 56.91 | 56.88 | 57.57
Feeling | 48.74 | 46.28 | 45.37 | 43.45 | 48.48 | 47.51 | 46.52 | 44.68 | 50.05 | 47.21 | 45.61 | 44.38
Causal Rel. | 54.53 | 56.53 | 56.44 | 55.19 | 55.90 | 57.57 | 56.67 | 55.50 | 53.42 | 55.65 | 54.68 | 54.77
Prediction | 38.25 | 38.20 | 36.44 | 38.92 | 39.92 | 36.38 | 37.20 | 36.64 | 37.46 | 32.74 | 32.23 | 33.10

Table 6: ROUGE-L F1 scores for the T5 model fine-tuned on the ruled-based
gender augmented FairytaleQA dataset (l.h.s.) and 50% of original + 50% of
rule-based gender augmented FairytaleQA dataset (center), and full original +
full rule-based gender augmented FairytaleQA dataset (r.h.s.) and tested on
the rule-based gender augmentation, LLM gender augmentation, and LLM assisted
rule based gender augmentation test dataset. Bold values indicate a
statistically significant increase to the 95% confidence compared to the
results in Table 1.

| Augmented Data |  | 50% Original +
---
50% Augmented Data
| Full Original +
---
Full Augmented Data
| Question
---
Type
Orig. |  | Rule-
---
Based
| LLM
---
Rewrite
| LLM-
---
Assisted
Rule-
Based
Orig. |  | Rule-
---
Based
| LLM
---
Rewrite
| LLM-
---
Assisted
Rule-
Based
Orig. |  | Rule-
---
Based
| LLM
---
Rewrite
| LLM-
---
Assisted
Rule-
Based
ALL | 60.28 | 59.97 | 58.70 | 59.31 | 60.40 | 58.97 | 58.88 | 59.65 | 60.59 | 60.68 | 59.20 | 60.07
Setting | 81.85 | 83.55 | 87.03 | 81.83 | 81.67 | 83.80 | 85.12 | 81.83 | 81.53 | 81.21 | 82.85 | 80.64
Character | 79.19 | 79.90 | 76.35 | 78.72 | 79.56 | 78.81 | 75.47 | 80.24 | 79.34 | 79.65 | 77.65 | 80.54
Action | 67.19 | 66.96 | 66.08 | 63.96 | 68.53 | 65.95 | 66.42 | 64.70 | 68.05 | 67.41 | 66.23 | 66.33
Outcome Res. | 56.89 | 56.52 | 53.91 | 53.44 | 55.09 | 52.24 | 58.08 | 58.67 | 59.08 | 59.26 | 61.69 | 57.09
Feeling | 47.20 | 45.18 | 41.85 | 48.14 | 42.91 | 41.97 | 40.99 | 45.74 | 41.76 | 45.33 | 40.59 | 46.28
Causal Rel. | 51.53 | 51.22 | 50.55 | 52.57 | 52.73 | 51.63 | 50.94 | 51.73 | 53.47 | 53.56 | 51.51 | 52.63
Prediction | 39.14 | 37.63 | 36.10 | 38.69 | 38.06 | 37.21 | 35.13 | 39.16 | 37.76 | 35.62 | 33.66 | 35.54

Table 7: ROUGE-L F1 scores for the BART model fine-tuned on the ruled-based
gender augmented FairytaleQA dataset (l.h.s.), 50% of original + 50% of rule-
based gender augmented FairytaleQA dataset (center), and full original + full
rule-based gender augmented FairytaleQA dataset (r.h.s.) and tested on the
rule-based gender augmentation, LLM gender augmentation, and LLM assisted rule
based gender augmentation test dataset. Bold values indicate a statistically
significant increase to the 95% confidence compared to the results in Table 9.

Approach | Question |  | Ground Truth
---
Answer
| Question
---
Type
| Original
---
Prediction
| Counterfactual
---
Prediction
| LLM
---
Rewrite
| why didn’t the
---
widowed mistress
tease the old
woman anymore ?
| the widowed mistress
---
became angry at her .
| causal
---
relationship
she was mad. |  | he was not
---
a beauty.
| LLM
---
Rewrite
| why did maie want to
---
possess a fairy cow ?
| she heard about the
---
fairy cow from the
young men .
| causal
---
relationship
| ahti was a
---
mighty king.
| he wanted to
---
be a princess.
| LLM
---
Rewrite
who was the king’s son ? | the gentleman . | character | he. |  | the young
---
woman.
Rule-Based |  | what happened after
---
the king returned
to the cottage ?
| it was empty , and none
---
could inform his where
his bride had gone .
| outcome
---
resolution
| she went back to her
---
father the old duke.
| she persuaded
---
her husband to
marry her.
Rule-Based |  | why did maie row out
---
to sea on sunday night ?
| she needed to sing the
---
magic rhyme .
| causal
---
relationship
| she wanted to sing a
---
song to the fairies.
he was annoyed.
| LLM-
---
Assisted
| what will the widowed
---
mistress do the next day ?
| sit in her kitchen and cry ,
---
and hug her baby tighter
in her arms .
prediction |  | go for a walk in the fir
---
wood behind the house.
| call back for
---
the girl.
| LLM-
---
Assisted
| why was the happy hunter
---
surprised to see the two
beautiful women ?
| he naturally supposed that
---
the place was inhabited
by dragons and
similar terrible creatures .
| causal
---
relationship
| the mikoto ( augustness )
---
had always heard that
ryn gu was the realm of
the dragon king under
the sea, and had naturally
assumed that the place was
inhabited by dragons and
similar terrible creatures.
| they were a
---
beautiful prince.

Table 8: Examples of T5 fine-tuned on FairytaleQA model output for the
original and counterfactual test data where there are significant semantic
differences in outputs.

| Question
---
Type
Original |  | Rule-
---
Based
| LLM
---
Rewrite
| LLM-
---
Assisted
Rule-
Based
ALL | 59.12 | 59.73* | 59.02 | 59.31
Setting | 85.49 | 84.30 | 86.60 | 81.83
Character | 80.58 | 80.42 | 79.01 | 78.72
Action | 65.17 | 66.68* | 65.91 | 63.96*
Outcome Res. | 57.07 | 60.69 | 57.79 | 53.44
Feeling | 41.87 | 41.87 | 39.96 | 48.14
Causal Rel. | 51.77 | 51.24 | 50.86 | 52.57
Prediction | 32.74 | 34.20 | 35.11 | 38.69

Table 9: ROUGE-L F1 scores for the BART model fine-tuned on the original
FairytaleQA dataset and tested on each CDA approach. * values are
statistically significant to the 95% confidence.
AllSettingCharacterActionOutcome Res.FeelingCausal
Rel.Prediction$-2$$0$$2$$4$$6$Performance DifferenceOriginalRule-BasedLLMLLM
Assisted Rule-Based Figure 3: Performance difference of ROUGE-L F1 scores
between T5 model fine-tuned on counterfactual FairytaleQA and T5 model fine-
tuned on original FairytaleQA , a positive value showing an increase in
performance. Each colored bar represents the test set augmented with the given
approach.


# Manipulating non-reciprocity in a two-dimensional magnetic quantum walk

Quan Lin  Beijing Computational Science Research Center, Beijing 100084, China
Wei Yi<EMAIL_ADDRESS>CAS Key Laboratory of Quantum Information, University
of Science and Technology of China, Hefei 230026, China  CAS Center For
Excellence in Quantum Information and Quantum Physics, Hefei 230026, China
Peng Xue<EMAIL_ADDRESS>Beijing Computational Science Research Center,
Beijing 100084, China

###### Abstract

Non-reciprocity is an important topic in fundamental physics and quantum-
device design, as much effort has been devoted to its engineering and
manipulation. Here we experimentally demonstrate non-reciprocal transport in a
two-dimensional quantum walk of photons, where the directional propagation is
highly tunable through dissipation and synthetic magnetic flux. The non-
reciprocal dynamics hereof is a manifestation of the non-Hermitian skin
effect, with its direction continuously adjustable through the photon-loss
parameters. By contrast, the synthetic flux originates from an engineered
geometric phase, which competes with the non-Hermitian skin effect through
magnetic confinement. We further demonstrate how the non-reciprocity and
synthetic flux impact the dynamics of the Floquet topological edge modes along
an engineered boundary. Our results exemplify an intriguing strategy for
achieving tunable non-reciprocal transport, highlighting the interplay of non-
Hermiticity and gauge fields in quantum systems of higher dimensions.

Open quantum systems are ubiquitous in nature, and exhibit rich and complex
behaviors unknown to their closed counterparts openbook . The recent
progresses in non-Hermitian physics offer fresh insights into open systems
from a unique perspective, giving rise to exotic symmetries and new paradigms
of topology benderreview ; review2 ; photonpt1 ; review3 ; nonHtopo1 ;
nonHtopo2 ; Lee ; WZ1 . A much studied non-Hermitian phenomenon of late is the
non-Hermitian skin effect (NHSE) WZ1 ; WZ2 ; murakami ; ThomalePRB ; stefano ;
tianshu ; Budich ; mcdonald ; alvarez ; lli ; yzsgbz ; stefano2 ; lyc ;
fangchenskin2 ; teskin ; photonskin ; metaskin ; scienceskin ; teskin2d ; dzou
; fangchenskin ; kawabataskin , whereby a macroscopic number of eigenstates
become exponentially localized toward the boundaries. The NHSE has significant
impact on the band topology WZ1 ; WZ2 ; murakami , the spectral symmetry
nonblochpt1 ; nonblochpt2 ; XDW+21 , and dynamics quench1 ; quench2 ; coldatom
. One of the most salient dynamic signatures of the NHSE is the directional
bulk flow stefano ; coldatom ; ql ; ql2 , which is closely connected to the
global topology of the spectrum on the complex plane fangchenskin . Such non-
reciprocal dynamics can have potential applications in topological transport
and quantum-device design, but the generation and control of this peculiar
form of non-reciprocity, particularly in higher dimensions, remain
experimentally unexplored.

In this work, we experimentally demonstrate the tuning of non-reciprocal
transport in photonic quantum walks on a synthetic two-dimensional square
lattice. The non-reciprocal dynamics underlies the NHSE of the two-dimensional
quantum walk—the unidirectional flow leads to the accumulation of eigenstates
toward boundaries in the corresponding direction. By tuning the photon-loss
parameters, we show how the direction of the flow (hence the direction of the
NHSE) can be continuously adjusted. The much discussed corner skin effect in
two dimensions is but a special case here, corresponding to a directional flow
along the diagonal of the square lattice. By engineering the quantum-walk
setup, we also introduce a synthetic flux to the lattice hof ; sai , which we
observe to suppress the non-reciprocal dynamics. Such a suppression is the
result of the competition between two localization mechanisms: magnetic
confinement and NHSE chenwei . We quantitatively characterize the tunability
of the non-reciprocity through loss and flux, and further demonstrate their
impact on the dynamics of topological edge modes along the boundary. Our
experiment is the first observation of the magnetic suppression of NHSE, and
further illustrates the flexible control over the NHSE-induced non-reciprocity
in higher dimensions.

Figure 1: Two-dimensional non-Hermitian quantum walk with a synthetic gauge
field. a Schematics for possible movements of a walker at spatial position
$(x,y)$ during each time step. b A time-multiplexed implementation of the two-
dimensional photonic quantum walk. The photons are initialized at position
$(0,0)$ in the superposition of the polarizations
$(\ket{H}+i\ket{V})/\sqrt{2}$. Once coupled into the setup through a low-
reflectivity beam splitter (BS, reflectivity $3\%$), their polarization state
is manipulated by a half-wave plate (HWP). The photonic wave packets are split
by a polarizing beam splitter (PBS) and routed through a pair of single-mode
fibers (SMF) of length $287.03$m and $270$m, respectively, implementing a
temporal step in the $x$ direction. A temporal step in the $y$ direction is
implemented by another two-PBS loop based on the same principle, but in the
free space instead of fibers. At each step, photons are partially coupled out
to a polarization resolving detection of the arrival time via avalanche
photodiodes (APDs). ND: neutral density filter; AOM: optical switch acousto-
optic modulator; EOM: electro-optic modulator. c Illustration of the operation
sequence of the time-multiplexed quantum walk. Here $V_{\text{EOM}}$ is the
control voltage applied to the EOMs.  Figure 2: Tunable non-reciprocity and
NHSE. The walker with the polarization $(\ket{H}+i\ket{V})/\sqrt{2}$ starts
from the lattice site $(0,0)$ with $\alpha=0$. Probability distributions are
measured after $16$ time steps. a Probability distribution for a Hermitian
two-dimensional quantum walk with $\gamma_{x}=\gamma_{y}=0$. b Probability
distribution following a non-Hermitian quantum walk with
$\gamma_{x}=\gamma_{y}=0.125$. c Directional displacements after the final
time step ($t=16$) for quantum walks with varying $\gamma_{x}$ and
$\gamma_{y}$. (Left) Color contour of the azimuthal angle of the displacement
$\bm{d}$ on the $x$–$y$ plane. (Right) Measured (blue arrows) and simulated
(gray arrows) of the displacement along the red vertical line of the color
contour (left panel). d Probability distribution following a non-Hermitian
quantum walk in the presence of domain walls (marked by red dashed lines),
with $\gamma_{x}=0.125$ for $x\geq-6$, $\gamma_{x}=-0.125$ for $x<-6$,
$\gamma_{y}=0.125$ for $y\geq-6$, and $\gamma_{y}=-0.125$ for $y<-6$.  Figure
3: Magnetic suppression of the non-reciprocal transport. The walker is
initialized in the state
$\frac{1}{\sqrt{2}}(\ket{H}+i\ket{V})\otimes\ket{x=0}\ket{y=0}$. Measured
probability distributions of $16$-time-step quantum walks with the tuning
parameter $\alpha=0.05$, and the loss parameter $\gamma_{x}=0$,
$\gamma_{y}=0.1$ in a, with $\alpha=0.15$, $\gamma_{x}=0$, and
$\gamma_{y}=0.1$ in b, with $\alpha=0.05$ and $\gamma_{x}=\gamma_{y}=0.1$ in
c, and with $\alpha=0.15$ and $\gamma_{x}=\gamma_{y}=0.1$ in d. e Norm of the
directional displacement $\bm{d}$ for $16$-time-step quantum walks under
different flux $\alpha$. Symbols represent the experimental data, and curves
are the corresponding numerical simulations. Error bars are due to the
statistical uncertainty in photon-number-counting. f Measured (blue) and
simulated (gray) $\bm{d}$. Blue arrows represent the experimental results, and
gray ones indicate the corresponding numerical simulations.

Results

Time-multiplexed two-dimensional quantum walk. In discrete-time quantum walks,
the walker state $|\psi(t)\rangle$ evolves according to
$|\psi(t)\rangle=U^{t}|\psi(0)\rangle$, where $t$ indicates the discrete time
steps, and $U$ is thus identified as the Floquet operator that periodically
drives the system. We consider such a quantum walk on a two-dimensional square
lattice, with the Floquet operator

$U=M_{y}S_{y}PCM_{x}S_{x}C.$ (1)

Here the shift operators are defined as
$S_{j}=\sum_{\bm{r}}\ket{0}\bra{0}\otimes\ket{\bm{r}-\bm{e}_{j}}\bra{\bm{r}}+\ket{1}\bra{1}\otimes\ket{\bm{r}+\bm{e}_{j}}\bra{\bm{r}}$,
with $\bm{r}=(x,y)\in\mathbb{Z}^{2}$ labeling the coordinates of the lattice
sites, $j\in\\{x,y\\}$, and $\bm{e}_{x}=(1,0)$ and $\bm{e}_{y}=(0,1)$. The
shift operators move the walker in the corresponding directions, depending on
the walker’s internal degrees of freedom in the basis of
$\\{|0\rangle,|1\rangle\\}$ (dubbed the coin states). These coin states are
subject to rotations under the coin operator
$C=\frac{1}{\sqrt{2}}\begin{pmatrix}1&1\\\
1&-1\end{pmatrix}\otimes\mathds{1}_{\bm{r}}$, where
$\mathds{1}_{\bm{r}}=\sum_{\bm{r}}\ket{\bm{r}}\bra{\bm{r}}$. The gain-loss
operators are given by (here $j\in\\{x,y\\}$)

$\displaystyle M_{j}(\gamma_{j})=\begin{pmatrix}e^{\gamma_{j}}&0\\\
0&e^{-\gamma_{j}}\end{pmatrix}\otimes\mathds{1}_{\bm{r}},$ (2)

which make the quantum walk non-unitary for finite $\gamma_{x}$ or
$\gamma_{y}$.

A key ingredient to our scheme is the phase-shift operator, defined as

$P=\sum_{\bm{r}}\begin{pmatrix}e^{i2\pi\alpha x}&0\\\ 0&e^{-i2\pi\alpha
x}\end{pmatrix}\otimes\ket{\bm{r}}\bra{\bm{r}},$ (3)

which enforces a position-dependent geometric phase on the walker, so that the
latter acquires a phase $2\pi\alpha$ when going around any single plaquette of
the square lattice (see Fig. 1a). Similar to that of the Hofstadter model hof
, the accumulated phase shift of the walker on the lattice is equal to the
Aharonov-Bohm phase of a charged particle in a uniform magnetic field, with a
magnetic flux $\alpha$ threaded through each plaquette. We therefore regard
$\alpha$ as the synthetic flux, which takes value in the range
$\left[0,1\right)$.

We experimentally implement the two-dimensional quantum walk above using
photons. As illustrated in Fig. 1, the overall architecture is that of a fiber
network sch ; ql ; ql2 , through which attenuated single-photon pulses are
sent, with each full cycle around the network representing a discrete time
step. The coin states $\\{|0\rangle,|1\rangle\\}$ are encoded in the photon
polarizations $\\{|H\rangle,|V\rangle\\}$. The spatial degrees of freedom of
the square lattice are encoded in the time domain, following a time-
multiplexed scheme. This is achieved by building path-dependent time delays
into the four different paths (labeled $x\pm 1$ and $y\pm 1$ in Fig. 1a)
within the network (see Methods for details). The superpositions of multiple
well-resolved pulses within the same discrete time step thus represent those
of multiple spatial positions at the given time step (see Fig. 1b).

The shift and coin operators are implemented with beam splitters (BSs) and
wave plates (WPs), and the phase operator with one of the electro-optical
modulators (EOM1 in Fig. 1). We further implement polarization-dependent loss
operators $M^{\prime}_{j}=e^{-\gamma_{j}}M_{j}$ in each path, using a
combination of the WPs and the EOMs. The time-evolved state driven by $U$ is
then related to that in the experiment by adding a factor
$e^{(\gamma_{x}+\gamma_{y})t}$ to the latter.

For all experiments, avalanche photo-diodes (APDs) with temporal and
polarization resolutions are employed to record the probability distribution
of the walker states. This enables us to construct the site-resolved
population of the synthetic lattice, with

$\displaystyle P_{\text{exp}}(x,y,t)=\frac{N(x,y,t)}{\sum_{x,y}N(x,y,t)},$ (4)

where $N(x,y,t)$ is the total photon number on site $(x,y)$ at time $t$.

Figure 4: Dynamic detection of topological edge modes in $16$-time-step two-
dimensional magnetic quantum walks. The walker is initialized in the state
$\frac{1}{\sqrt{2}}(\ket{H}+i\ket{V})\otimes\ket{x=0}\ket{y=0}$ under a
domain-wall geometry. Specifically, in a, b, c, we set $\alpha=0.05$ for
$x\leq 0$, and $\alpha=-0.05$ for $x>0$. In d, e, f, we set $\alpha=1/3$ for
$x\leq 0$, and $\alpha=-1/3$ for $x>0$. The left, middle, and right columns
show the measured probability distribution with the parameters
$\gamma_{x}=\gamma_{y}=0$, $\gamma_{x}=0.1,\gamma_{y}=0$, and
$\gamma_{x}=\gamma_{y}=0.1$, respectively.

NHSE and tunable non-reciprocity. In the absence of flux, quantum walks driven
by $U$ already show non-reciprocal transport under finite photon losses. In
Fig. 2a, we show the measured populations of the synthetic lattice sites after
$t=16$ time steps. Starting from a local initial state at $\bm{r}=(0,0)$, the
propagation in the synthetic spatial dimensions is symmetric along the four
lattice directions (Fig. 2a). However, under finite photon-loss parameters,
the final-time photon distribution becomes asymmetric with a preferred
direction. Such a directional flow is the signature of the non-reciprocal
transport. For instance, when $\gamma_{x}=\gamma_{y}\neq 0$, as shown in Fig.
2b, the flow is diagonal to the square lattice. By tuning the ratio of
$\gamma_{y}/\gamma_{x}$, we can continuously adjust the direction of the
asymmetric pattern. This is explicitly shown in Fig. 2c, where we define the
directional displacement

$\displaystyle\bm{d}(t)=\sum_{x,y}\bm{r}P_{\text{exp}}(x,y,t).$ (5)

As $\gamma_{y}/\gamma_{x}$ varies, the direction of the displacement at the
final time step can be continuously tuned (see the left panel of Fig. 2c). In
our experiment, we adjust $\gamma_{y}/\gamma_{x}$ in the range of $[-1,1]$ for
$16$-time-step quantum walks. Correspondingly, the measured polar angle of
$\bm{d}$ changes from $3\pi/4$ to $-3\pi/4$ (the right panel of Fig. 2c).

Underlying this loss-induced directional flow is the NHSE in two dimensions.
While it is straightforward to show that the direction of the non-reciprocal
transport also indicates the direction of the eigenstate accumulation under
the open boundary condition supp , from an experimental perspective, we
observe the dynamic localization of the walker toward the boundary when a
domain-wall boundary condition is imposed (see Fig. 2d). Combined with the
theoretical spectral analysis that there are no topological edge states
present under the parameters of Fig. 2d, it is clear that the localization is
due to the NHSE.

Magnetic suppression of the NHSE. In Figs. 3a-d, we show the final population
distribution with the synthetic flux switched on, following $16$-time-step
quantum walks. Compared to Fig. 2, the directional flow appears to be
increasingly suppressed under larger $\alpha$, regardless of its direction. In
Figs. 3e and f, we show the absolute values of the directional displacement
$\bm{d}$ as functions of $\alpha$, for various loss parameters. The
suppression is the largest when $\alpha$ is tuned in between $0$ and $0.5$.
Such a suppression reflects the competition between the magnetic confinement
and the NHSE, and can be used for the manipulation of the non-reciprocal
transport.

Impact on topological edge states. In the absence of loss, the Floquet
operator $U$ describes an anomalous Floquet Chern insulator, characterized by
the Floquet topological invariant sai ; asb ; rud , which can be calculated
for each quasienergy gap and is fully responsible for the topological edge
states. Here we experimentally investigate how the NHSE under loss and
magnetic confinement impact the topological edge states. For this purpose, we
engineer a domain-wall configuration by choosing different values of $\alpha$
on either side of $x=0$.

As shown in Fig. 4a, for lossless quantum walks, a pair of topological edge
modes emerge, moving in opposite directions along the boundary. This is
consistent with the prediction of the Floquet topological invariant (see
Methods and supp ). When only the loss parameter $\gamma_{x}$ is turned on,
the NHSE induces a horizontal directional flow toward the region with $x<0$.
From the measured population following a $16$-time-step quantum walk (see Fig.
4b), both the bulk flow and the topological edge states are clearly visible.
Since the directional flow is perpendicular to the boundary, it has no direct
impact on the motion of the topological edge states. This is no longer the
case when both $\gamma_{x}$ and $\gamma_{y}$ become finite, as in Fig. 4c.
Here, besides a diagonal bulk flow induced by the corner skin effect, the
topological edge modes moving in the negative (positive) $y$ direction are
enhanced (suppressed) by the NHSE.

In Figs. 4d-f, we show the final probability distribution under a larger
synthetic flux $\alpha$. Compared to Figs. 4a-c, the bulk propagation is
significantly suppressed, whereas the topological edge modes are largely
unaffected by flux. This suggests that magnetic confinement is helpful for the
dynamics detection of topological edge modes in systems with the NHSE.

Discussion. We have experimentally demonstrated how the interplay of synthetic
flux and dissipation enables the full control over the non-reciprocal
transport underlying the NHSE. Since the quantum walk simulates an anomalous
Floquet Chern insulator, we further illustrate how the motion of topological
edge modes on the boundary is affected by the tuning parameters. While the
high tunability can be exploited for topological device design, our
implementation of a dissipative anomalous Floquet Chern insulator further
raises theoretical questions as to how the NHSE affects the bulk-boundary
correspondence herein. Our experiment also paves the way for engineering more
exotic forms of the non-Hermitian skin effect in higher dimensions
fangchenskin2  using quantum-walk dynamics.

## References

  * (1) Breuer, H. P. & Petruccione, F. The Theory of Open Quantum Systems. (Oxford University Press, 2007).
  * (2) Bender, C. M. Making sense of non-Hermitian Hamiltonians. Rep. Prog. Phys. 70, 947 (2007).
  * (3) El-Ganainy, R. et al. Non-Hermitian physics and PT symmetry. Nat. Phys. 14, 11-19 (2018).
  * (4) Miri, M.-A. & Alù, A. Exceptional points in optics and photonics. Science 363, eaar7709 (2019).
  * (5) Ashida, Y., Gong, Z. & Ueda, M. Non-Hermitian physics. Advances in Physics 69, 3 (2020).
  * (6) Kawabata, K., Shiozaki, K., Ueda, M. & Sato, M. Symmetry and topology in non-Hermitian physics. Phys. Rev. X 9, 041015 (2019).
  * (7) Zhou, H. & Lee, J. Y. Periodic table for topological bands with non-Hermitian symmetries. Phys. Rev. B 99, 235112 (2019).
  * (8) Lee, T. E. Anomalous edge state in a non-Hermitian lattice. Phy. Rev. Lett. 16, 133903 (2016).
  * (9) Yao, S. & Wang, Z. Edge states and topological invariants of non-Hermitian systems. Phy. Rev. Lett. 121, 086803 (2018).
  * (10) Yao, S., Song, F. & Wang, Z. Non-Hermitian Chern bands. Phy. Rev. Lett. 121, 136802 (2018).
  * (11) Yokomizo, K. & Murakami, S. Non-Bloch band theory of non-Hermitian systems. Phy. Rev. Lett. 123, 066404 (2019).
  * (12) Lee, C. H. & Thomale, R. Anatomy of skin modes and topology in non-Hermitian systems. Phys. Rev. B 99, 201103 (2019).
  * (13) Longhi, S. Probing non-Hermitian skin effect and non-Bloch phase transitions. Phys. Rev. Research 1, 023013 (2019).
  * (14) Deng, T.-S. & Yi, W. Non-Bloch topological invariants in a non-Hermitian domain wall system. Phys. Rev. B 100, 035102 (2019).
  * (15) Kunst, F. K., Edvardsson, E., Budich, J. C. & Bergholtz, E. J. Biorthogonal bulk-boundary correspondence in non-Hermitian systems. Phy. Rev. Lett. 121, 026808 (2018).
  * (16) McDonald, A., Pereg-Barnea, T. & Clerk, A. Phase-dependent chiral transport and effective non-Hermitian dynamics in a bosonic Kitaev-Majorana chain. Phys. Rev. X 8, 041031 (2018).
  * (17) Alvarez, V. M., Vargas, J. B. & Torres, L. F. Non-Hermitian robust edge states in one dimension: Anomalous localization and eigenspace condensation at exceptional points. Phys. Rev. B 97, 121401 (2018).
  * (18) Li, L., Lee, C. H., Mu, S. & Gong, J. Critical non-Hermitian skin effect. Nat. Commun. 11, 5491 (2020).
  * (19) Yang, Z., Zhang, K., Fang, C. & Hu, J. Non-Hermitian bulk-boundary correspondence and auxiliary generalized Brillouin zone theory. Phys. Rev. Lett. 125, 226402 (2020).
  * (20) Longhi, S. Self-healing of non-Hermitian topological skin modes. Phy. Rev. Lett. 128, 157601 (2022).
  * (21) Li, Y., Liang, C., Wang, C., Lu, C. & Liu, Y.-C. Gain-loss-induced hybrid skin-topological effect. Phy. Rev. Lett. 128, 223903 (2022).
  * (22) Zhang, K., Yang, Z. & Fang, C. Universal non-Hermitian skin effect in two and higher dimensions. Nat. Commun. 13, 2496 (2022).
  * (23) Helbig, T. et al. Generalized bulk–boundary correspondence in non-Hermitian topolectrical circuits. Nat. Phys. 16, 747 (2020).
  * (24) Xiao, L. et al. Non-Hermitian bulk–boundary correspondence in quantum dynamics. Nat. Phys. 16, 761 (2020).
  * (25) Ghatak, A., Brandenbourger, M., Van Wezel, J. & Coulais, C. Observation of non-Hermitian topology and its bulk–edge correspondence in an active mechanical metamaterial. Proc. Natl. Acad. Sci. 117, 29561 (2020).
  * (26) Weidemann, S. et al. Topological funneling of light. Science 368, 311-314 (2020).
  * (27) Hofmann, T. et al. Reciprocal skin effect and its realization in a topolectrical circuit. Phys. Rev. Research 2, 023265 (2020).
  * (28) D. Zou. et al. Observation of hybrid higher-order skin-topological effect in non-Hermitian topolectrical circuits. Nat. Commun. 12, 7201 (2021).
  * (29) Zhang, K., Yang, Z. & Fang, C. Correspondence between winding numbers and skin modes in non-Hermitian systems. Phys. Rev. Lett. 125, 126402 (2020).
  * (30) Okuma, N., Kawabata, K., Shiozaki, K. & Sato, M. Topological origin of non-Hermitian skin effects. Phys. Rev. Lett. 124, 086801 (2020).
  * (31) Longhi, S. Non-Bloch PT symmetry breaking in non-Hermitian photonic quantum walks. Opt. Lett. 44, 5804 (2019).
  * (32) Hu, Y.-M., Wang, H.-Y., Wang, Z. & Song, F. Geometric Origin of non-Bloch PT symmetry breaking. arXiv:2210.13491.
  * (33) Xiao, L. et al. Observation of non-Bloch parity-time symmetry and exceptional points. Phys. Rev. Lett. 126, 230402 (2021).
  * (34) Li, T., Sun, J.-Z., Zhang, Y.-S & Yi, W. Non-Bloch quench dynamics. Phys. Rev. Research 3, 023022 (2021).
  * (35) Wang, K. et al. Detecting non-Bloch topological invariants in quantum dynamics. Phys. Rev. Lett. 127, 270602 (2021).
  * (36) Liang, Q. et al. Dynamic signatures of non-Hermitian skin effect and topology in ultracold atoms. Phys. Rev. Lett. 129, 070401 (2022).
  * (37) Lin, Q. et al. Observation of non-Hermitian topological Anderson insulator in quantum dynamics. Nat. Commun. 13, 3229 (2022).
  * (38) Lin, Q. et al. Topological phase transitions and mobility edges in non-Hermitian quasicrystals. Phys. Rev. Lett. 129, 113601 (2022).
  * (39) Hofstadter, D. R. Energy levels and wave functions of Bloch electrons in rational and irrational magnetic fields. Phys. Rev. B 14, 2239 (1976).
  * (40) Sajid, M., Asbóth, J. K., Meschede, D., Werner, R. F. & Alberti, A. Creating anomalous Floquet Chern insulators with magnetic quantum walks. Phys. Rev. B 99, 214303 (2019).
  * (41) Shao, K. et al. Cyclotron quantization and mirror-time transition on nonreciprocal lattices. Phys. Rev. B 106, L081402 (2022).
  * (42) Schreiber, A. et al. A 2D quantum walk simulation of two-particle dynamics. Science 336, 55-58 (2012).
  * (43) see Supplemental Material.
  * (44) Rudner, M. S., Lindner, N. H., Berg, E. & Levin, M. Anomalous edge states and the bulk-edge correspondence for periodically driven two-dimensional systems. Phys. Rev. X 3, 031005 (2013).
  * (45) Asbóth, J. K. & Alberti, A. Spectral flow and global topology of the Hofstadter butterfly. Phys. Rev. Lett. 118, 216801 (2017).

Methods

Experimental setup. We adopt a time-multiplexed scheme for the experimental
realization of photonic quantum walks sch ; ql ; ql2 . As illustrated in Fig.
1, the photon source is provided by a pulsed laser with a central wavelength
of $808$nm, a pulse width of $88$ps, and a repetition rate of $15.625$kHz. The
pulses are attenuated by a neutral density filter, such that an average photon
number per pulse is less than $2.4\times 10^{-4}$, which ensures a negligible
probability of multi-photon events. The photons are coupled in and out of a
time-multiplexed setup through a BS with a reflectivity of $3\%$,
corresponding to a low coupling rate of photons into the network. Such a low-
reflectivity BS also enables the out-coupling of photons for measurement. A
HWP with the setting angle $\pi/8$ is used to implement the coin operator $C$.

Four different paths in a fiber network correspond to the four different
directions a walker can take in one step on a two-dimensional lattice. Two-PBS
loops are used to realize polarization-dependent optical delays. The shift
operator $S_{x}$ is implemented by separating photons corresponding to their
two polarization components and routing them through the fibre loops,
respectively. Polarization-dependent time delay is then introduced. Since the
lengths of the two fiber loops are $287.03$m and $270.00$m, respectively, the
time difference of photons traveling through two fiber loops is $80$ns. The
shift operator $S_{y}$ is implemented by another two-PBS loop based on the
same principle, where the vertical component of photons is delayed relative to
the horizontal component by a $1.61$m free space path difference. The
corresponding time difference in the $y$ direction is then $4.83$ns.

The position-dependent phase operator $P$ is implemented using the first
electro-optical modulator (EOM1). The rise/fall times of EOM ($4$ns) are much
shorter than the time difference between adjacent positions ($80$ns and
$4.83$ns for $x$ and $y$ directions, respectively), which enable us to control
the parameter $\phi$ precisely.

To realize a polarization-dependent loss operation
$M^{\prime}_{x}(\gamma_{x})=e^{-\gamma_{x}}M_{x}(\gamma_{x})$, two HWPs and an
EOM are introduced into each fiber loop. Here HWPs are used to keep the
polarizations of photons unchanged before and after they pass through the
fiber loops. For $\gamma_{x}>0$, for the short loop, the voltage of EOM3 is
tuned to $0$. Thus, after passing through the first PBS, horizontally
polarized photons are all transmitted by the second PBS and are subject to
further time evolution. Whereas for the long loop, by controlling the voltage
of EOM2 to satisfy $\cos\theta/2=e^{-2\gamma_{x}}$, we flip part of the
photons $(1-e^{4\gamma_{x}})$ with vertical polarization into horizontal ones.
They are subsequently transmitted by the second PBS, and leak out of the
setup. Otherwise, for $\gamma_{x}<0$, horizontally polarized photons are all
transmitted by the second PBS and are subject to further time evolution in the
long loop. By contrast, for the short loop, part of the photons
$(1-e^{4\gamma_{x}})$ with vertical polarization are flipped by EOM3,
transmitted by the second PBS and subsequently leak out of the setup. We use
the same method to realize $M^{\prime}_{y}(\gamma_{y})$.

We compare the ideal theoretical distribution with the measured distribution
via the similarity,

$S(t)=\sum_{x,y}\sqrt{P_{\text{th}}(x,y,t)P_{\text{exp}}(x,y,t)},$ (6)

which quantifies the equality of two probability distributions. Here $S=0$
stands for completely orthogonal distributions, and $S=1$ for identical
distributions. We observe $S\geq 0.914$ in Fig. 2, $S\geq 0.922$ in Fig. 3,
and $S\geq 0.930$ in Fig. 4, respectively. Here the theoretical value
$P_{\text{th}}(x,y,t)$ is given by

$\displaystyle
P_{\text{th}}(x,y,t)=\sum_{m=H,V}\frac{|(\langle\bm{r}|\otimes\langle
m|)e^{-(\gamma_{x}+\gamma_{y})t}|\psi(t)\rangle|^{2}}{\sum_{\bm{r},m}|(\langle\bm{r}|\otimes\langle
m|)e^{-(\gamma_{x}+\gamma_{y})t}|\psi(t)\rangle|^{2}},$ (7)

where $|\psi(t)\rangle$ is the time-evolved walker state under $U$.

In our experiment, photon loss is caused by the loss of photons through an
optical element. Our round-trip single-loop efficiency is about $0.66$ even
for a unitary quantum walk. This is calculated by multiplying the transmission
rates of each optical component used in the round trip, including the
transmission rates of the BS ($\sim 0.97$), the collection efficiency from
free space to fiber ($\sim 0.78$), the EOM ($\sim 0.96$), and all other
optical components ($\sim 0.91$). We therefore estimate the single-loop
efficiency as $0.78\times 0.97\times 0.96\times 0.91\simeq 0.66$.

Floquet topological invariant. The walker state evolves according to

$\displaystyle|\psi(t)\rangle=U^{t}|\psi(0)\rangle=e^{-iH_{\rm{eff}}t}|\psi(0)\rangle,$
(8)

where $H_{\rm{eff}}=i\ln U$ is defined as the effective Hamiltonian. While the
quantum walk is identified as the periodically-driven Floquet dynamics, the
eigenenergies of $H_{\rm{eff}}$ constitute the quasienergy spectrum of the
Floquet system. We fix the branch cut of the logarithm such that the
quasienergy spectrum lies within the range $[-\pi,\pi)$.

To calculate the Floquet topological invariant, we follow Refs. sai ; asb ;
rud , and define

$U^{\prime}=e^{i\tilde{E}}M_{y}S_{y}P^{\prime}CM_{x}S_{x}C,$ (9)

where $e^{i\tilde{E}}$ shifts the quasienergy spectrum by $-\tilde{E}$. The
modified phase-shift operator is

$P^{\prime}(\beta,\alpha)=\sum_{\bm{r}}\exp\left[i\sigma_{z}(\beta\lfloor
x/q\rfloor+2\pi\alpha x)\right]\otimes\ket{\bm{r}}\bra{\bm{r}},$ (10)

where $\alpha=p/q$, $\beta=2\pi/s$, and $\lfloor x/q\rfloor$ is the greatest
integer less than or equal to $x/q$. Here $p$ and $q$ are coprime integers,
and $s$ is a sufficiently large integer (in our case, for $\alpha=1/3$, $s=15$
is sufficient).

We denote the eigenvalues of $U^{\prime}$ as $e^{-iE_{j}}$, and the
topological invariant for the quasienergy gap (corresponding to $U$)
comprising $\tilde{E}$ can be calculated through

$R=\frac{1}{2\pi}\left(\sum_{j=1}^{2sq}E_{j}(1/s,\alpha,\tilde{E})-\sum_{j=1}^{2sq}E_{j}(0,\alpha,\tilde{E})\right).$
(11)

Under an open boundary condition, the value of $R$ indicates the number of
anomalous Floquet edge states emerging within the quasienergy gap.

In Fig. 2d, all quasienergy gaps are closed, hence there are no topological
edge states along the boundaries, and the gap topological invariants are ill-
defined. In Fig. 4, for the $x\leq 0$ ($x>0$) region of the domain-wall
configurations, we have $p=1,q=20$ ($p=-1,q=20$) in Figs. 4a, b, c, and
$p=1,q=3$ ($p=-1,q=3$) in Figs. 4d, e, f, respectively. While there are now a
host of quasienergy gaps, for any given gap, the topological invariants $R$ of
the two regions are always finite and differ by a sign supp . As a
consequence, Floquet topological edge modes emerge along the domain-wall
boundary.

We find that the Floquet topological invariant $R$ is capable of predicting
the anomalous topological edge states under all our experimental parameters,
despite the presence of the NHSE. Whether the NHSE can have significant impact
on $R$ beyond our experimental parameters (particularly when the photon loss
is further increased) is an interesting theoretical question that we leave to
future studies.

Acknowledgments

We thank Chen Fang for helpful discussions. This work has been supported by
the National Natural Science Foundation of China (Grant Nos. 92265209,
12025401 and 11974331). W. Y. acknowledges support from the National Key
Research and Development Program of China (Grant Nos. 2016YFA0301700 and
2017YFA0304100).

##  A Supplemental Material for “Manipulating non-reciprocity in a two-
dimensional magnetic quantum walk”

In this Supplemental Material, we provide numerical results characterizing the
non-Hermitian skin effect (NHSE) and the Floquet topological invariants.

###  A.1 Quasienergy spectra

The presence of NHSE can be confirmed by examining the quasienergy spectra of
the effective Hamiltonian under different boundary conditions, and the spatial
distribution of eigenstates under the open boundary condition. As discussed in
the main text (Methods section), we define the effective Hamiltonian
$H_{\rm{eff}}=i\ln U$, where $U$ is the Floquet operator in Eq. (1) of the
main text, and the branch cut of the logarithm is taken to be the negative
real axis. The quasienergy spectrum of $H_{\rm{eff}}$ thus lies within the
range $[-\pi,\pi)$.

In Figs. S1a and c, we show the quasienergy spectra under both the periodic
(grey) and open (red) boundary conditions. The collapse of the spectra, when
the boundary condition is changed from periodic to open, strongly suggests the
presence of the NHSE. This is explicitly confirmed in Figs. S1b and d, where
we show the spatial distribution of the eigenstates under the open boundary
condition. They accumulate to one edge or one corner, depending on the loss
parameters. Note that $H_{\rm{eff}}$ and $U$ share the same set of
eigenstates.

Figure S1: a Numerically calculated quasienergy spectra of $H_{\rm{eff}}$ on
the complex plane, with $\gamma_{x}=\gamma_{y}=0.125$, under either the
periodic boundary condition (grey) or the open boundary condition (red). b
Spatial distribution of the eigenstates under the open boundary condition,
with the same parameters used in a. c Numerically calculated quasienergy
spectra of $H_{\rm{eff}}$ with $\gamma_{x}=0.1$, $\gamma_{y}=0$, under the
periodic boundary condition (grey) and the open boundary condition (red),
respectively. d Spatial distribution of the eigenstates under the open
boundary condition, with the same parameters used in c. For numerical
calculations, a lattice size of $45\times 45$ is taken as an example, with
$\alpha=0$.

###  A.2 Floquet topological invariants and edge states

In Figs. S2a and b, we show the real components of the quasienergy spectra
under the domain-wall geometry, respectively under the parameters of Fig. 4d
and Fig. 4f of the main text. While the Floquet topological edge states are
visible within each quasienergy gap, the quasienergy spectra are close to each
other, because of the smallness of the loss parameters in Fig. S2b.

The Floquet topological edge states can be characterized by the gap invariant
$R$ defined in the Methods section of the main text. In Fig. S2c, we show the
calculated gap invariants $R$ for the left (red) and right (black) regions of
the domain-wall configuration in Fig. S2b. The topological invariants of the
two regions are always finite but differ by their signs. Importantly, within
each quasienergy gap, the difference in the gap topological invariants between
the two regions is $2$. This corresponds to the number of Floquet topological
edge states within each quasienergy gap, as illustrated in Fig. S2b.

Figure S2: a, b The real component of the quasienergy spectra under the
domain-wall geometry of Figs. 4d and f in the main text, with
$\gamma_{x}=\gamma_{y}=0$ in a, and $\gamma_{x}=\gamma_{y}=0.1$ in b. Floquet
topological edge states (red) are seen to emerge within each quasienergy gap.
c Floquet topological invariants $R$ as functions of the real component of the
quasienergy. Within each quasienergy gap, the red (black) line indicates $R$
of the left (right) region. The shaded areas are the density of states
normalized to the total number of states, indicating the regions of
quasienergy bands. For numerical calculations, we take a lattice with
$45\times 45$ sites, and fix $\alpha=1/3$ and $\alpha=-1/3$ for the left and
right regions, respectively.