SlowGuess/NAACL_2022_OCR huggingface dataset:
In this experiment, we use the following four datasets from different domains: (i) IMDB movie review corpus (Diao et al., 2014). (ii) Yelp restaurant review dataset (Li et al., 2018). (iii) Amazon product review dataset (Li et al., 2018). (iv) YAHOO! Answers dataset (Li et al., 2019a), the amazon and yelp test sets each have 1k human annotations. The statistics of these corpora are summarized in Table 1.
For the S2S model, we take the T5 base model (Raffel et al., 2019) (220MB) for our experiments. For style discriminator, we use 4-layer fully connected neural networks. We train our framework using the Adam optimizer (Kingma and Ba, 2014) with the initial learning rate 1e-5. The epoch is set to 50 for both stage 1 and stage 2. The inner learning rate  $\alpha$  is 0.0001, and the outer learning rate  $\beta$  is 0.001. Following (Shankar et al., 2018; Li et al., 2020), we use the leave-one-out evaluation method by picking a domain as the target domain  $D_{new}$  for the final evaluation. For each iteration of the training phase, two source domains are randomly selected as the meta-training domain  $D_{tr}$  and the remaining domains as the meta-validation domain  $D_{val}$ .
In order to evaluate the model performance, we use three famous and widely adopted automatic metrics following previous work (Li et al., 2019a; Fu et al., 2017; Hu et al., 2017a) and a human metric. BLEU verifies whether the generated sentences retain the original content (Papineni et al., 2002). While IMDB and Amazon have no manual references, we compute the BLEU scores w.r.t the input sentences. Style Control (S-Acc) measures the style accuracy of the transferred sentences with a style classifier that is pre-trained on the datasets. Domain Control (D-Acc) verifies whether the generated sentences have the characteristics of the target domain with a pre-trained domain classifier to measure the percentage of generated sentences belonging to the target domain. Human Evaluation Following (Madotto et al., 2019), We randomly sampled 100 sentences generated on the target domain and distributed a questionnaire at Amazon Mechanical Turk asking each worker to rank the content retention (0 to 5), style transfer(0 to 5) and fluency(0 to 5): human score = Average( $\sum score_{style}$  +  $\sum score_{content}$  +  $\sum score_{fluency}$ ), human score ∈ [0, 100]. Five workers were recruited for human evaluation.
Restaurant(1% target domain data)	Restaurant(100% target domain data)
Model/Training method	S-Acc	BLEU	G-score	Human	D-Acc	S-Acc	BLEU	G-score	Human	D-Acc
CrossAlign	78.4	4.5	18.7	14.6	76.8	88.3	5.6	22.2	70.3	83.5
ControlGen	80.1	6.7	23.2	15.4	80.4	90.6	25.5	22.5	78.9	87.9
FGIM	83.1	4.6	19.6	16.4	82.0	90.4	24.6	48.6	69.4	85.2
DAST	88.3	17.5	39.3	19.5	90.5	91.2	26.5	49.2	79.4	92.6
CatGen	85.4	18.5	39.7	29.4	80.5	88.4	27.9	49.7	65.7	86.0
ATM(ours)	89.6	20.1	42.4	30.1	89.2	93.3	30.3	53.2	85.2	93.4
In-Domain	87.4	9.7	29.1	16.4	87.3	94.5	20.4	43.9	78.4	93.6
Joint-Training	82.3	8.4	26.2	18.7	84.6	85.4	21.6	42.9	73.6	93.4
Fine-Tuning	65.2	2.8	13.5	12.6	79.8	92.8	24.2	47.3	73.7	93.7
D-Shift	79.3	10.4	28.7	15.4	79.8	91.2	23.4	46.1	73.7	93.7
MAML	88.2	18.6	40.5	24.8	74.5	90.4	20.1	42.6	70.4	92.1
DAML(ours)	90.0	21.4	43.8	25.1	89.9	96.7	32.1	55.7	80.2	94.7
DAML-ATM(ours)	94.5	25.4	48.9	34.2	92.9	97.8	35.5	58.9	83.1	96.4
Table 2: Evaluation results on restaurant domain(Yelp). The restaurant domain is used as the target domain and the other three domains as the source domain. G-score is the geometric mean of S-Acc and BLEU.
Yelp(negative-to-positive)	Yelp(positive-to-negative)
Input	there chips are ok, but their salsa is really bland.	love their food and their passion.
Joint-Training	there are good, but their food is really good, .	laughable their food and bad food.
Fine-Tuning	there chips act very well.	their food is hard to use.
D-Shift	there are usually dramatic exhibits.	my husband and toilet smelled.
MAML	there chips are bad,but there salsa is really good.	hate their food and their passion
DAML-ATM(ours)	there chips are surprised, and their salsa is really nice.	hard to swallow food and serious disrespect.
The results of the other metrics are shown in the appendix.
Table 3: Transferred sentences on Yelp(few shot), where red denotes successful style transfers, blue denotes content losses, violet denotes domain errors and green denotes grammar errors, better looked in color. More examples are in the appendix.
Movie	In-Domain	Fine-Tuning	D-Shift	MAML	DAML
S-Acc	70.4	59.3	74.4	79.8	81.5
BLEU	23.1	25.4	27.4	26.9	31.2
D-Acc	87.3	75.2	72.2	74.5	92.3
Product	In-Domain	Fine-Tuning	D-Shift	MAML	DAML
S-Acc	84.1	80.2	83.5	84.6	87.0
BLEU	14.0	14.5	17.8	18.1	19.9
D-Acc	80.5	75.4	73.5	79.4	84.1
Q & A	In-Domain	Fine-Tuning	D-Shift	MAML	DAML
S-Acc	94.1	90.1	92.1	89.6	95.5
BLEU	12.8	13.7	14.5	18.7	20.5
D-Acc	80.6	70.0	72.5	76.5	86.7
Table 4: Results on each of the remaining domains treated as target domain,every target domains using  $1\%$  data for fine-tuning,base model is AMT.
In our experiments, for ATM model, we adopt five state-of-the-art TST models for comparison: CrossAlign (Shen et al., 2017), ControlGen (Hu et al., 2017a), DAST (Li et al., 2019a), CatGen (Wang et al., 2020a) and FGIM (Wang et al., 2019). They are jointly trained on the source domains and fine-tuned on the target domain.
To well analyze our training method DAML, following (Li et al., 2020), we also use five simple and effective domain adaptation settings with ControlGen (Hu et al., 2017a) structure as DAML: (1) In-Domain method is trained on the training set of the target domain; (2) Joint-Training method combines all the training sets of the source and target domains and performs a joint-training on these datasets; (3) Fine-Tuning method is trained on the training sets of the source domains and then fine-tuned on the training set of the target domain; (4) D-Shift This is trained on the combination of training sets from all source domains. Then, the evaluation is conducted on the test set of a target domain using the direct domain shift strategy; (5) MAML method uses classical model agnostic meta-learning algorithm (Finn et al., 2017).
For DAML-ATM, we first choose restaurant as the target domain and the other three as the source domains for observation. Table 2 reports the results of different methods and models under both the full-data and few-shot settings. From this table, we can see that DAML-ATM outperforms all baselines in terms of S-Acc, BLEU, D-Acc and human evaluation. We attribute this to the fact that DAML-ATM explicitly simulates the domain shift during
Figure 4: The system performance on amazon improves when the size of the target data increases. Even the one-shot learning achieves decent performance.
Figure 5: The t-sne plots of source domain sentences and generated target domain sentence in different DAML training epochs. The labels 0 and 1 represent the source domain sentence embedding and the generated target domain sentence embedding.
training via DAML, which helps adapt to the new target domain. We can also see that in the case of a few-shot setting, the results of Fine-tuning and Joint training are even worse than In-domain and DAML. The reason may be that the data size of the source domain is much larger than the target domain so that the model tends to remember the characteristics of the source domain. MAML achieves good performance in most metrics. However, it does not balance meta-tasks across different source domains, performing poorly on D-acc.
Further, to verify the robustness of our method under the low-resource setting, we separately select the other three domains as the target domain. As shown in Table 4, our approach has achieved good performance on different target domains.
We also provide some examples in Table 3. From the example, we can see intuitively that  $D$ -shift
and Fine-tuning will lead to the misuse of domain-specific words due to lack of target domain information. In addition, compared with Joint-training, the sentences generated by DAML-ATM are more consistent with the human reference. Compared to MAML, DAML generates sentences that are more diverse and vivid due to the more balanced absorption of information from multiple domains. Figure 4 shows the system performance positively correlates with the amount of training data available in the target domain. To visualize how well DAML-ATM performs on the new unseen domain, we use t-SNE (Van der Maaten and Hinton, 2008) plots to analyze the degree of separation between the source domain sentences and the generated target domain sentences. Figure 5 shows that as the training epoch increases, the sentences generated by DAML-ATM in the target domain are completely separated from the source domain in the latent space.
To study the impact of different components on the overall performance, we further did an ablation study for our model, and the results are shown in Table 5. After we disabled the reconstruction loss, our model failed to learn meaningful outputs and only learned to generate a word for any combination of input sentences and styles. Then, when the discriminator loss is not used, the model degrades rapidly, simply copying the original sentence without any style modification. After not using the pre-training language model weights, the model's performance is reduced in the metric of content preservation. When using gumble-softmax instead of hidden states for gradient descent, the model performs poorly in style accuracy because of the instability of gumble-softmax. In summary, each factor plays an essential role in the DAML-ATM training stage.
Model	S-Acc	BLEU	D-Acc
DAML-ATM	94.5	25.4	92.9
w/o reconstruction loss	50.0	0	50.0
w/o discriminator loss	2.1	21.6	92.4
w/o language model weights	87.4	17.3	90.3
w/ gumble-softmax	85.6	18.3	91.0
Table 5: Model ablation study results on Yelp dataset. The size of adaptation training data is  $1\%$ .
In this paper, we propose DAML-ATM, a novel training strategy combined with a new TST model
for domain adaptation, which can be easily adapted to new domains with few shot data. On four popular TST benchmarks, we found significant improvements against multiple baselines, verifying the effectiveness of our method. We explore extending this approach for other low resource NLP tasks in future work.
This work was partially supported by National Key Research and Development Project (2019YFB1704002) and National Natural Science Foundation of China (61876009).
Yixin Cao, Ruihao Shui, Liangming Pan, Min-Yen Kan, Zhiyuan Liu, and Tat-Seng Chua. 2020. Expertise style transfer: A new task towards better communication between experts and laymen. arXiv preprint arXiv:2005.00701.
Keith Carlson, Allen Riddell, and Daniel Rockmore. 2018. Evaluating prose style transfer with the bible. Royal Society open science, 5(10):171920.
Xiwen Chen and Kenny Q Zhu. 2020. StΘ: Small-data text style transfer via multi-task meta-learning. arXiv preprint arXiv:2004.11742.
Ning Dai, Jianze Liang, Xipeng Qiu, and Xuanjing Huang. 2019. Style transformer: Unpaired text style transfer without disentangled latent representation. arXiv preprint arXiv:1905.05621.
Qiming Diao, Minghui Qiu, Chao-Yuan Wu, Alexander J Smola, Jing Jiang, and Chong Wang. 2014. Jointly modeling aspects, ratings and sentiments for movie recommendation (jmars). In Proceedings of the 20th ACM SIGKDD international conference on Knowledge discovery and data mining, pages 193-202.
Chelsea Finn, Pieter Abbeel, and Sergey Levine. 2017. Model-agnostic meta-learning for fast adaptation of deep networks. arXiv preprint arXiv:1703.03400.
Zhenxin Fu, Xiaoye Tan, Nanyun Peng, Dongyan Zhao, and Rui Yan. 2017. Style transfer in text: Exploration and evaluation.
Xiang Gao, Yizhe Zhang, Sungjin Lee, Michel Galley, Chris Brockett, Jianfeng Gao, and Bill Dolan. 2019. Structuring latent spaces for stylized response generation. arXiv preprint arXiv:1909.05361.
Xavier Glorot, Antoine Bordes, and Yoshua Bengio. 2011. Domain adaptation for large-scale sentiment classification: A deep learning approach. In ICML.
Jiatao Gu, Yong Wang, Yun Chen, Kyunghyun Cho, and Victor O. K. Li. 2018. Meta-learning for low-resource neural machine translation.
Zhiting Hu, Zichao Yang, Xiaodan Liang, Ruslan Salakhutdinov, and Eric P. Xing. 2017a. Toward controlled generation of text.
Zhiting Hu, Zichao Yang, Xiaodan Liang, Ruslan Salakhutdinov, and Eric P Xing. 2017b. Toward controlled generation of text. In International Conference on Machine Learning, pages 1587-1596. PMLR.
Parag Jain, Abhijit Mishra, Amar Prakash Azad, and Karthik Sankaranarayanan. 2019. Unsupervised controllable text formalization. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pages 6554-6561.
Eric Jang, Shixiang Gu, and Ben Poole. 2017. Categorical reparameterization with gumbel-softmax.
Harsh Jhamtani, Varun Gangal, Eduard Hovy, and Eric Nyberg. 2017. Shakespearizing modern language using copy-enriched sequence-to-sequence models. arXiv preprint arXiv:1707.01161.
Diederik P Kingma and Jimmy Ba. 2014. Adam: A method for stochastic optimization. arXiv preprint arXiv:1412.6980.
Kalpesh Krishna, Deepak Nathani, Xavier Garcia, Bidisha Samanta, and Partha Talukdar. 2021. Few-shot controllable style transfer for low-resource settings: A study in indian languages.
Kalpesh Krishna, John Wieting, and Mohit Iyyer. 2020. Reformulating unsupervised style transfer as paraphrase generation.
Mike Lewis, Yinhan Liu, Naman Goyal, Marjan Ghazvininejad, Abdelrahman Mohamed, Omer Levy, Ves Stoyanov, and Luke Zettlemoyer. 2019. Bart: Denoising sequence-to-sequence pre-training for natural language generation, translation, and comprehension.
Dianqi Li, Yizhe Zhang, Zhe Gan, Yu Cheng, Chris Brockett, Ming-Ting Sun, and Bill Dolan. 2019a. Domain adaptive text style transfer. arXiv preprint arXiv:1908.09395.
Jing Li, Shuo Shang, and Ling Shao. 2020. Metaner: Named entity recognition with meta-learning. In Proceedings of The Web Conference 2020, pages 429-440.
Juncen Li, Robin Jia, He He, and Percy Liang. 2018. Delete, retrieve, generate: A simple approach to sentiment and style transfer. arXiv preprint arXiv:1804.06437.
Xiangyang Li, Zheng Li, Sujian Li, Zhimin Li, and Shimin Yang. 2021a. Knowledge enhanced transformers system for claim stance classification. In
CCF International Conference on Natural Language Processing and Chinese Computing, pages 614-623. Springer.
Xiangyang Li, Yu Xia, Xiang Long, Zheng Li, and Sujian Li. 2021b. Exploring text-transformers in aaai 2021 shared task: Covid-19 fake news detection in english. In International Workshop on Combating On line Ho stile Posts in Regional Languages during Emergence Si tuation, pages 106-115. Springer.
Yiying Li, Yongxin Yang, Wei Zhou, and Timothy M. Hospedales. 2019b. Feature-critic networks for heterogeneous domain generalization.
Zhaojiang Lin, Andrea Madotto, Chien-Sheng Wu, and Pascale Fung. 2019. Personalizing dialogue agents via meta-learning.
Yinhan Liu, Jiatao Gu, Naman Goyal, Xian Li, Sergey Edunov, Marjan Ghazvininejad, Mike Lewis, and Luke Zettlemoyer. 2020. Multilingual denoising pre-training for neural machine translation. Transactions of the Association for Computational Linguistics, 8:726-742.
Andrea Madotto, Zhaojiang Lin, Chien-Sheng Wu, and Pascale Fung. 2019. Personalizing dialogue agents via meta-learning. In Proceedings of the 57th Annual Meeting of the Association for Computational Linguistics, pages 5454-5459.
Nikola I Nikolov and Richard HR Hahnloser. 2018. Large-scale hierarchical alignment for data-driven text rewriting. arXiv preprint arXiv:1810.08237.
Tong Niu and Mohit Bansal. 2018. Polite dialogue generation without parallel data. Transactions of the Association for Computational Linguistics, 6:373-389.
Farhad Nooralahzadeh, Giannis Bekoulis, Johannes Bjerva, and Isabelle Augenstein. 2020. Zero-shot cross-lingual transfer with meta learning. arXiv preprint arXiv:2003.02739.
Kishore Papineni, Salim Roukos, Todd Ward, and Wei-Jing Zhu. 2002. Bleu: a method for automatic evaluation of machine translation. In Proceedings of the 40th annual meeting of the Association for Computational Linguistics, pages 311-318.
Reid Pryzant, Richard Diehl Martinez, Nathan Dass, Sadao Kurohashi, Dan Jurafsky, and Diyi Yang. 2020. Automatically neutralizing subjective bias in text. In Proceedings of the aaai conference on artificial intelligence, volume 34, pages 480-489.
Kun Qian and Zhou Yu. 2019. Domain adaptive dialog generation via meta learning. arXiv preprint arXiv:1906.03520.
Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J Liu. 2019. Exploring the limits of transfer learning with a unified text-to-text transformer. arXiv preprint arXiv:1910.10683.
Parker Riley, Noah Constant, Mandy Guo, Girish Kumar, David Uthus, and Zarana Parekh. 2021. Textsettr: Few-shot text style extraction and tunable targeted restyling.
Shiv Shankar, Vihari Piratla, Soumen Chakrabarti, Siddhartha Chaudhuri, Preethi Jyothi, and Sunita Sarawagi. 2018. Generalizing across domains via cross-gradient training. arXiv preprint arXiv:1804.10745.
Tianxiao Shen, Tao Lei, Regina Barzilay, and Tommi Jaakkola. 2017. Style transfer from non-parallel text by cross-alignment. In Advances in neural information processing systems, pages 6830-6841.
Bakhtiyar Syed, Gaurav Verma, Balaji Vasan Srinivasan, Anandhavelu Natarajan, and Vasudeva Varma. 2020. Adapting language models for non-parallel author-stylized rewriting. In AAAI, pages 9008-9015.
Laurens Van der Maaten and Geoffrey Hinton. 2008. Visualizing data using t-sne. Journal of machine learning research, 9(11).
Ke Wang, Hang Hua, and Xiaojun Wan. 2019. Controllable unsupervised text attribute transfer via editing entangled latent representation.
Rui Wang, Masao Utiyama, Lemao Liu, Kehai Chen, and Eiichiro Sumita. 2017. Instance weighting for neural machine translation domain adaptation. In Proceedings of the 2017 Conference on Empirical Methods in Natural Language Processing, pages 1482-1488.
Tianlu Wang, Xuezhi Wang, Yao Qin, Ben Packer, Kang Li, Jilin Chen, Alex Beutel, and Ed Chi. 2020a. Cat-gen: Improving robustness in nlp models via controlled adversarial text generation. arXiv preprint arXiv:2010.02338.
Yunli Wang, Yu Wu, Lili Mou, Zhoujun Li, and Wenh Chan. 2020b. Formality style transfer with shared latent space. In Proceedings of the 28th International Conference on Computational Linguistics, pages 2236-2249.
Qianhui Wu, Zijia Lin, Guoxin Wang, Hui Chen, Borje F Karlsson, Biqing Huang, and Chin-Yew Lin. 2020. Enhanced meta-learning for cross-lingual named entity recognition with minimal resources. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 34, pages 9274-9281.
Jake Zhao, Yoon Kim, Kelly Zhang, Alexander M. Rush, and Yann LeCun. 2017. Adversarily regularized autoencoders.
A.1 More Details on Experiment Settings
Our model is initialized from T5 and Bart (Liu et al., 2020; Raffel et al., 2019). Specifically, the
encoder and decoder are all 12-layer transformers with 16 attention heads, hidden size 1,024 and feedforward filter size 4,096, which amounts to 406M trainable parameters. We train our framework using the Adam optimizer (Kingma and Ba, 2014) with the initial learning rate 1e-5, and we employ a linear schedule for the learning rate, all models are trained on 8 RTX 3090 GPUs.
A.2 Details on Human Evaluation
For the results generated by each method, following (Krishna et al., 2020), we randomly selected 100 sentences to be placed in the Amazon Mechanical Turk questionnaire. We pay our workers 5 cents per sentence. As shown in Figure 6, the questionnaire asked to judge the generated sentences on three dimensions: strength of style transfer, degree of content retention, and text fluency. To minimize the impact of spamming, we require each worker to be a native English speaker with a  $95\%$  or higher approval rate and a minimum of 1,000 hits.
A.3 More Ablation Study and Metrics
To verify that the general S2S models work well with our algorithm, we use bart (Lewis et al., 2019) as the S2S base model. For the robustness of the experiment, we add a new metric J-(a,c,f) (Krishna et al., 2020) to measure our results, which is a sentence-level aggregation strategy evaluate style transfer models.
Domain	S-Acc	BLEU	G-score	D-Acc	J-(a,c,f)
Restaurant(T5-base)	94.5	25.4	48.9	89.2	46.4
Restaurant(Bart-base)	94.7	24.1	47.8	88.4	40.2
Movie(T5-base)	81.5	31.2	50.4	92.3	42.8
Movie(Bart-base)	84.5	34.7	54.1	90.1	43.5
Product(T5-base)	87.0	19.9	41.6	84.1	34.5
Product(Bart-base)	84.3	20.4	41.4	86.4	34.7
Q & A(T5-base)	95.5	20.5	44.25	86.7	39.5
Q & A(Bart-Base)	92.5	17.7	40.46	79.8	34.1
As can be seen from Table 6, our approach can be combined with other general pre-trained language models and performs well, proving our method's generality. Furthermore, as we can visually see from Table 7, our model also performs well on the J-(a,c,f) metric, which indicates that our model generates sentences in a specific style while having the right target style, preserving content, and being fluent.
A.4 More Generation Examples
To demonstrate more examples of generation to verify the effectiveness of the model, we selected 10 generated sentences from amazon and yelp each, as shown in Table 8 and Table 9.
Table 6: Results on each of the remaining domains treated as target domain, every target domain using  $1\%$  data for fine-tuning, base models are BART and T5.
Restaurant(1% target domain data)	Restaurant(100% target domain data)
Model/Training Method	J-(a,c,f)	J-(a,c,f)
CrossAlign	18.4	22.9
ControlGen	19.2	24.5
FGIM	25.6	28.7
DAST	24.5	32.3
Cat-Gen	20.3	31.2
ATM(ours)	30.4	39.5
In-Domain	32.5	35.2
Joint-Training	32.3	35.4
Fine-Tuning	28.2	37.8
D-Shift	25.5	34.1
MAML	38.8	44.1
DAML(ours)	44.8	47.6
DAML-ATM(ours)	46.4	50.8
Table 7: Evaluation results on restaurant domain(Yelp). The restaurant domain is used as the target domain and the other three domains as the source domain. G-score is the geometric mean of S-Acc and BLEU.The evaluation metrics is J-(a,c,f)
Read the two pieces of text below and use the sliders below indicate how much you agree with the statements (0 = Strongly disagree, 5 = Strongly agree)
Source Text (there chips are good)}
Transfer Text (bad chips and poor service))
1) The second text adequately change the style of the first text
。
- 2) The second text retain the main content of the original sentence
- 3) The second text is fluent and free of grammatical errors
Figure 6: Human evaluation questionnaire. We randomly sampled 100 sentences generated on the target domain and distributed a questionnaire at Amazon Mechanical Turk asking each worker to rank the content retention (0 to 5), style transfer(0 to 5), and fluency(0 to 5).