<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Natural Language Processing on Arshad Siddiqui</title><link>https://arshadhs.github.io/tags/natural-language-processing/</link><description>Recent content in Natural Language Processing on Arshad Siddiqui</description><generator>Hugo</generator><language>en-us</language><atom:link href="https://arshadhs.github.io/tags/natural-language-processing/index.xml" rel="self" type="application/rss+xml"/><item><title>Natural Language Processing</title><link>https://arshadhs.github.io/docs/ai/050-nlp/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://arshadhs.github.io/docs/ai/050-nlp/</guid><description>&lt;h1 id="natural-language-processing">
 Natural Language Processing
 
 &lt;a class="anchor" href="#natural-language-processing">#&lt;/a>
 
&lt;/h1>
&lt;p>Natural Language Processing (NLP) studies how computers can analyse, understand, represent, and generate human language.&lt;/p>
&lt;p>It combines ideas from linguistics, computer science, machine learning, and deep learning to work with text and language-based information.&lt;/p>
&lt;blockquote class="book-hint info">
&lt;p>&lt;strong>Natural Language Processing = Linguistics + Computation + Machine Learning&lt;/strong>&lt;/p>
&lt;/blockquote>
&lt;p>The learning path begins with language understanding and vector representations, progresses through language modelling, tagging, and parsing, and then moves towards transformers, knowledge graphs, Retrieval-Augmented Generation, and modern NLP applications.&lt;/p></description></item><item><title>N-gram Language Modelling</title><link>https://arshadhs.github.io/docs/ai/050-nlp/030-n-gram-language-modelling/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://arshadhs.github.io/docs/ai/050-nlp/030-n-gram-language-modelling/</guid><description>&lt;h1 id="n-gram-language-modelling">
 N-gram Language Modelling
 
 &lt;a class="anchor" href="#n-gram-language-modelling">#&lt;/a>
 
&lt;/h1>
&lt;p>A language model assigns probabilities to sequences of words. It can compare complete sentences or predict which word is likely to come next.&lt;/p>
&lt;p>Key ideas include:&lt;/p>
&lt;ul>
&lt;li>word prediction and sequence probability&lt;/li>
&lt;li>the chain rule and Markov assumption&lt;/li>
&lt;li>unigram, bigram and trigram models&lt;/li>
&lt;li>Maximum Likelihood Estimation&lt;/li>
&lt;li>unseen sequences and smoothing&lt;/li>
&lt;li>interpolation and backoff&lt;/li>
&lt;li>intrinsic and extrinsic evaluation&lt;/li>
&lt;li>perplexity&lt;/li>
&lt;/ul>
&lt;h2 id="learning-objectives">
 Learning Objectives
 
 &lt;a class="anchor" href="#learning-objectives">#&lt;/a>
 
&lt;/h2>
&lt;ul>
&lt;li>Explain what a language model represents.&lt;/li>
&lt;li>Calculate simple unigram and bigram probabilities.&lt;/li>
&lt;li>Explain why unseen N-grams create zero probabilities.&lt;/li>
&lt;li>Distinguish smoothing, interpolation and backoff.&lt;/li>
&lt;li>Interpret perplexity correctly.&lt;/li>
&lt;/ul>
&lt;h2 id="big-picture">
 Big Picture
 
 &lt;a class="anchor" href="#big-picture">#&lt;/a>
 
&lt;/h2>


&lt;pre class="mermaid">
flowchart TD
 A[&amp;#34;Training Corpus&amp;#34;] --&amp;gt; B[&amp;#34;Count N-grams&amp;#34;]
 B --&amp;gt; C[&amp;#34;Estimate Probabilities&amp;#34;]
 C --&amp;gt; D[&amp;#34;Handle Unseen Events&amp;#34;]
 D --&amp;gt; E[&amp;#34;Score Word Sequences&amp;#34;]
 E --&amp;gt; F[&amp;#34;Evaluate Model&amp;#34;]

 style A fill:#E1F5FE
 style B fill:#C8E6C9
 style C fill:#FFF9C4
 style D fill:#EDE7F6
 style E fill:#E1F5FE
 style F fill:#C8E6C9
&lt;/pre>

&lt;h2 id="1-what-is-a-language-model-">
 1. What Is a Language Model? ☆
 
 &lt;a class="anchor" href="#1-what-is-a-language-model-">#&lt;/a>
 
&lt;/h2>
&lt;p>A language model estimates how probable a sequence of words is.&lt;/p></description></item><item><title>NN and Neural Language Modelling</title><link>https://arshadhs.github.io/docs/ai/050-nlp/040-neural-networks-and-neural-language-modelling/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://arshadhs.github.io/docs/ai/050-nlp/040-neural-networks-and-neural-language-modelling/</guid><description>&lt;h1 id="neural-networks-and-neural-language-modelling">
 Neural Networks and Neural Language Modelling
 
 &lt;a class="anchor" href="#neural-networks-and-neural-language-modelling">#&lt;/a>
 
&lt;/h1>
&lt;p>Neural networks learn useful representations and nonlinear relationships directly from data. In language modelling, they replace discrete N-gram identities with learned word embeddings and use these representations to predict the next word.&lt;/p>
&lt;h2 id="learning-objectives">
 Learning Objectives
 
 &lt;a class="anchor" href="#learning-objectives">#&lt;/a>
 
&lt;/h2>
&lt;ul>
&lt;li>Explain the computation performed by a neural unit.&lt;/li>
&lt;li>Describe why hidden layers and nonlinear activations are needed.&lt;/li>
&lt;li>Explain how feed-forward networks support NLP classification.&lt;/li>
&lt;li>Trace the flow through a feed-forward neural language model.&lt;/li>
&lt;li>Compare N-gram and neural language models.&lt;/li>
&lt;/ul>
&lt;h2 id="big-picture">
 Big Picture
 
 &lt;a class="anchor" href="#big-picture">#&lt;/a>
 
&lt;/h2>


&lt;pre class="mermaid">
flowchart TD
 A[&amp;#34;Context Words&amp;#34;] --&amp;gt; B[&amp;#34;One-hot Inputs&amp;#34;]
 B --&amp;gt; C[&amp;#34;Embedding Lookup&amp;#34;]
 C --&amp;gt; D[&amp;#34;Combined Context&amp;#34;]
 D --&amp;gt; E[&amp;#34;Hidden Layer&amp;#34;]
 E --&amp;gt; F[&amp;#34;Softmax&amp;#34;]
 F --&amp;gt; G[&amp;#34;Next-word Probabilities&amp;#34;]

 style A fill:#E1F5FE
 style B fill:#C8E6C9
 style C fill:#FFF9C4
 style D fill:#EDE7F6
 style E fill:#E1F5FE
 style F fill:#C8E6C9
 style G fill:#FFF9C4
&lt;/pre>

&lt;h2 id="1-neural-network-units-">
 1. Neural Network Units ☆
 
 &lt;a class="anchor" href="#1-neural-network-units-">#&lt;/a>
 
&lt;/h2>
&lt;p>A neural unit receives input values, multiplies them by learned weights, adds a bias, and applies an activation function.&lt;/p></description></item><item><title>LLM and Prompt Engineering</title><link>https://arshadhs.github.io/docs/ai/050-nlp/050-llm-and-prompt-engineering/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://arshadhs.github.io/docs/ai/050-nlp/050-llm-and-prompt-engineering/</guid><description>&lt;h1 id="llms-and-prompt-engineering">
 LLMs and Prompt Engineering
 
 &lt;a class="anchor" href="#llms-and-prompt-engineering">#&lt;/a>
 
&lt;/h1>
&lt;p>A Large Language Model extends neural language modelling through much larger datasets, many more parameters, broad pretraining and adaptation to many downstream tasks. Its central operation remains next-token prediction.&lt;/p>
&lt;h2 id="learning-objectives">
 Learning Objectives
 
 &lt;a class="anchor" href="#learning-objectives">#&lt;/a>
 
&lt;/h2>
&lt;ul>
&lt;li>Explain how neural language modelling develops into an LLM.&lt;/li>
&lt;li>Describe the meaning of large, general-purpose and pretrained.&lt;/li>
&lt;li>Explain how a prompt guides generation.&lt;/li>
&lt;li>Distinguish zero-shot and few-shot prompting.&lt;/li>
&lt;li>Compare prompting with model adaptation.&lt;/li>
&lt;/ul>
&lt;h2 id="big-picture">
 Big Picture
 
 &lt;a class="anchor" href="#big-picture">#&lt;/a>
 
&lt;/h2>


&lt;pre class="mermaid">
flowchart TD
 A[&amp;#34;Broad Text Data&amp;#34;] --&amp;gt; B[&amp;#34;Large-scale Pretraining&amp;#34;]
 B --&amp;gt; C[&amp;#34;General Language Model&amp;#34;]
 C --&amp;gt; D[&amp;#34;Prompt or Adaptation&amp;#34;]
 D --&amp;gt; E[&amp;#34;Task Output&amp;#34;]

 style A fill:#E1F5FE
 style B fill:#C8E6C9
 style C fill:#FFF9C4
 style D fill:#EDE7F6
 style E fill:#E1F5FE
&lt;/pre>

&lt;h2 id="1-from-neural-language-models-to-llms-">
 1. From Neural Language Models to LLMs ☆
 
 &lt;a class="anchor" href="#1-from-neural-language-models-to-llms-">#&lt;/a>
 
&lt;/h2>
&lt;p>A neural language model learns a conditional probability for the next token:&lt;/p></description></item><item><title>Part-of-Speech Tagging and Hidden Markov Models</title><link>https://arshadhs.github.io/docs/ai/050-nlp/060-part-of-speech-tagging/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://arshadhs.github.io/docs/ai/050-nlp/060-part-of-speech-tagging/</guid><description>&lt;h1 id="part-of-speech-tagging-and-hidden-markov-models">
 Part-of-Speech Tagging and Hidden Markov Models
 
 &lt;a class="anchor" href="#part-of-speech-tagging-and-hidden-markov-models">#&lt;/a>
 
&lt;/h1>
&lt;p>Part-of-Speech tagging assigns a grammatical category to each word in a sequence. Because many words can play different grammatical roles, a tagger must use surrounding context rather than examine each word independently.&lt;/p>
&lt;h2 id="learning-objectives">
 Learning Objectives
 
 &lt;a class="anchor" href="#learning-objectives">#&lt;/a>
 
&lt;/h2>
&lt;ul>
&lt;li>Identify common English word classes and Penn Treebank tags.&lt;/li>
&lt;li>Explain why POS tagging is a sequence-labelling problem.&lt;/li>
&lt;li>Describe the Markov assumption.&lt;/li>
&lt;li>Distinguish a Markov Chain from a Hidden Markov Model.&lt;/li>
&lt;li>Explain how an HMM represents POS tagging.&lt;/li>
&lt;/ul>
&lt;h2 id="big-picture">
 Big Picture
 
 &lt;a class="anchor" href="#big-picture">#&lt;/a>
 
&lt;/h2>


&lt;pre class="mermaid">
flowchart TD
 A[&amp;#34;Word Sequence&amp;#34;] --&amp;gt; B[&amp;#34;Use Context&amp;#34;]
 B --&amp;gt; C[&amp;#34;Infer Hidden Tags&amp;#34;]
 C --&amp;gt; D[&amp;#34;Tagged Sequence&amp;#34;]

 style A fill:#E1F5FE
 style B fill:#C8E6C9
 style C fill:#FFF9C4
 style D fill:#EDE7F6
&lt;/pre>

&lt;h2 id="1-what-is-part-of-speech-tagging-">
 1. What Is Part-of-Speech Tagging? ☆
 
 &lt;a class="anchor" href="#1-what-is-part-of-speech-tagging-">#&lt;/a>
 
&lt;/h2>
&lt;p>A part of speech describes the grammatical role played by a word in a sentence. POS tagging assigns one tag to every word in a sequence.&lt;/p></description></item><item><title>Statistical, ML and Neural Models of POS Tagging</title><link>https://arshadhs.github.io/docs/ai/050-nlp/070-statistical-ml-and-neural-models-of-pos-tagging/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://arshadhs.github.io/docs/ai/050-nlp/070-statistical-ml-and-neural-models-of-pos-tagging/</guid><description>&lt;h1 id="statistical-ml-and-neural-models-of-pos-tagging">
 Statistical, ML and Neural Models of POS Tagging
 
 &lt;a class="anchor" href="#statistical-ml-and-neural-models-of-pos-tagging">#&lt;/a>
 
&lt;/h1>
&lt;p>&amp;lsquo;HMM Inference: Forward and Viterbi Algorithms&amp;rsquo; covers the portion:&lt;/p>
&lt;ul>
&lt;li>Forward Algorithm&lt;/li>
&lt;li>Viterbi Algorithm&lt;/li>
&lt;li>HMM inference for POS tagging&lt;/li>
&lt;/ul>
&lt;p>The complete Topic also includes:&lt;/p>
&lt;ul>
&lt;li>Maximum Entropy Markov Models&lt;/li>
&lt;li>Bidirectionality&lt;/li>
&lt;li>Neural-network models for POS tagging&lt;/li>
&lt;/ul>
&lt;h1 id="hmm-inference-forward-and-viterbi-algorithms">
 HMM Inference: Forward and Viterbi Algorithms
 
 &lt;a class="anchor" href="#hmm-inference-forward-and-viterbi-algorithms">#&lt;/a>
 
&lt;/h1>
&lt;p>Hidden Markov Models create two closely related inference problems:&lt;/p>
&lt;ul>
&lt;li>&lt;strong>Likelihood:&lt;/strong> How probable is an observed sequence under the model?&lt;/li>
&lt;li>&lt;strong>Decoding:&lt;/strong> Which hidden-state sequence most probably generated the observations?&lt;/li>
&lt;/ul>
&lt;p>The Forward Algorithm solves the likelihood problem, while the Viterbi Algorithm solves the decoding problem. Both use dynamic programming and a trellis, but they combine paths differently.&lt;/p></description></item></channel></rss>