Author(s: Philip Tannor Natural Language Processor Source: Image from Michael Dziedzic at Unsplash The amazing abilities of modern neural language models include answering questions, analyzing long articles, summarizing them and creating text that is human-like. This technology is becoming more popular for customer-facing purposes. It is therefore important that businesses learn to use this advanced technology, as well as ensure it behaves properly and generates the desired content. The large corpuses that are used to train large-language models often contain foul language and racism. We want our models not to be exposed. The models often create toxic output. Microsoft’s Twitter chatbot Tay is a well-known example. It started producing toxic content less than 24hours after it was released [1].. Language models like GPT-2, for example, have been proven to generate toxic language even though the prompt is neutral [2]. Producing text that looks human can prove to be quite a challenge. We will be reviewing some suggested detoxification methods to language models. You can usually separate these methods into two types: data-based and decoding-based detoxification . These methods may also be applicable to controlled text generation problems. But, issues like preventing your language models from creating fake news need additional components, such as fact checking. These are worthy of a detailed post but will not be covered here. Data-based detoxification One idea for cleansing language models is to use higher quality data with fewer undesirable attributes. Although this approach is possible, it will mean that the data set will be significantly smaller, which could impact the model’s performance. This idea can be used with some adjustments, but it doesn’t have to reduce the data set. A data-based detoxification requires an extra pretraining phase for language models meant to detoxify it. After training with the whole dataset [4]., domain-adaptive pretraining is (DAPT). This involves adding a phase to a detoxified data set. A second method, called attribute conditioning, involves adding a prefix to the document depending on the toxicity of the content. We prepend the control code we want to use when creating new content. In our example, it would be “nontoxic”. The Decoding Based Detoxification adapts the decoding strategy to reduce undesirable behavior in language models. These methods are easy to use and do not require additional training. They can be used with any language model you choose, even those that have limited resources. Each token within the vocabulary is assigned a toxic score by vocabulary shift. The scores of each token are used to determine the probability distribution for the word next at each stage. Nontoxic tokens will be preferred over toxic. A simpler method is word filtering. A set of words are defined that the language model should not use in any circumstance due to profanity and toxicity. Once the tokens are decoded, either we redefine the probability distribution so that they have zero chance or we resample if an unwelcome token is chosen. A toxicity discriminator is another method that Uber AI has proposed during decoding. To produce the desired attributes, the gradients of the discriminator move backwards and shift hidden states. [5] Salesforce has recently published a paper that suggests generative discriminators (GeDis) to help guide the generation process. There are two simple languages models that use opposite control codes, i.e. To determine the toxicity of any next words in the context, two simple language models using opposite control codes (i.e. To alter the distribution of probability for the large-language model, the contrast in the probabilities of both models is used. [6] The final distribution of the language model, which is conditioned upon the “nontoxic control code”, can be found in the following formula. As you will see, the original model language can still be used, but the probability distributions are modified by using the generative discriminator. Decoding-based detoxification can be likened to a mouse trying steer an elephant. To harness large language models, we will use significantly smaller models in order to achieve the required output with minimal overhead and additional cost. Source: Unsplash Image by Nam Anh. Conclusion. It is becoming increasingly difficult to detoxify language models as more NLP systems become available to the public. There have been many creative ways to solve this problem, each with its own advantages and drawbacks. We will probably see new methods in the near future to gain more control over wild language models. Philip Tannor is the co-founder and CEO of Deepchecks, a company that arms organizations with tools to check and monitor their Machine-Learning-based systems. Philip is a data scientist with extensive experience in NLP, image processing and signal processing. Philip has a Master’s degree in Electrical Engineering. Philip holds a M.Sc. in Electrical Engineering and a B.Sc. He is also proficient in Mathematics and Physics, but he can’t recall much from any of his previous studies not related to algorithms or computer science. Reach out if you’re interested in finding out more about machine learning production models and how to control them. References [1] https://www.theverge.com/2016/3/24/11297050/tay-microsoft-chatbot-racist [2] https://toxicdegeneration.allenai.org/ [3] Sam Gehman, Suchin Gururangan, Maarten Sap, Yejin Choi & Noah A Smith (2020). RealToxicityPrompts – Evaluating Neural Toxic Disease in Language Models. Findings from EMNLP [4] Ana Marasovi’c, Swabha Swayamdipta and Kyle Lo. Do not stop Pretraining. Adapt Language models to domains and tasks. ArXiv, abs/2004.10964. [5] Sumanth Dhathri. Janice Lan. Jane Hung. Eric Frank. Piero Molino. Jason Yosinski. Rosanne Liu. (2020). Language models that plug and play: An easy way to control text generation [6] Krause, B., Gotmare, A., McCann, B., Keskar, N., Joty, S., Socher, R., & Rajani, N. (2020). GeDi is Generative Discriminator-Guided Sequence Generation. arXiv preprint arXiv: 2009.06367. How to Tame a language Model originally appeared in on Medium. People are responding to the story by highlighting it and commenting on it. Published by Auto Amazon Link: No products were found. There are no products.
Home Innovation How to Tame Language Models
THE FOREFRONT OF TECHNOLOGY
We monitors and writes about new technologies in areas such as technology, innovation, digitization, space, Earth, IT and AI.







