The present disclosure relates generally to neural networks and deep learning models, and in particular, to robustness evaluation of a model via “natural” typos.
Artificial intelligence, implemented with neural networks and deep learning models, has demonstrated great promise as a technique for automatically analyzing real-world information with human-like accuracy. In general, such neural network and deep learning models receive input information and make predictions based on the input information. Natural language processing (NLP) is one class of problems to which neural networks may be applied.
In the real world, NLP models will encounter or be exposed to “noisy” texts that contain spelling or typographical errors. These errors are often the result of mistakes by a human user, for example, when interacting with an interface such as keyboard on a computer, smart phone, tablet, etc. Even a small typographical error may confuse the best NLP models, which leads to the question: “How robust is a given neural network model with respect to natural typos?”
Accordingly, it would be advantageous to have systems and methods that can evaluate the robustness of an NLP model, for example, when faced with typographical errors related to the interaction of a human user with a keyboard.
In the figures, elements having the same designations have the same or similar functions.
Artificial intelligence, implemented with neural networks and deep learning models, has demonstrated great promise as a technique for automatically analyzing real-world information with human-like accuracy. In general, such neural network and deep learning models receive input information and make predictions based on the input information. Natural language processing (NLP) is one class of problems to which neural networks may be applied.
The current state-of-the-art neural network models for different NLP tasks are trained and evaluated on fixed benchmark datasets. These fixed datasets are typically free of spelling or typographical errors. When deploying NLP models in the real-world, however, the models will encounter “noisy” texts that contain errors, often due to human or user-generated mistakes, e.g., character substitution, additional, and/or missing characters.
How to fairly evaluate the robustness of the models with respect to user-generated noisy text is an open question. One of the most common interfaces for text input is keyboard, and the input text often includes typographically errors made by a human user when interacting with a keyboard interface.
According to some embodiments, the present disclosure provides systems and methods to evaluate the robustness of NLP models via natural typos.
As used herein, the term “network” may comprise any hardware or software-based framework that includes any artificial intelligence network or system, neural network or system and/or any training or learning models implemented thereon or therewith.
As used herein, the term “module” may comprise hardware or software-based framework that performs one or more functions. In some embodiments, the module may be implemented on one or more neural networks.
Memory 120 may be used to store software executed by computing device 100 and/or one or more data structures used during operation of computing device 100. Memory 120 may include one or more types of machine readable media. Some common forms of machine readable media may include floppy disk, flexible disk, hard disk, magnetic tape, any other magnetic medium, CD-ROM, any other optical medium, punch cards, paper tape, any other physical medium with patterns of holes, RAM, PROM, EPROM, FLASH-EPROM, any other memory chip or cartridge, and/or any other medium from which a processor or computer is adapted to read.
Processor 110 and/or memory 120 may be arranged in any suitable physical arrangement. In some embodiments, processor 110 and/or memory 120 may be implemented on a same board, in a same package (e.g., system-in-package), on a same chip (e.g., system-on-chip), and/or the like. In some embodiments, processor 110 and/or memory 120 may include distributed, virtualized, and/or containerized computing resources. Consistent with such embodiments, processor 110 and/or memory 120 may be located in one or more data centers and/or cloud computing facilities.
As shown, memory 120 includes a robustness evaluation module 130 that may be used to implement and/or emulate the systems and models, and/or to implement any of the methods described further herein. In some examples, robustness evaluation module 130 may be used to evaluate the robustness of one or more NLP models via natural typos (e.g., keyboard typos for human-typed input documents). In some examples, memory 120 may include non-transitory, tangible, machine readable media that includes executable code that when run by one or more processors (e.g., processor 110) may cause the one or more processors to perform the methods described in further detail herein. In some examples, robustness evaluation module 130 may be implemented using hardware, software, and/or a combination of hardware and software.
As shown, computing device 100 receives as input model data 140 and text data 145, which are provided to robustness evaluation module 130. The model data 140 may comprise information about one or more target models to be evaluated. Each target model may perform one or more NLP tasks, such as, for example, text classification, text compression, question answering, etc. For each such target model, the model data 140 may include information for the model architecture and all necessary parameters. The text data 145 may relate to or comprise text for one or more documents to be provided to and processed by the target models. In some embodiments, the robustness evaluation module 130 may generate one or more errors (e.g., mimicking keyboard typos) that are inserted into or replaces text in the one or more documents of the text data 145. The robustness evaluation module 130 operates on the input model data 140 and text data 145 (with added keyboard typos) to evaluate the robustness of a pre-trained target model for one or more NLP tasks, such as, for example, text classification. The module 130 develops, derives, or generates results which are indicative of the model's robustness with respect to the keyboard typos. The results are provided as output 150 from computing device 100.
At a process 210, model data 140 relating to one or NLP models is received. Each NLP model may perform one or more NLP tasks, such as, for example, text classification, text compression, question answering, etc. In some examples, for each model, the model data 140 may include information for the model architecture and all necessary parameters.
At a process 220, text data 145 is received. In some examples, the text data 145 may relate to or comprise text for one or more documents to be provided to and processed by the target models, according to their respective NLP tasks.
At a process 230, robustness evaluation module 130 segments the text data for the one or more documents into the word/sub-word/character as basic components. The module 130 then identifies one or more key words (most informative or uninformative words) from these basic components.
At a process 240, one or more natural typos are generated though manipulation of the key words. In some examples, the natural typos are generated based on natural typo rules generated based on the particular NPL task and/or source of the input document (e.g., input document typed by humans, input document from optical character recognition (OCR), etc.). In an example where the input document is typed by humans, the natural typo rules provide that the natural typos include keyboard typos, which that are natural in human-typed input documents. Such keyboard typos may be generated using keyboard typo rules, and example keyboard typos include the following kinds of keyboard typos:
At a process 250, robustness evaluation module 130 evaluates the robustness of the pre-trained NLP model, e.g., for text classification, in view of the added keyboard typos mimicking human generated mistakes. In some embodiments, the input document with added keyboard typos is provided as input to the target NLP model. The target model is run or operated in its normal way to perform the NLP task on the input document with keyboard typos, and the results or predictions of the model from this task are saved. Robustness evaluation module 130 analyzes the results or predictions of the target NLP model to evaluate the model's robustness. The results of such evaluation are provided as output 150 from robustness evaluation module 130.
Referring to
Referring to
The method 400 may proceed to block 404, where one or more natural typo generation rules are determined for the NPL task, e.g., for generating typos that are natural for the particular input document type. In an example, for a human-typed input document, natural typo generation rules provide how to generate natural keyboard typos, mimicking human keyboard typos. In another example, for an OCRed input document, natural typo generation rules provide how to generate natural OCR typos, mimicking OCR typos.
The method 400 may proceed to block 406, where robustness evaluation is performed to one or more target neural network models to be evaluated based on the natural typo generational rules, and robustness evaluation results (e.g., each including a max-gradient result, a min-gradient result, and a random modification result) are generated. In some embodiments, at block 406, the method 200 of
The method 400 may proceed to block 408, where a neural network model is determined based on the robustness evaluation results. In some embodiments, the neural network model is selected from the one or more target neural network models based on the corresponding robustness evaluation results. In an example, the neural network model is selected based on a best max-gradient robustness result (e.g., highest max-gradient robustness accuracy for a particular budget (e.g., K=4)), a best min-gradient robustness result (e.g., highest min-gradient robustness accuracy for a particular budget (e.g., K=4)), the random modification robustness result, any other suitable robustness result, and/or a combination thereof.
In some embodiments, block 408 includes process 410, where a segmentation method for generating components by segmenting the text data from the document is determined, based on the robustness results. In an example, a segmentation method that generates the same number of tokens for the original word and the modified word with injected natural typos may be used.
In some embodiments, block 408 includes process 412, where parameters of the selected neural network model may be further trained based on the robustness evaluation results and/or the injected natural typos.
The method 400 may then proceed to block 414, where the determined neural network model is used to perform the NPL task.
Referring to
The method 430 may start at block 432 (e.g., line Input of
As shown in line Output of
The method 430 may proceed to block 434, where the test document is segmented to generate a plurality of components (e.g., line 3 of
The method 430 may then proceed to block 436, where components c_max_grad determine components c_max_grad and c_min_grad with max and min gradients respectively (e.g., lines 4-7 of
f(ci)=∇c
where L(ci, y) denote the loss with respect to ci with its ground truth label y. Components c_max_grad and c_min_grad with maximum and minimum gradients G may be determined based on the computed gradients for all components c.
The method 430 may then proceed to block 438, where the most informative/uninformative word is tracked back based on components c_max_grad/c_min_grad and the corresponding gradient information (e.g., line 8 of
The method 430 may proceed to block 448, where it is determined whether the neural network model detects the natural typo(s) generated at block 440 (e.g., lines 10-21 of
The method 430 may be repeated on a number of documents, and the combined evaluation results may provide a more complete picture of the robustness of a particular neural network model on typos, including robustness for max-gradient typos, min-gradient typos, and random modification typos respectively. Some example robustness evaluation results are illustrated below with reference to
Referring
Specifically, a bert-base-uncased configuration for the BERT model is used, where the BERT model includes a 12-layerd pre-trained BERT on lower-cased text. In some embodiments, during the segmentation process, simple white space tokenization is performed, followed by a Wordpiece tokenization. For example, a word can be split into subword tokens (e.g. adversarial→[ad, ##vers, ##aria, ##1], robustness→[robust, ##ness]). In some examples, special symbols (e.g., “##”) to handle the subwords are not considered or omitted when injecting typos. An example typo for “##ness” is “##nesss”, and “robust” and “##nesss” are concatenated together to form a new word “robustnesss.” The new word is split again into subwords [robust, ##ness, ##s]. As such, in the particular example, the typo affects the subword tokenization, where the original word subword tokenization generates two subword tokens ([robust, ##ness]) to three subword tokens (e.g., [robust, ##ness, ##s]). In some examples, typos are not injected to special tokens (e.g., [CLS] and [SEP] in BERT) in the model that are not actual input words.
In the example of
Furthermore, in the example of
As shown in
Referring to
On the other hand, as shown in
As humans and the model are sensitive to the different typos (or words), the model's robustness may be improved by selecting a subword segmenetation method more robust to the typos. For example, a max-grad method may modify the keyword “inspire” to “inspird” in the following sentence: “a subject like this should inspire reaction in its audience; the pianist does not.” A first subword segmentation method, “inspird” is split into [ins, ##pi, ##rd], which is completely different from the original string. A second subword segmentation method may segment “inspird” into [ins, ##pird], which is more similar to the original string. As such, in some embodiments, the second subword segmentation method may be selected to provide a more robust model.
Referring to
Referring to
In various embodiments, the evaluation system and method may be used to evaluate different neural network models, and the robustness evaluation results provide their different sensitivities to different types of words (e.g., max-gradient typo, min-gradient typo, random-modification typo, etc.). As such, the robustness evaluation results may be used to select particular neural network models for performing particular tasks (e.g., NLP tasks, question answering tasks, scanned document processing tasks, human-typed document processing tasks, etc.) based on performance (e.g., accuracy, computing resources, etc.) requirements. Furthermore, the robustness evaluation results may also be used to further train the particular neural network model, such that the neural network model has improved performance for that particular task.
Some examples of computing devices, such as computing device 100 may include non-transitory, tangible, machine readable media that include executable code that when run by one or more processors (e.g., processor 110) may cause the one or more processors to perform the processes of methods 200, 400, and 450. Some common forms of machine readable media that may include the processes of methods 200, 400, and 450 are, for example, floppy disk, flexible disk, hard disk, magnetic tape, any other magnetic medium, CD-ROM, any other optical medium, punch cards, paper tape, any other physical medium with patterns of holes, RAM, PROM, EPROM, FLASH-EPROM, any other memory chip or cartridge, and/or any other medium from which a processor or computer is adapted to read.
This description and the accompanying drawings that illustrate inventive aspects, embodiments, implementations, or applications should not be taken as limiting. Various mechanical, compositional, structural, electrical, and operational changes may be made without departing from the spirit and scope of this description and the claims. In some instances, well-known circuits, structures, or techniques have not been shown or described in detail in order not to obscure the embodiments of this disclosure. Like numbers in two or more figures represent the same or similar elements.
In this description, specific details are set forth describing some embodiments consistent with the present disclosure. Numerous specific details are set forth in order to provide a thorough understanding of the embodiments. It will be apparent, however, to one skilled in the art that some embodiments may be practiced without some or all of these specific details. The specific embodiments disclosed herein are meant to be illustrative but not limiting. One skilled in the art may realize other elements that, although not specifically described here, are within the scope and the spirit of this disclosure. In addition, to avoid unnecessary repetition, one or more features shown and described in association with one embodiment may be incorporated into other embodiments unless specifically described otherwise or if the one or more features would make an embodiment non-functional.
Although illustrative embodiments have been shown and described, a wide range of modification, change and substitution is contemplated in the foregoing disclosure and in some instances, some features of the embodiments may be employed without a corresponding use of other features. One of ordinary skill in the art would recognize many variations, alternatives, and modifications. Thus, the scope of the invention should be limited only by the following claims, and it is appropriate that the claims be construed broadly and in a manner consistent with the scope of the embodiments disclosed herein.
This application claims priority to U.S. Provisional Patent Application No. 62/851,073 filed May 21, 2019, which is incorporated by reference herein in its entirety.
Number | Name | Date | Kind |
---|---|---|---|
10282663 | Socher et al. | May 2019 | B2 |
10346721 | Mbright et al. | Jul 2019 | B2 |
10474709 | Paulus | Nov 2019 | B2 |
10521465 | Paulus | Dec 2019 | B2 |
10542270 | Zhou et al. | Jan 2020 | B2 |
10546217 | Mbright et al. | Jan 2020 | B2 |
11429785 | Kwon | Aug 2022 | B2 |
20160350653 | Socher et al. | Dec 2016 | A1 |
20170024645 | Socher et al. | Jan 2017 | A1 |
20170032280 | Socher | Feb 2017 | A1 |
20170140240 | Socher | May 2017 | A1 |
20180082171 | Merity et al. | Mar 2018 | A1 |
20180096219 | Socher | Apr 2018 | A1 |
20180121787 | Hashimoto et al. | May 2018 | A1 |
20180121788 | Hashimoto et al. | May 2018 | A1 |
20180121799 | Hashimoto et al. | May 2018 | A1 |
20180129931 | Bradbury et al. | May 2018 | A1 |
20180129937 | Bradbury et al. | May 2018 | A1 |
20180129938 | Xiong et al. | May 2018 | A1 |
20180143966 | Lu et al. | May 2018 | A1 |
20180144208 | Lu et al. | May 2018 | A1 |
20180144248 | Lu et al. | May 2018 | A1 |
20180268287 | Johansen et al. | Sep 2018 | A1 |
20180268298 | Johansen et al. | Sep 2018 | A1 |
20180300317 | Bradbury | Oct 2018 | A1 |
20180336198 | Zhong et al. | Nov 2018 | A1 |
20180336453 | Merity et al. | Nov 2018 | A1 |
20180349359 | McCann et al. | Dec 2018 | A1 |
20180373682 | McCann et al. | Dec 2018 | A1 |
20180373987 | Zhang et al. | Dec 2018 | A1 |
20190130206 | Trott et al. | May 2019 | A1 |
20190130248 | Zhong et al. | May 2019 | A1 |
20190130249 | Bradbury et al. | May 2019 | A1 |
20190130273 | Keskar et al. | May 2019 | A1 |
20190130312 | Xiong et al. | May 2019 | A1 |
20190130896 | Zhou et al. | May 2019 | A1 |
20190130897 | Zhou et al. | May 2019 | A1 |
20190188568 | Keskar et al. | Jun 2019 | A1 |
20190213482 | Socher et al. | Jul 2019 | A1 |
20190251168 | McCann et al. | Aug 2019 | A1 |
20190251431 | Keskar et al. | Aug 2019 | A1 |
20190258714 | Zhong et al. | Aug 2019 | A1 |
20190258939 | Min et al. | Aug 2019 | A1 |
20190286073 | Hosseini-Asl et al. | Sep 2019 | A1 |
20190295530 | Hosseini-Asl et al. | Sep 2019 | A1 |
20190311227 | Kriegman | Oct 2019 | A1 |
20190362020 | Paulus et al. | Nov 2019 | A1 |
20190362246 | Lin et al. | Nov 2019 | A1 |
Number | Date | Country |
---|---|---|
WO-2019246294 | Dec 2019 | WO |
Entry |
---|
Belinkov et al., “Synthetic and Natural Noise both Break Neural Machine Translation,” arXiv preprint arXiv:1711.02173, pp. 1-12, 2017. |
Devlin et al., “BERT: Pre-training of Deep Bidirectional Transformers for Language Understanding,” arXiv preprint arXiv:1810.04805, pp. 1-14, 2018. |
Ebrahimi et al., “Hotflip: White-Box Adversarial Examples for Text Classification,” arXiv preprint arXiv:1712.06751, pp. 1-9, 2017. |
Gao et al., Black-Box Generation of Adversarial Text Sequences to Evade Deep Learning Classifiers, arXiv preprint arXiv:1801,04354v1, pp. 1-7, 2018. |
Li et al., “Textbugger: Generating Adversarial Text Against Real-world Applications,” arXiv preprint arXiv:1812.05271, pp. 1-15, 2018. |
Liang et al., “Deep Text Classification Can Be Fooled,” arXiv preprint arXiv:1704.08006, pp. 1-7, 2017. |
Pennington et al., “GloVe: Global Vectors for Word Representation,” In Proceedings of the 2014 Conference on Empirical Methods in Natural Language Processing (EMNLP), pp. 1532-1543 2014. |
Peters et al., “Deep Contextualized Word Representations,” arXiv preprint arXiv: 1802.05365, pp. 1-15, 2018. |
Ribeiro et al., Semantically Equivalent Adversarial Rules for Debugging NLP Models. In Proceedings of the 56th Annual Meeting of the Association for Computational Linguistics (vol. 1: Long Papers), pp. 856-865 2018. |
Sato et al., “Interpretable Adversarial Perturbation in Input Embedding Space for Text,” arXiv preprint arXiv:1805.02917, pp. 1-8, 2018. |
Zhao et al., “Generating Natural Adversarial Examples,” arXiv preprint arXiv:1710.11342, pp. 1-12, 2017. |
Number | Date | Country | |
---|---|---|---|
20200372319 A1 | Nov 2020 | US |
Number | Date | Country | |
---|---|---|---|
62851073 | May 2019 | US |