0% found this document useful (0 votes)
2 views40 pages

Deep Learning Exam Guide

The document provides a detailed explanation of Word Vector Representations and Word Embedding, focusing on the Skip-Gram model of Word2Vec. It outlines the definitions, importance, and workings of these concepts in Natural Language Processing, including comparisons with one-hot encoding and the architecture of neural networks. Additionally, it emphasizes the advantages of the Skip-Gram model and its applications in various NLP tasks.

Uploaded by

snehasinghlily07
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views40 pages

Deep Learning Exam Guide

The document provides a detailed explanation of Word Vector Representations and Word Embedding, focusing on the Skip-Gram model of Word2Vec. It outlines the definitions, importance, and workings of these concepts in Natural Language Processing, including comparisons with one-hot encoding and the architecture of neural networks. Additionally, it emphasizes the advantages of the Skip-Gram model and its applications in various NLP tasks.

Uploaded by

snehasinghlily07
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

2026-08-16 16:18:26 You

i had a subject deep learning coming in my mid sem exam , i send


the each unit topic one by one analyze and give briefly answer and
explanation for each topic so that i will write in exam and also
provide diagram or images if possible , try in way so that can i can
understand easily.

ChatGPT gpt-5-6

Absolutely. 👍
Send me one Deep Learning topic at a time, and I’ll explain each topic in an exam-oriented + easy-
to-understand way.

For every topic, I’ll follow this format:

📚 Topic Explanation Format


1. Definition
A short, easy definition that you can directly use in the exam.

2. Easy Explanation
I’ll explain the concept in simple language so you actually understand it.

3. Key Points
Important points that are likely to help in a 3–5 mark answer.

4. Example
A simple real-world or technical example wherever useful.

5. Diagram
I’ll provide a simple exam-friendly diagram wherever possible, which you can reproduce in your
answer sheet.

6. Exam Answer
A concise, properly structured answer that you can write directly in the mid-sem exam.

7. Quick Revision
A few points to memorize before the exam.

For example, if you send:

Types of Activation Functions

Exported with AI Exporter 1 / 40


I'll cover Sigmoid, Tanh, ReLU, Leaky ReLU, Softmax, etc., with formulas, diagrams,
advantages/disadvantages, and an exam-ready answer.

✍️ How I'll keep it


Simple language

Not unnecessarily lengthy

Important keywords in bold

Suitable for [Link] mid-sem answers

Diagrams wherever they genuinely help

I'll clearly distinguish understanding from what to write in the exam

Send me your first Deep Learning topic.

2026-08-16 16:19:22 You

Word Vector Representations: Introduction to Word Embedding:


Neural Language Model, Word2Vec: Skip-Gram Model,

ChatGPT gpt-5-6

Word Vector Representations & Word Embedding


This topic is important in NLP + Deep Learning. The main idea is: computers cannot directly
understand words like humans, so we represent words as numerical vectors.

1. Word Vector Representations

Definition
Word vector representation is a method of representing a word as a numerical vector of real numbers
so that a machine learning model can process and understand relationships between words.

For example:

text

"king" → [0.25, 0.81, -0.14, 0.62, ...]


"queen" → [0.27, 0.79, -0.12, 0.65, ...]

Words having similar meanings tend to have similar vector representations.

Exported with AI Exporter 2 / 40


Why do we need word vectors?
A computer cannot directly process:

text

I love machine learning

Instead, words are converted into numbers:

text

I → [0.12, 0.45, 0.21, ...]


love → [0.72, 0.18, 0.61, ...]
machine → [0.31, 0.55, 0.42, ...]
learning → [0.35, 0.58, 0.39, ...]

These vectors can then be given to a neural network.

2. Word Embedding

Definition
Word embedding is a technique of representing words as dense, low-dimensional numerical vectors
in such a way that words with similar meanings have similar vector representations.

For example:

text

Word Embedding Space

king ●
\
\
● queen

● apple
\
● orange

The important idea is:

Similar words → Similar vectors

For example:

king and queen → semantically related

Exported with AI Exporter 3 / 40


car and vehicle → semantically related

cat and dog → semantically related

One-hot Encoding vs Word Embedding


This is a useful exam comparison.

One-Hot Encoding Word Embedding

Sparse representation Dense representation

Vector size = vocabulary size Usually much smaller

Mostly 0s Contains meaningful numerical values

Does not capture word similarity Captures semantic relationships

Example: [0,0,1,0,0] Example: [0.21,0.73,-0.12,...]

Easy way to remember


One-hot: "Which word is this?"

Embedding: "What is the meaning/relationship of this word?"

3. Introduction to Neural Language Model


A Neural Language Model (NLM) is a neural network that learns to predict a word based on its
surrounding/context words.

Example
Consider:

"The cat is drinking ___"

The model may predict:

text

water → 0.75
milk → 0.15
food → 0.05
car → 0.01
...

So, the model learns relationships between words by observing their contexts.

Exported with AI Exporter 4 / 40


Basic structure

text

Input Words

Word Representations

Neural Network

Output

Probability of
possible words

For example:

text

"The" + "cat" + "is"



Neural Network

"drinking"

Main purpose
The neural language model learns:

Given some words, what word is likely to come next?

This learning process can produce useful word representations/embeddings.

4. Word2Vec

Definition
Word2Vec is a popular neural-network-based technique used to learn word embeddings from large
amounts of text.

It was introduced by researchers at Google and became popular because it can efficiently learn
meaningful relationships between words.

Word2Vec mainly has two architectures:

text

Exported with AI Exporter 5 / 40


Word2Vec
|
┌────────┴────────┐
↓ ↓
CBOW Model Skip-Gram Model
Context → Word Word → Context

Your syllabus specifically mentions Skip-Gram, so focus more on that.

5. Skip-Gram Model

Definition
The Skip-Gram model learns word embeddings by using a target word to predict its surrounding
context words.

Most important line for exam ⭐


Skip-Gram predicts the surrounding/context words from a given target word.

For example:

text

"The cat drinks milk"

Suppose the target word is:

text

cat

The surrounding words may be:

text

The drinks
\ /
\ /
cat

The Skip-Gram model tries to predict:

text

cat → The
cat → drinks

Exported with AI Exporter 6 / 40


Depending on the selected context window, it may also predict other nearby words.

6. Skip-Gram Architecture
Suppose the sentence is:

The cat drinks milk

Take cat as the target word.

text

Target Word

"cat"


┌─────────────┐
│ Word2Vec │
│ Skip-Gram │
└─────────────┘
/ | \
↓ ↓ ↓
"The" "drinks" "..."
Context words

Conceptual flow

text

Input


Target
"cat"


Word Embedding


Neural Network


Probability of
Context Words

Exported with AI Exporter 7 / 40


7. How Skip-Gram Works
Let's take:

"The cat drinks milk"

Assume the window size = 1.

For target word cat:

text

The cat drinks milk


↑ ↑ ↑
context target context

Training pairs become:

text

(cat, The)
(cat, drinks)

The model learns to predict The and drinks when it receives cat.

Another example
Sentence:

I love machine learning

If target word is machine and window size = 1:

text

I love machine learning



Target

Context words:

text

love
learning

Training pairs:

text

Exported with AI Exporter 8 / 40


(machine, love)
(machine, learning)

So Skip-Gram learns:

text

machine → love
machine → learning

By doing this over a huge amount of text, the model learns useful representations for every word.

8. How Word Embeddings Are Learned


Initially, word vectors are usually initialized with random values.

Example:

text

cat → [0.12, -0.31, 0.72, 0.15]

The model makes predictions and calculates the error.

Then backpropagation + gradient descent updates the vectors.

text

Random Word Vectors



Skip-Gram Model

Prediction

Error

Backpropagation

Gradient Descent

Improved Vectors

After training on a large corpus, words that occur in similar contexts tend to obtain similar vectors.

9. Skip-Gram Mathematical Idea


The objective of Skip-Gram is to maximize the probability of the context words given the target word.

Exported with AI Exporter 9 / 40


In simple terms:

P (context word∣target word)

For example:

P (drinks∣cat)

The model tries to make this probability high if cat and drinks commonly occur near each other.

The overall objective can be written as:

T
max ∑ ​ ∑ ​ log P (wt+j ∣wt )
​ ​

t=1 −c≤j≤c,j=0

Where:

wt = target word

wt+j = context word


c = context window size


T = number of words in the training corpus
For a mid-sem exam, understanding the concept is more important than memorizing this formula
unless your teacher specifically emphasizes mathematical derivation.

10. Why Skip-Gram Is Useful


Skip-Gram can learn interesting relationships between words.

For example:

text

king ───── queen




man ───── woman

The learned vector space can capture relationships such as:

semantic similarity

syntactic similarity

relationships between words

A famous example is approximately:

king − man + woman ≈ queen

Exported with AI Exporter 10 / 40


This demonstrates that the vector space can capture relationships between words.

11. Advantages of Skip-Gram

1. Learns meaningful word embeddings.

2. Captures semantic relationships between words.

3. Works well with large vocabularies.

4. Can represent rare words better than CBOW in many settings.

5. Useful for various NLP applications.

Applications

Machine Translation

Sentiment Analysis

Text Classification

Information Retrieval

Question Answering

Chatbots

Document Similarity

12. Exam-Ready Answer ⭐


Word2Vec – Skip-Gram Model
Word2Vec is a neural-network-based technique used to learn dense vector representations of words. It
has two main architectures: CBOW and Skip-Gram.

The Skip-Gram model takes a target word as input and tries to predict the surrounding context words.
For example, in the sentence "The cat drinks milk", if cat is the target word, the model tries to predict
nearby words such as The and drinks.

text

Target Word
"cat"


┌─────────────┐
│ Skip-Gram │
└─────────────┘
/ \
↓ ↓

Exported with AI Exporter 11 / 40


"The" "drinks"
Context Context

During training, the model adjusts the word vectors using backpropagation and gradient descent.
After training on a large text corpus, words occurring in similar contexts obtain similar vector
representations.

Thus, Skip-Gram is useful for learning semantic and syntactic relationships between words.

🧠 Quick Revision
Remember this chain:

text

Word

Word Embedding

Word2Vec

Skip-Gram

Target Word → Context Words

One-line definitions

Word Vector: Numerical representation of a word.

Word Embedding: Dense vector representation that captures relationships between words.

Neural Language Model: Neural network that learns language patterns and predicts words.

Word2Vec: Technique for learning word embeddings.

Skip-Gram: Predicts context words from a target word.

⭐ Most important difference to remember


text

CBOW:
Context → Target Word

Skip-Gram:
Target Word → Context Words

This CBOW vs Skip-Gram distinction is very commonly asked in exams.

Exported with AI Exporter 12 / 40


2026-08-16 16:20:13 You

Model Components: Architecture, Hidden Layer, Output Layer,

ChatGPT gpt-5-6

Model Components: Architecture, Hidden Layer, Output Layer


These are the basic components of a Neural Language Model / Neural Network model. For the exam,
understand the flow:

Input → Hidden Layer → Output Layer

1. Model Architecture

Definition
Model architecture refers to the overall structure of a neural network, including its input layer, hidden
layers, output layer, connections, and activation functions.

A basic neural network architecture is:

text

NEURAL NETWORK

Input Layer Hidden Layer Output Layer

x₁ ───────────► h₁ ───────────┐
x₂ ───────────► h₂ ───────────┼──► y₁
x₃ ───────────► h₃ ───────────┼──► y₂
x₄ ───────────► h₄ ───────────┘ ...

Main components

1. Input Layer – receives input data.

2. Hidden Layer – processes and extracts useful patterns.

3. Output Layer – produces the final prediction.

In a language model
For example:

text

Exported with AI Exporter 13 / 40


Input Word

Word Embedding

Hidden Layer

Output Layer

Predicted Word

2. Hidden Layer

Definition
A hidden layer is the intermediate layer between the input and output layers that performs
computations and learns useful features or patterns from the input.

It is called hidden because its values are not directly visible as the final output.

Basic working
Each neuron receives inputs, multiplies them by weights, adds a bias, and applies an activation
function.

z = ∑ wi xi + b
​ ​

Then:

h = f(z)

Where:

xi = input

wi = weight

b = bias
f = activation function
h = hidden-layer output

Diagram

text

Input Hidden Layer

x₁ ───────┐
x₂ ───────┼──────► h₁

Exported with AI Exporter 14 / 40


x₃ ───────┼──────► h₂
x₄ ───────┘ h₃

The hidden layer transforms the input into a representation that is useful for making the final
prediction.

In Word2Vec
In Word2Vec, the hidden layer can be viewed as the layer where the word embedding is obtained.

text

Target Word

Input Layer

Hidden Layer

Word Vector

So, remember:

Hidden Layer = learns useful internal representation/features.

3. Output Layer

Definition
The output layer is the final layer of a neural network that produces the prediction or result.

For a language model, the output layer gives the probability of possible words.

Example
Suppose the input is:

I love

The model may produce:

text

Word Probability
----------------------
you 0.45
coding 0.25
music 0.15
food 0.10
car 0.05

Exported with AI Exporter 15 / 40


The word with the highest probability may be selected as the prediction.

Diagram

text

Hidden Layer


┌───────────────┐
│ Output Layer │
└───────────────┘
│ │ │
▼ ▼ ▼
you coding music
0.45 0.25 0.15

4. Softmax in the Output Layer


For classification or language prediction, the Softmax activation function is commonly used in the
output layer.

It converts the output scores into probabilities:

ezi ​

P (yi ) =
∑j ezj
​ ​

The probabilities of all possible output words add up to 1.

Example:

text

Output Layer

Softmax Function

┌───────────┼───────────┐
↓ ↓ ↓
cat dog car
0.70 0.20 0.10

Therefore:

0.70 + 0.20 + 0.10 = 1

Exported with AI Exporter 16 / 40


5. Complete Model Architecture
For a simple neural language model:

text

INPUT


Word / Word ID


Word Embedding


┌───────────┐
│ Hidden │
│ Layer │
└───────────┘


┌───────────┐
│ Output │
│ Layer │
└───────────┘


Softmax


Predicted Word

Simple example
Input:

The cat is

The model processes the input and predicts:

sleeping

text

"The cat is"



Word Embedding

Hidden Layer

Exported with AI Exporter 17 / 40



Output Layer

Softmax

"sleeping" ← Prediction

6. Difference Between Hidden Layer and Output Layer

Hidden Layer Output Layer

Intermediate layer Final layer

Learns internal features/representations Produces final prediction

Usually not directly observable Gives the final result

Can be one or multiple layers Usually final layer

Uses activation functions Uses suitable output activation, e.g. Softmax

⭐ Exam-Ready Answer
Model Components in Neural Networks
A neural network model consists mainly of an input layer, hidden layer(s), and output layer. These
layers are connected through weights and biases.

Architecture represents the overall arrangement and connections between these layers.

The hidden layer performs computations on the input and learns useful features or representations.
Each neuron calculates a weighted sum of inputs and applies an activation function.

h = f(W x + b)

The output layer produces the final prediction. In a neural language model, it generates probabilities
for possible words. Softmax is commonly used to convert output scores into probabilities.

text

Input → Word Embedding → Hidden Layer → Output Layer → Prediction

Thus, the hidden layer learns useful representations, while the output layer produces the final result.

🧠 Quick Revision
Remember:

Exported with AI Exporter 18 / 40


Architecture → Overall structure
Hidden Layer → Learns features/representation
Output Layer → Gives prediction
Softmax → Converts scores into probabilities

Most important flow:

Input → Hidden → Output → Prediction

2026-08-16 16:20:54 You

CBOW Model, Subsampling Frequent Words: Negative Sampling.

ChatGPT gpt-5-6

CBOW Model, Subsampling Frequent Words & Negative Sampling


These three concepts are closely related to Word2Vec. For the exam, remember:

text

Word2Vec

┌────────┴────────┐
↓ ↓
CBOW Skip-Gram


Subsampling + Negative
Sampling

1. CBOW Model

Definition
CBOW (Continuous Bag of Words) is a Word2Vec model that predicts a target word from its
surrounding context words.

⭐ Most important line


CBOW: Context Words → Target Word

This is exactly opposite to Skip-Gram:

Exported with AI Exporter 19 / 40


Skip-Gram: Target Word → Context Words

Example
Consider the sentence:

The cat drinks milk

Suppose cat is the target word.

The surrounding words are:

text

The cat drinks


↑ ↑ ↑
Context Target Context

CBOW takes:

text

"The" + "drinks"

and tries to predict:

text

"cat"

Diagram

text

Context Words
┌───────┬───────┐
↓ ↓ ↓
"The" "drinks"
\ /
\ /
▼ ▼
┌──────────┐
│ CBOW │
│ Model │
└──────────┘


Target Word

Exported with AI Exporter 20 / 40


"cat"

2. How CBOW Works


Consider:

I love machine learning

Assume the window size = 1.

For target word machine:

text

I love machine learning


↑ ↑ ↑
context target context

CBOW uses:

text

love + learning

to predict:

text

machine

So the training example is:

text

Input: love, learning


Output: machine

CBOW Architecture

text

Context Words

┌─────┴─────┐
↓ ↓
Word Vector Word Vector

Exported with AI Exporter 21 / 40


│ │
└─────┬─────┘

Average/Sum
of Vectors

Hidden Layer

Output Layer

Softmax

Target Word

The context word vectors are combined, commonly by taking their average, and the model uses this
representation to predict the target word.

3. CBOW vs Skip-Gram ⭐
This is very important for exams.

CBOW Skip-Gram

Context → Target Target → Context

Predicts target word Predicts surrounding words

Generally faster to train Generally slower

Works well for frequent words Often better for rare words

Uses multiple context words as input Uses one target word as input

Easy trick 🧠
CBOW = Context Before/around → Output Word

Skip-Gram = Skip around the target → predict surrounding words

4. Subsampling Frequent Words

Why is subsampling needed?


In a large text corpus, some words occur extremely frequently.

Examples:

text

Exported with AI Exporter 22 / 40


the
is
a
of
to
and

These words are called frequent words.

They occur so often that they can:

increase training time

produce many unnecessary training examples

provide relatively little useful information

dominate the training process

Therefore, Word2Vec can use subsampling to randomly remove some occurrences of very frequent
words.

Example
Sentence:

The cat is on the mat and the cat is happy.

Words such as:

text

the, is, and

occur frequently.

Instead of using every occurrence:

text

The → training example


is → training example
the → training example
is → training example
...

the model may randomly discard some frequent words.

This makes training:

faster and more efficient.

Exported with AI Exporter 23 / 40


Subsampling Concept

text

Large Text Corpus




Identify frequent
words


Randomly discard
some occurrences


Smaller training
corpus


Word2Vec

Important point
Subsampling does not mean removing all frequent words.

It means:

Randomly removing some occurrences of very frequent words during training.

5. Negative Sampling

Definition
Negative Sampling is a technique used in Word2Vec to make training much faster by training the
model to distinguish between real word-context pairs and randomly selected incorrect pairs.

Why is Negative Sampling needed?


Suppose the vocabulary contains:

text

1,000,000 words

If we use a normal Softmax, the model may need to calculate probabilities for all 1,000,000 words.

Exported with AI Exporter 24 / 40


This is computationally expensive.

Negative Sampling solves this problem by considering only a small number of negative examples.

6. Positive and Negative Examples


Suppose the sentence is:

The cat drinks milk

For Skip-Gram:

text

Target = cat
Context = drinks

This is a positive pair:

text

(cat, drinks) → 1

Now randomly select words that are not the actual context:

text

(cat, car) → 0
(cat, computer) → 0
(cat, banana) → 0

These are negative pairs.

Diagram

text

Target
"cat"

┌──────────┴──────────┐
↓ ↓
Positive Pair Negative Pairs
(cat, drinks) (cat, car)
│ (cat, banana)
↓ (cat, computer)
1 0

Exported with AI Exporter 25 / 40


The model learns:

text

Real context pair → 1


Random/incorrect pair → 0

7. How Negative Sampling Works


Suppose we choose 3 negative samples.

For a positive pair:

text

(cat, drinks)

we create:

text

(cat, drinks) → 1 Positive


(cat, car) → 0 Negative
(cat, house) → 0 Negative
(cat, phone) → 0 Negative

The model only needs to update these few examples instead of calculating probabilities for the entire
vocabulary.

Flow

text

Target Word


"cat"


┌──────────────┐
│ Word2Vec │
│ │
└──────────────┘
/ \
↓ ↓
Real Context Random Words
"drinks" "car", "phone"

Exported with AI Exporter 26 / 40


↓ ↓
1 0

8. Negative Sampling and Sigmoid


Negative Sampling commonly uses the Sigmoid function to determine whether a word pair is a
genuine context pair.

1
σ(x) =
1 + e−x

Output:

text

Close to 1 → Positive/real pair


Close to 0 → Negative/random pair

For example:

text

(cat, drinks) → 0.95 → Positive


(cat, car) → 0.02 → Negative

9. Advantages of Negative Sampling

1. Reduces computational cost.

2. Makes Word2Vec training much faster.

3. Avoids calculating Softmax over the entire vocabulary.

4. Works well for large vocabularies.

5. Helps the model learn meaningful word relationships.

10. Subsampling vs Negative Sampling


This difference can be asked in an exam.

Subsampling Negative Sampling

Deals with very frequent words Deals with training pairs

Removes some frequent-word occurrences Creates incorrect/negative word pairs

Exported with AI Exporter 27 / 40


Subsampling Negative Sampling

Reduces unnecessary training examples Reduces computation during output training

Improves training efficiency Improves training efficiency

Example: discard some "the" Example: (cat, car) → 0

🧠 Easy way to remember


Subsampling:

"Remove some unnecessary frequent words."

Negative Sampling:

"Add some incorrect examples so the model learns what is wrong."

⭐ Exam-Ready Answer
CBOW Model
CBOW (Continuous Bag of Words) is a Word2Vec architecture that predicts a target word using its
surrounding context words.

For example, in "The cat drinks milk", the context words "The" and "drinks" can be used to predict
"cat".

text

Context Words → CBOW → Target Word


"The", "drinks" → CBOW → "cat"

CBOW is generally faster to train and works well for frequent words.

Subsampling Frequent Words


Subsampling is a technique used in Word2Vec to randomly discard some occurrences of very
frequent words such as "the", "is", "a". This reduces unnecessary training examples and improves
training speed and efficiency.

text

Frequent Words

Randomly discard some occurrences

Reduced Training Data

Exported with AI Exporter 28 / 40



Faster Word2Vec Training

Negative Sampling
Negative Sampling is a technique that speeds up Word2Vec training by training the model using a
small number of positive and negative word pairs instead of calculating probabilities for the entire
vocabulary.

For example:

text

(cat, drinks) → 1 Positive


(cat, car) → 0 Negative
(cat, phone) → 0 Negative

It significantly reduces computational complexity and makes Word2Vec suitable for large datasets.

🔥 Last-Minute Revision
text

CBOW:
Context → Target

Skip-Gram:
Target → Context

Subsampling:
Remove some frequent words

Negative Sampling:
Use positive + random negative pairs

One sentence to memorize:

CBOW predicts a target word from context, subsampling removes some frequent words to
reduce unnecessary training, and negative sampling uses a few incorrect word pairs to make
Word2Vec training faster.

2026-08-16 16:21:24 You

Exported with AI Exporter 29 / 40


Efficient Softmax approximations, Sampling-based approximations
for Softmax, Glove, Cross-lingual word embedding models

ChatGPT gpt-5-6

Efficient Softmax Approximations, Sampling-Based Softmax, GloVe & Cross-


Lingual Word Embeddings
These topics are mainly about making word embedding models faster and learning meaningful
word representations across languages.

1. Why do we need Efficient Softmax?


In a language model, suppose the vocabulary contains 1 million words.

When predicting the next word, normal Softmax calculates a probability for every word in the
vocabulary.

Normal Softmax

text

Hidden Layer


┌─────────────┐
│ Softmax │
└─────────────┘
/ | | \
↓ ↓ ↓ ↓
word1 word2 ... word1M

This is computationally expensive because the model must calculate scores for a huge number of
words.

Therefore:
Efficient Softmax approximations reduce the computational cost of calculating the Softmax
over a large vocabulary.

2. Efficient Softmax Approximations

Exported with AI Exporter 30 / 40


Instead of calculating the probability of every word directly, we use methods that approximate the
Softmax.

Important approaches include:

1. Hierarchical Softmax

2. Sampling-based methods

Negative Sampling

Noise Contrastive Estimation (NCE)

3. Other approximation techniques

For your syllabus, focus especially on sampling-based approximations.

3. Hierarchical Softmax
Hierarchical Softmax represents the vocabulary using a binary tree.

Instead of comparing a target word with every word:

text

Normal Softmax:

Target

Compare with
all vocabulary words

Very expensive

Hierarchical Softmax uses a tree:

text

Root
/ \
/ \
Node Node
/ \ / \
/ \ / \
Word Word Word Word

To find the probability of a word, the model follows a path from the root to the target word.

Therefore, computation is reduced significantly.

Key idea

Exported with AI Exporter 31 / 40


If vocabulary size is V :

Normal Softmax → approximately O(V)

Hierarchical Softmax → approximately O(log V)

So it is much more efficient for large vocabularies.

4. Sampling-Based Approximations for Softmax

Definition
Sampling-based Softmax approximation reduces computation by evaluating only a small subset of
words instead of the entire vocabulary.

For example, instead of:

text

1,000,000 words

Calculate Softmax for all

Very expensive

we use:

text

1,000,000 words

Sample a small number

Example: 1 positive + 10 negatives

Much faster

5. Negative Sampling
Negative Sampling is one of the most important sampling-based techniques used with Word2Vec.

Suppose:

text

Target = cat
Correct context = drinks

Exported with AI Exporter 32 / 40


Positive example:

text

(cat, drinks) → 1

Random negative examples:

text

(cat, car) → 0
(cat, phone) → 0
(cat, table) → 0

Instead of calculating probabilities for the entire vocabulary, the model learns to distinguish:

text

Real pair → 1
Wrong pair → 0

Advantage
It makes training much faster, especially when the vocabulary is very large.

6. GloVe

Full form
GloVe = Global Vectors for Word Representation

Definition
GloVe is an unsupervised word embedding method that learns word vectors using the statistical
information of word co-occurrences in a large corpus.

The main idea is:

Words that occur in similar contexts tend to have similar meanings.

7. Main Idea of GloVe


Suppose we have:

"I like eating apples."

and

"I like eating bananas."

Exported with AI Exporter 33 / 40


The words apples and bananas occur in similar contexts.

Therefore, GloVe learns vectors that place them close together.

text

Word Vector Space

apples ●
\
\
● bananas

● car
|
|
vehicle

8. GloVe Uses Co-occurrence Matrix


GloVe makes use of a word-word co-occurrence matrix.

Suppose we have:

text

I like eat apple car


I 0 5 3 1 0
like 5 0 4 3 0
eat 3 4 0 5 1
apple 1 3 5 0 0
car 0 0 1 0 0

The values represent how frequently words occur together within a particular context/window.

GloVe uses these global co-occurrence statistics to learn word vectors.

9. GloVe Architecture / Working

text

Large Text Corpus



Word Co-occurrence
Statistics

Co-occurrence Matrix

Exported with AI Exporter 34 / 40



GloVe Training

Word Vectors

Semantic Relationships

Important point
Unlike Word2Vec, which primarily learns from local context prediction, GloVe explicitly uses global
word co-occurrence statistics.

10. Word2Vec vs GloVe ⭐


Word2Vec GloVe

Prediction-based method Count/co-occurrence-based method

Learns from local context Uses global co-occurrence statistics

Uses CBOW and Skip-Gram Uses co-occurrence matrix

Predicts words/context Learns from word-word co-occurrence

Efficient for large datasets Uses global corpus statistics

Easy memory trick


Word2Vec → Predict

GloVe → Count/Co-occurrence

11. Advantages of GloVe

1. Captures semantic relationships between words.

2. Uses global statistics from the corpus.

3. Produces dense word vectors.

4. Can represent relationships between words effectively.

5. Useful for NLP tasks such as:

Sentiment analysis

Text classification

Machine translation

Information retrieval

Exported with AI Exporter 35 / 40


Question answering

12. Cross-Lingual Word Embedding Models

Definition
Cross-lingual word embeddings represent words from different languages in a shared vector space.

For example:

text

English Hindi

king ●────────────● राजा


\
\
Shared
Vector Space

Words with similar meanings in different languages are mapped to similar locations.

13. Why Cross-Lingual Embeddings?


Normally, separate embedding models may produce separate vector spaces:

text

English Space Hindi Space

king ● राजा ●

queen ● रानी ●

The coordinates don't directly correspond.

Cross-lingual embeddings try to align them:

text

Shared Vector Space

king ● ● राजा

queen ● ● रानी

house ● ● घर

Exported with AI Exporter 36 / 40


Now the model can understand relationships across languages.

14. How Cross-Lingual Embeddings Work


A common approach is:

Step 1: Train embeddings separately

text

English Corpus → English Embeddings

Hindi Corpus → Hindi Embeddings

Step 2: Align the two spaces


A bilingual dictionary or parallel corpus can be used.

text

English Hindi

king ↔ राजा
water ↔ पानी
house ↔ घर

Step 3: Map them into a shared space

text

English Embeddings ──┐


├──► Shared Vector Space
Hindi Embeddings ────┘

15. Applications of Cross-Lingual Embeddings


Cross-lingual word embeddings are useful in:

Machine Translation

Multilingual Search

Cross-language Information Retrieval

Multilingual Sentiment Analysis

Question Answering

Exported with AI Exporter 37 / 40


Multilingual Chatbots

Transfer learning between languages

For example, a model trained using large amounts of English data can potentially transfer some
knowledge to a language with less training data.

⭐ Exam-Ready Answer
Efficient Softmax Approximations
In language models, the Softmax function becomes computationally expensive when the vocabulary
is very large. Efficient Softmax approximations reduce this cost by avoiding computation over the
complete vocabulary. Important techniques include Hierarchical Softmax and sampling-based
methods such as Negative Sampling.

Hierarchical Softmax represents words using a binary tree and calculates the probability by following
a path from the root to the target word.

text

Root
/ \
Node Node
/ \ / \
Word Word Word Word

Thus, the computation can be reduced from approximately O(V) to O(log V).

GloVe
GloVe (Global Vectors for Word Representation) is an unsupervised word embedding method that
learns word vectors using global word-word co-occurrence statistics from a large corpus.

text

Corpus

Co-occurrence Matrix

GloVe Training

Word Vectors

GloVe produces vectors in which words with similar meanings or similar contexts are located close to
each other.

Exported with AI Exporter 38 / 40


Cross-Lingual Word Embeddings
Cross-lingual word embeddings represent words from different languages in a common vector
space. They align semantically similar words across languages.

For example:

text

English Hindi

water ●────────────● पानी


house ●────────────● घर
king ●────────────● राजा

They are useful in machine translation, multilingual information retrieval, sentiment analysis, and
multilingual NLP applications.

🧠 Last-Minute Revision
text

Efficient Softmax

Reduce Softmax computation

Hierarchical Softmax

Binary Tree

O(log V)

Negative Sampling

Positive + Negative samples

GloVe

Global word co-occurrence

Word vectors

Cross-Lingual Embedding

Different languages

Shared vector space

Exported with AI Exporter 39 / 40


⭐ 4 lines to memorize
Word2Vec → predicts words from context.
GloVe → learns from global word co-occurrence statistics.
Negative Sampling → uses a few positive and negative examples to reduce computation.
Cross-lingual embeddings → represent multiple languages in a shared vector space.

Exported with AI Exporter 40 / 40

You might also like