CS 7650: Natural Language Processing

33
CS 7650: Natural Language Processing Wei Xu (many slides from Greg Durrett)

Transcript of CS 7650: Natural Language Processing

Page 1: CS 7650: Natural Language Processing

CS7650:NaturalLanguageProcessing

WeiXu(many slides from Greg Durrett)

Page 2: CS 7650: Natural Language Processing

Administrivia

‣ Coursewebsite: hAps://cocoxu.github.io/CS7650_fall2021/

‣ PiazzaandGradescope:‣ linksonthecoursewebsite‣ WewilldoourbesttomakesurequesNonsaboutthehomework,etc.getansweredwithin24hours

‣ TAOfficehours:TBA

Page 3: CS 7650: Natural Language Processing

CourseRequirements

‣ Priorexposuretomachinelearningveryhelpful

‣ Programming/Pythonexperience

‣ Probability

‣ LinearAlgebra

‣ MulNvariableCalculus

There will be a lot of math and programming!

Page 4: CS 7650: Natural Language Processing

FreeTextbooks!

‣ 2reallyawesomefreetextbooksavailable

‣ Therewillbeassignedreadingsfromboth

‣ Bothfreelyavailableonline

Page 5: CS 7650: Natural Language Processing

CourseworkPlan

‣ ProblemSet1(mathreview)willbereleasedlaterthisweekonGradeScope.

‣ 3ProgrammingProjects(40%;fairlysubstanNalimplementaNoneffort)

‣ TextclassificaNon

‣ NamedenNtyrecogniNon(BiLSTM-CNN-CRF)

‣ Neuralchatbot(Seq2SeqwithaAenNon)

‣ 2wriAenassignments(20%)+midtermexam(15%)

‣ MostlymathproblemsrelatedtoML/NLP

‣ Finalproject(20%;detailsoncoursewebsite,willdiscusslater)

{subject to change

Page 6: CS 7650: Natural Language Processing

ProgrammingProjects‣ ModernNLPmethodsrequirenon-trivialcomputaNon

‣ TrainingneuralnetworkswithmanyparameterscantakealongNme(itisaverygoodideatostartworkingontheassignmentsearly!)

‣ MostprogrammingwillbedonewithPyTorchlibrary(canbetrickytodebug)

‣ YouwillwanttouseaGPU

‣ GoogleColab:freeGPUs(somelimitaNons;proaccountfor$10/month)

‣ TheprogrammingprojectsaredesignedwithColabinmind

Page 7: CS 7650: Natural Language Processing

What’sthegoalofNLP?

‣ Beabletosolveproblemsthatrequiredeepunderstandingoftext

Siri,what’sthemostvaluableAmerican

company?

Apple

recognizemarketCapisthetargetvalue

recognizepredicate

docomputaNon

WhoisitsCEO?

‣ Example:dialoguesystems

resolvereferences

TimCook

Page 8: CS 7650: Natural Language Processing

AutomaNcSummarizaNon

OneofNewAmerica’swriterspostedastatementcriNcalofGoogle.EricSchmidt,Google’sCEO,wasdispleased.

Thewriterandhisteamweredismissed.

providemissingcontext

paraphrasetoprovideclarity

compresstext

Page 9: CS 7650: Natural Language Processing

MachineTranslaNon

TrumpPopefamilywatchahundredyearsayearintheWhiteHousebalcony

People’sDaily,August30,2017

Page 10: CS 7650: Natural Language Processing

NLPAnalysisPipeline

SyntacNcparses

CoreferenceresoluNon

EnNtydisambiguaNon

Discourseanalysis

Summarize

ExtractinformaNon

AnswerquesNons

IdenNfysenNment

‣ NLPisaboutbuildingthesepieces!Translate

TextAnalysis Applica/onsText Annota/ons

‣ AllofthesecomponentsaremodeledwithstaNsNcal approachestrainedwithmachinelearning

Page 11: CS 7650: Natural Language Processing

Howdowerepresentlanguage?Labels

Sequences/tags

Trees

Text

themoviewasgood +Beyoncéhadoneofthebestvideosofall6me subjec/ve

TomCruisestarsinthenewMissionImpossiblefilmPERSON MOVIE

Ieatcakewithicing

PPNP

S

NPVP

VBZ NNflightstoMiami

λx.flight(x)∧dest(x)=Miami

Page 12: CS 7650: Natural Language Processing

HowdoweusetheserepresentaNons?

Labels

Sequences

Trees

TextAnalysisText

‣MainquesNon:WhatrepresentaNonsdoweneedforlanguage?Whatdowewanttoknowaboutit?

‣ Boilsdownto:whatambiguiNesdoweneedtoresolve?

Applica/ons

Treetransducers(formachinetranslaNon)

ExtractsyntacNcfeatures

Tree-structuredneuralnetworks

end-to-endmodels …

Page 13: CS 7650: Natural Language Processing

Whyislanguagehard? (andhowcanwehandlethat?)

Page 14: CS 7650: Natural Language Processing

LanguageisAmbiguous!

‣ HectorLevesque(2011):“Winogradschemachallenge”(namedarerTerryWinograd,thecreatorofSHRDLU)

Thecitycouncilrefusedthedemonstratorsapermitbecausethey______violence

theyfeared

theyadvocated

‣ Thisissocomplicatedthatit’sanAIchallengeproblem!(AI-complete)

‣ ReferenNal/semanNcambiguity

Page 15: CS 7650: Natural Language Processing

LanguageisAmbiguous!

‣ AmbiguousNewsHeadlines:

slidecredit:DanKlein

‣ SyntacNc/semanNcambiguity:parsingneededtoresolvethese,butneedcontexttofigureoutwhichparseiscorrect

‣ TeacherStrikesIdleKids‣ HospitalsSuedby7FootDoctors‣ BanonNudeDancingonGovernor’sDesk‣ IraqiHeadSeeksArms

‣ StolenPainNngFoundbyTree‣ KidsMakeNutriNousSnacks‣ LocalHSDropoutsCutinHalf

Page 16: CS 7650: Natural Language Processing

LanguageisReallyAmbiguous!

‣ Therearen’tjustoneortwopossibiliNeswhichareresolvedpragmaNcally

‣ CombinatoriallymanypossibiliNes,manyyouwon’tevenregisterasambiguiNes,butsystemssNllhavetoresolvethem

Itisreallyniceout

ilfaitvraimentbeau It’sreallyniceTheweatherisbeauNfulItisreallybeauNfuloutsideHemakestrulybeauNful

ItfactactuallyhandsomeHemakestrulyboyfriend

Page 17: CS 7650: Natural Language Processing

‣ Lotsofdata!

slidecredit:DanKlein

Whatdoweneedtounderstandlanguage?

Page 18: CS 7650: Natural Language Processing

Whatdoweneedtounderstandlanguage?

‣ Worldknowledge:haveaccesstoinformaNonbeyondthetrainingdata

DOJgreenlightsDisney-Foxmerger

metaphor;“approves”

DepartmentofJus6ce

‣ Whatisagreenlight?Howdoweunderstandwhat“greenlighNng”does?

Page 19: CS 7650: Natural Language Processing

‣ Grounding:learnwhatfundamentalconceptsactuallymeaninadata-drivenway

McMahanandStone(2015)Gollandetal.(2010)

Whatdoweneedtounderstandlanguage?

Page 20: CS 7650: Natural Language Processing

‣ LinguisNcstructure‣ …butcomputersprobablywon’tunderstandlanguagethesamewayhumansdo

‣ However,linguisNcstellsuswhatphenomenaweneedtobeabletodealwithandgivesushintsabouthowlanguageworks

CenteringTheoryGroszetal.(1995)

Whatdoweneedtounderstandlanguage?

Page 21: CS 7650: Natural Language Processing

Whattechniquesdoweuse?(tocombinedata,knowledge,linguisNcs,etc.)

Page 22: CS 7650: Natural Language Processing

Unsup:topicmodels,grammarinducNon

Collinsvs.Charniakparsers

Abriefhistoryof(modern)NLP

1980 1990 2000 2010 2018

earlieststatMTworkatIBM

“AIwinter”rule-based,expertsystems

Penntreebank

NP VP

S

Ratnaparkhitagger

NNP VBZ

Sup:SVMs,CRFs,NER,SenNment

Neural

Pretraining

Semi-sup,structuredpredicNon

Page 23: CS 7650: Natural Language Processing

StructuredPredicNon

‣ SupervisedtechniquesworkwellonveryliAledata

annotaNon(twohours!)

unsupervisedlearning

‣ EvenneuralnetscandopreAywell!

“LearningaPart-of-SpeechTaggerfromTwoHoursofAnnotaNon” GarreAeandBaldridge(2013)

beAersystem!

‣ Allofthesetechniquesaredata-driven!Somedataisnaturallyoccurring,butmayneedtolabel

Page 24: CS 7650: Natural Language Processing

Bahdanauetal.(2014)DeNeroetal.(2008)

LessManualStructure?

Page 25: CS 7650: Natural Language Processing

Doesmanualstructurehaveaplace?

‣ Neuralnetsdon’talwaysworkoutofdomain!

MoosaviandStrube(2017)

‣ Coreference:rule-basedsystemsaresNllaboutasgoodasdeeplearningout-of-domain

‣ LORELEI:transiNonpointbelowwhichphrase-basedsystemsarebeAer

‣ Whyisthis?InducNvebias!

‣ CanmulN-tasklearninghelp?

Wikipedia

Newswire

Page 26: CS 7650: Natural Language Processing

TrumpPopefamilywatchahundredyearsayearintheWhiteHousebalcony

‣ Maybemanualstructurewouldhelp…

Doesmanualstructurehaveaplace?

Page 27: CS 7650: Natural Language Processing

Wherearewe?

‣ NLPconsistsof:analyzingandbuildingrepresentaNonsfortext,solvingproblemsinvolvingtext

‣ Theseproblemsarehardbecauselanguageisambiguous,requiresdrawingondata,knowledge,andlinguisNcstosolve

‣ Knowingwhichtechniquesuserequiresunderstandingdatasetsize,problemcomplexity,andalotoftricks!

‣ NLPencompassesallofthesethings

Page 28: CS 7650: Natural Language Processing

NLPvs.ComputaNonalLinguisNcs

‣ NLP:buildsystemsthatdealwithlanguagedata

‣ CL:usecomputaNonaltoolstostudylanguage

Hamiltonetal.(2016)

Page 29: CS 7650: Natural Language Processing

NLPvs.ComputaNonalLinguisNcs

‣ ComputaNonaltoolsforotherpurposes:literarytheory,poliNcalscience…

Bamman,O’Connor,Smith(2013)

Page 30: CS 7650: Natural Language Processing

CourseGoals

‣ CoverfundamentalmachinelearningtechniquesusedinNLP

‣ Makeyoua“producer”ratherthana“consumer”ofNLPtools

‣ CovermodernNLPproblemsencounteredintheliterature:whataretheacNveresearchtopicsin2021?

‣ Thethreeassignmentsshouldteachyouwhatyouneedtoknowtounderstandnearlyanysystemintheliterature

‣ UnderstandhowtolookatlanguagedataandapproachlinguisNcphenomena

Page 31: CS 7650: Natural Language Processing

Assignments

‣ 3ProgrammingAssignments(40%grade)

‣ ImplementaNon-oriented

‣ ~2weeksperassignment,3“slipdays”forautomaNcextensions

Theseprojectsrequireunderstandingoftheconcepts,abilitytowriteperformantcode,andabilitytothinkabouthowtodebugcomplexsystems.Theyarechallenging,sostartearly!

Page 32: CS 7650: Natural Language Processing

FinalProject

‣ Finalproject(20%grade)‣ Groupsof3-4preferred,1ispossible.‣ Goodideatotalktorunyourprojectideabymeinofficehoursoremail.

‣ 4pagereport+finalprojectpresentaNon.

Page 33: CS 7650: Natural Language Processing

QuesNons?

�33

Piazza — https://piazza.com/class/ksjq7xenrbp3g5