DRAG : Director-Generator Language Modelling Framework for Non-Parallel Author Stylized Rewriting (2021)

Abstract: Author stylized rewriting is the task of rewriting an input text in a particular author’s style. Recent works in this area have leveraged Transformer-based language models in a denoising autoencoder setup to generate author stylized text without relying on a parallel corpus of data. However, these approaches are limited by the lack of explicit control of target attributes and being entirely data-driven. In this paper, we propose a Director-Generator framework to rewrite content in the target author’s style, specifically focusing on certain target attributes. We show that our proposed framework works well even with a limited-sized target author corpus. Our experiments on corpora consisting of relatively small-sized text authored by three distinct authors show significant improvements upon existing works to rewrite input texts in target author’s style. Our quantitative and qualitative analyses further show that our model has better meaning retention and results in more fluent generations.

## introduction with recent advances in language modeling techniques that have resulted in powerful language models @xcite @xcite along with an increased interest in stylized text generation @xcite @xcite @xcite , large language models have been successfully tuned to achieve text stylization @xcite @xcite . apart from transferring an input text to the target style, which has received recent interest from the community, understanding and measuring style have been persistently explored over the last few decades @xcite @xcite . lying at the intersection of style transfer enabled by advanced language models and a deep understanding of style as a nuanced combination of several linguistic concepts, problems like stylized generation or stylized rewriting have gained further traction. a large body of work in style transfer focuses on binary aspects such as positive-negative sentiment @xcite , formal-informal @xcite , and sometimes a mixture of these attributes @xcite . to fuel this interest in such binary stylization, some datasets comprising of text from the extreme ends of these spectrums have also emerged (e.g., positive-negative sentiments @xcite , formal-informal @xcite ). as pointed by @xcite , author stylized rewriting does not directly fit under any of these variants as the writing style of an author is an amalgamation of several such attributes and needs to be modeled in a finegrained manner. apart from the distinction along style dimensions, prior works can also be categorized as supervised (using parallel corpus @xcite ) and unsupervised @xcite @xcite . in supervised frameworks, parallel data is used to tune sequence-to-sequence models for stylized rewriting. however, annotating such parallel corpus is a tedious effort and therefore, there is an increased interest in unsupervised style transfer; i.e., when there is no direct supervision or parallel data available for training the models. in this work, we focus on such an unsupervised setting. existing approaches on unsupervised author stylized rewriting rely on implicitly learning the target stylistic attributes from data and do not allow finer control on generation @xcite . while this is a good starting point for author-stylized rewriting, it is desirable to further improve the rewriting model on certain aspects without compromising on other attributes that the model has already optimized. an example would be to retain the stylistic strengths while improving content retention, or vice versa. to this end, we propose directing a generator framework (drag). our quantitive and qualitative experiments show the viability of the proposed approach. experiments further indicate that the framework's setup allows it to operate efficiently in scarce data setting and improves the performance over the baseline models. our contributions can be summarized as -(1) we introduce a director-generator approach to rewrite an input text in a target author's style. (2) we propose linguistic alignment scores -both at the local and global level and extend these to design thresholds for the generator and director. (3) we present experimental results on texts written by three authors from the gutenberg corpus with very distinct writing styles, and show that our approach outperforms prior works across content retention and style alignment metrics. (4) we further identify and discuss shortcomings of our proposed approach, and present error analysis to aid future research in author stylized rewriting. ## related work with the rise of transformer-based @xcite language models, generative pretraining @xcite @xcite has advanced the field of nlp significantly. fine-tuning such large language models on specific task has become very prevalent @xcite @xcite @xcite . pretraining infuses the generic language knowledge into the language model helping it understand the specific tasks with relatively much less supervision. in fact, recent approaches @xcite show that often, even such small supervisions are not required and a simple instruction can be used to solve specific tasks by utilizing the capabilities of such large language models trained on very large datasets. pretraining of such models usually involves optimizing them on masked language modelling (mlm) @xcite , causal language modelling (clm) @xcite or other similar @xcite objectives.while clm is the task of auto-regressively predicting the next word given the previous words or context, mlm is the task of recovering masked tokens from a given input. while these approaches mostly train only an encoder or a decoder framework, @xcite explored initializing encoderdecoder frameworks using the pre-trained encoders for cross-lingual translation. such a technique with appropriate modification has been shown to be successful in incorporating stylistic aspects of the language as well @xcite . all these works utilize the task of minimizing the denoising auto-encoder loss for inducing style in the language models in a reconstruction framework. for our explorations, we leverage these works to initialize our drag framework. there is an increased interest in stylistic generation or text rewriting. most of the approaches define dimensions like formality-informality @xcite @xcite and achieve the alignment along these dimensions. while some of these approaches rely on parallel corpus @xcite , many of the approaches focus on unsupervised framework @xcite @xcite , where the model preserves the input content in the output while biasing the generations towards the target style. while some approaches utilize simple editing to achieve the style along particular dimensions @xcite , others focus on achieving this through discriminators @xcite or scorers @xcite . as mentioned before, since author style is an amalgamation of several such attributes, it requires much more than a discriminator or singular dimension tuning to achieve stylization. due to the difficulty associated with author style understanding and fine-grained nature of that style even if understood them, the problem of author stylized rewriting has not been explored a lot. while @xcite try to solve this problem for a specific author (i.e. shakespeare), their approach is contingent on the availability of a parallel corpus. since preparing parallel corpus is a tedious and intractable process, especially while dealing with multiple authors and multiple combinations of input and output styles, it is essential to focus on unsupervised solutions. most recently, @xcite leverage the capabilities of the large language models to solve this problem in an unsupervised manner. ## author style there has been significant work on understanding binary stylization along dimensions like formalinformal, positive-negative sentiment @xcite @xcite @xcite @xcite , however, there is limited work on understanding an author's writing style @xcite @xcite . while style can be a mixture of several factors including, but not limited to, lexical preferences, syntactic/sentential choices, discourse structure, narrative style, tone, we follow @xcite and consider an author's style at three levels: surface style is estimated using the frequencies of different surface elements such as the number of commas, semicolons, colons, question marks, exclamation marks, and hyphens per paragraph, from a given author's text. we, thus, quantify the surface-style elements into a 6-dimensional vector. lexical style of an author is reflected in the author's choice of words. to describe the same concept, different authors may use different words. for instance, rudyard kipling, known for his classics in children's literature, tended to use more concrete words (e.g., gongs, rockets, torch) while abraham lincoln, being a political writer, used more abstract words (e.g., freedom, patriotism). we enumerate lexical style categories as subjective, objective, literary, colloquial, abstract and concrete @xcite . we use lexicons for each of these categories @xcite , and define lexical style alignment of each word in the vocabulary to a given style category as the average and normalized point-wise mutual information (pmi) between that word and the seed words in the lexicon for that style category. the lexical style alignment for each word is thus a 6-dimensional vector. we use the emobank corpus @xcite to compute the co-occurrence statistics for pmi computations. the inclination of a word towards a style category is positive if its normalized pmi score is positive with respect to the given category. the inclination of an author towards a style category is then estimated by the fraction of words in their text that have a positive inclination towards the category. syntactic style of an author is indicated by the nature of sentences used and we estimate the distribution of different types of sentences in an author's text. sentence types may range from complex, as seen in philosophical writings, to simple, as observed in children's storybooks. we use five categories of sentence styles: (i) simple, (ii) compound, (iii) complex, (iv) complex-compound sentences, and (v) others @xcite @xcite . sentences are categorized into one of these types using the algorithm proposed by @xcite . the resulting 5dimensional probability distribution vector is used as the estimation of syntactic style. these vectors are estimated at corpus-level, unlike those for lexical and surface style which are computed at paragraph-level. ## drag: directing a generator for stylized rewriting our proposed framework, drag, that aims to rewrite a given piece of text with a specific target author's style consists of three main stages: ## experiments we use a transformer encoder 1 with 512 hidden units, 16 heads, a dropout rate of 0.1, and learned positional embeddings during our mlm training. the model is trained using adam optimizer with a learning rate of 10 -4 . the batch size used is 32 with a stream of 256 tokens, and the whole setup is trained until the validation performance (perplexity scores) shows no further improvement. the transformers used in encoder-decoder setup also have the same parameters, and are initialized using the above encoder before training on further objectives. during dae loss training, we use the same hyperparameters used in @xcite , and set p drop and p blank to 0.1. during director-generator training, we use n as 8 and as 0.05. the learning rate used in this case is 10 -5 . in all the models, we use byte pair encoding @xcite with 80k codes learnt over the entire generic corpus. ## discussions and limitations while the language generation advancements are happening at a very high pace, the notion of style and the ability of models to rewrite same content in different styles is still far from being solved. one of the most important observation as made by @xcite is that it is very difficult to separate content from style. in fact, previous approaches which worked on the principle of disentangling style from content were not found to disentangle the style so much after all @xcite . the notion of style is still very far from being defined and concretized. while some psycholinguistic concepts can be defined to some extent (formality, sentiment, etc.), defining it at the level of author's style is very difficult due to manifestation of style at different levels as enumerated by @xcite . despite, such enumeration at various levels, it is far from exhaustive and therefore our approach still requires more granular understanding of style to closely emulate target author's style. our evaluation uses automatic metrics for style due to the difficulty associated with conducting human evaluation in author attribution tasks @xcite . the skill needed to identify the author's style is very intense thus making the human evaluation very costly. a more granular and detailed study on understanding how humans interpret an author's style is required to design a proper feedback mechanism. this is, however, outside the scope of this work. ## conclusion and future work in this work, we addressed the shortcomings of the prior approaches for the task of author stylized rewriting and overcame them through drag: a director-generator approach. we showed the effectiveness of our proposed approach for stylized rewriting on three different authors from the guteneberg corpus. furthermore, we discussed the limitations of our approach and some of the failure cases to aid future research. while our drag approach is able to stabilize the training while improving the content preservation abilities of the model, a standard reinforcement learning approach, when stabilized, has the potential to improve these scores to a much more improved level. improved understanding of author style while keeping a human in the loop and stabilizing rl with transformers models are subjects of future research.