Change language

Overview of Analysis Methods in NLP | Stanford CS224U Natural Language Understanding | Spring 2021

Overview of Analysis Methods in NLP | Stanford CS224U Natural Language Understanding | Spring 2021

welcome everyone this is the first screencast in our series on analysis methods in nlp this is one of my favorite units in the course because its directly oriented toward helping you do even better final projects now theres a lot we could discuss under the rubric of analysis methods in nlp ive chosen four things the first two fall under the heading of behavioral evaluations well talk about adversarial testing which is a very flexible way for you to expose that your system might have some weaknesses or fail to capture some linguistic phenomenon in a very systematic way and then at this point we also have the opportunity for a number of tasks to do adversarial training and testing these would be large data sets that are full of examples that we know are difficult for present day architecture so for whatever architecture youre exploring this would be a chance to really stress test that architecture and then were going to move beyond behavioral evaluations to talk about what ive called structural evaluation methods and these include probing and feature attribution these are techniques that you could use to peer inside your system and gain an understanding of what its hidden representations are like and how those representations are impacting the models predictions the motivations for this are many here are just a few high-level ones that are kind of oriented toward projects the first is just that we might want to find the limits of the system that youre developing all our systems have limitations and finding them is always scientifically useful we might just also want to understand your systems behavior better what are its internal representations like and how are they feeding into its final predictions and its overall behaviors thats also just incredibly rewarding and both of these things might feed into just achieving more robust systems to the extent that we can find weaknesses and understand behaviors we can possibly take steps toward building even more robust systems and as i said all of this is oriented toward your final projects the techniques that were discussing are powerful and easy ways to improve the analysis section of a paper analysis sections are important but it can be difficult to write them it feels very open-ended and often very unstructured people talk in general ways about doing error analysis and so forth but it can be hard to pinpoint exactly what would be productive i think the methods that were talking about here are very generally applicable and can lead to really productive and rich analysis sections lets begin with adversarial testing this is a mode that weve talked about before the examples on this slide are from this now classic paper glochner at all 2018 called breaking nli and what they did is only really mildly adversarial its just kind of a challenge and it exposes some lack of systematicity in certain nli models so heres what they did they began from snli examples like a little girl is kneeling in the dirt crying entails a little girl is very sad and they simply use lexical resources to change the hypothesis by one word so that it now reads a little girl is very unhappy we would expect a system that truly understood the reasoning involved in these examples to continue to predict entail in the second case because these examples are roughly synonymous but what they found is that systems would often start to predict contradiction possibly because of the negation that occurs here the second example is similar we begin from the sli example an elderly couple are sitting outside a restaurant enjoying wine entails a couple drinking wine and here they just changed wine to champagne what we would expect is that a system that knew about these lexical items and their relations would flip to predicting neutral in this case but as you might imagine systems continue to predict entails because they have only a very fuzzy understanding of how wine and champagne are related to each other heres the results table and recall this is a 2018 paper and what theyre mainly testing here are models that we might regard as precursors to the transformers that weve been so focused on and the picture is very clear these models do well on the snli test set mid to high 80s but their performance plummets on this new adversarial test set there are two exceptions down here this wordnet baseline and the kim architecture but its important to note that these models effectively had access directly in the case of wordnet and indirectly in the case of kim to the lexical resource that was used to create the adversarial test and so they dont see such a large performance drop here but even still all of these numbers are kind of modest at this point and i told you that this was an interesting story heres the interesting twist at this point in 2021 you can simply download roberta mnli thats the roberta parameters fine-tuned on the multi-nli data set and run this adversarial test and what you find is that that model does astoundingly well on the breaking nli data set i would focus on these two f1 scores here for the two classes where we have a lot of support contradiction and entailment the numbers are above 90 as is the accuracy here which is directly comparable to the numbers that glockner had all reported an amazing accomplishment recall that the original examples from the um adversarial test are from snli this is multi-nli it was not developed specifically to solve this adversarial test and nonetheless it looks like roberta has systematic knowledge of the lexical relations involved and required to solve this adversarial test so possibly a markov real progress as i said you can also for selected tasks move into the mode of doing adversarial training and testing um here are the cases i know where the data set is large enough to support training and testing on examples that were created via some adversarial dynamic common sense reasoning natural language inference question answering sentiment and hate speech and as i said this is a really exciting opportunity to see just how robust your system is when exposed to examples that we know are difficult for modern architectures because thats how these data sets were designed now lets move into the more behavioral mode well start with probing of internal representations probes are little supervised models typically that you fit on the internal representations of your model of interest to sort of expose what those hidden representations latently encode this is from a classic paper by ian tenney at all 2019 and what we have along the x-axis is the burt layer starting from the embedding layer and going to 24 this is burnt large so there are 24 layers and the picture is quite striking as you start from the top here and move down you can see that as we move from more syntactic things up into more discourse-y semantic content like co-ref and relation extraction you find that the higher layers of the burp model are encoding that information latently thats what these probing results reveal in this picture quite striking look at what the pre-training process in this case of bert is learning latently about the structures of language and then well finally talk about feature attribution which is one step further in this more introspective mode because here as youll see i think we can get a really deep picture at how individual features and representations are directly related to the models predictions what ive done here is use the integrated gradients model which is the model that well focus on i ran it on a sentiment model and you can see here we have the true label the predicted label with the probability and then we have word level importances as measured by integrated gradients where blue means its a bias toward positive predictions and red means its a bias toward negative predictions uh and ive picked an example that i think kind of stress tests the model its a little bit adversarial because its all these examples involve mean in the sense of good as in a mean apple pie meaning a delicious or good one and you can see that by and large this models predictions are pretty systematic its mostly predicting positive for variants like they sell they make he makes although this last one he sells might worry us a little bit because it has flipped to negative despite the changes to the example being truly incidental and this might point to a way in which the model does or doesnt have knowledge of how the individual components of these examples should be predict should be feeding into the final predictions that the model makes i think thats a wonderful opportunity to get a sense for how robust the model is actually going to be to variations like the one that you see here you

Shop

Learn programming in R: courses

$

Best Python online courses for 2022

$

Best laptop for Fortnite

$

Best laptop for Excel

$

Best laptop for Solidworks

$

Best laptop for Roblox

$

Best computer for crypto mining

$

Best laptop for Sims 4

$

Latest questions

NUMPYNUMPY

Common xlabel/ylabel for matplotlib subplots

12 answers

NUMPYNUMPY

How to specify multiple return types using type-hints

12 answers

NUMPYNUMPY

Why do I get "Pickle - EOFError: Ran out of input" reading an empty file?

12 answers

NUMPYNUMPY

Flake8: Ignore specific warning for entire file

12 answers

NUMPYNUMPY

glob exclude pattern

12 answers

NUMPYNUMPY

How to avoid HTTP error 429 (Too Many Requests) python

12 answers

NUMPYNUMPY

Python CSV error: line contains NULL byte

12 answers

NUMPYNUMPY

csv.Error: iterator should return strings, not bytes

12 answers

News


Wiki

Python | How to copy data from one Excel sheet to another

Common xlabel/ylabel for matplotlib subplots

Check if one list is a subset of another in Python

sin

How to specify multiple return types using type-hints

exp

Printing words vertically in Python

exp

Python Extract words from a given string

Cyclic redundancy check in Python

Finding mean, median, mode in Python without libraries

cos

Python add suffix / add prefix to strings in a list

Why do I get "Pickle - EOFError: Ran out of input" reading an empty file?

Python - Move item to the end of the list

Python - Print list vertically