Models & Architecture Flashcards
(40 cards)
What is a vector
It is a mathematical representation of a word or sequence of words
Is genai model a neural network
True.
What is an autoencoder
It is a type of neural network used for unsupervised learning, and it plays an important role in Generative AI (GenAI). Its primary purpose is to learn efficient, low-dimensional representations of input data (encoding) and then reconstruct the original data from these representations (decoding). Here’s an explanation of its structure and role in GenAI:
What is an Encoder:
Transforms the input data into a compressed, lower-dimensional latent representation.
For example, an image might be reduced from a high-dimensional array to a compact vector.
What is an Decoder
Reconstructs the original data from the compressed latent representation.
It attempts to recreate the input as accurately as possible.
Autoencoders are foundational in Generative AI for tasks such as:
Image Generation: VAEs are used to generate realistic images by learning latent representations of image datasets.
Data Augmentation: Autoencoders can generate variations of existing data to improve training in machine learning models.
Anomaly Detection: In applications like fraud detection or medical imaging, autoencoders are used to flag data points that differ significantly from learned patterns.
Style Transfer: Latent representations from autoencoders can be manipulated to alter attributes like style, color, or texture in images.
GANs are composed of two models, such as:
Generator (it generates images to trick the discriminator) and Discriminator (accurately predicts if the image is real)
What is Classification in terms of vectors
refers to the process of categorizing data points represented as vectors into predefined groups or classes. In machine learning and data science, this involves mathematical techniques to determine which class a given vector belongs to based on its features.
What is Normalization in the context of Generative AI (GenAI)
is the process of adjusting or scaling data to improve the performance, stability, and generalization capabilities of models. This concept applies across various stages of GenAI, from preprocessing input data to normalizing intermediate representations within the model itself. Here’s how normalization is relevant.
What are the two main features of presenting Data as Vectors
Each data point is represented as a vector in a high-dimensional space.
For example, a vector
𝑥 = [x1 ,x 2, …x n ]
could represent features like height, weight, and age for a classification task.
The dimensions of the vector correspond to the number of features in the data.
Why Normalize Inputs?
Prevents certain features with large values from dominating the training process.
Speeds up convergence by stabilizing the optimization process.
Reduces the likelihood of numerical instability
What are features
Features are the measurable properties of data that describe its underlying characteristics. In GenAI, these features are often represented as vectors to serve as input to or output from models
What is Cosine distance
is a measure used in mathematics and machine learning to calculate the dissimilarity between two vectors. It is derived from the cosine similarity, which measures how similar two vectors are based on the cosine of the angle between them. Cosine distance is used when we are more interested in the “direction” of the vectors rather than their magnitude.
1 - A * B / (|A| |B|)
What is Cosine Similarity
The cosine similarity between two vectors
A and B is defined as:
CosineSimilarity =
cos(𝜃) = 𝐴 ⋅ 𝐵 / ∥𝐴∥ ∥𝐵∥
Where:
A⋅B is the dot product of A and B.
∥A∥ and ∥B∥ are the magnitudes (Euclidean norms) of the vectors.
The result ranges from:
+
1
+1: Perfectly similar (pointing in the same direction).
0
0: Completely orthogonal (no similarity).
−
1
−1: Perfectly opposite directions.
what is word embedding
It is a technique used in natural language processing (NLP) to represent words or phrases as dense vectors of numbers. These vectors capture the semantic meaning of words by placing similar words closer together in the embedding space. Word embeddings are foundational for many NLP tasks, including language modeling, machine translation, and sentiment analysis.
What is the cosine similarity for vector A = [1,0,-1] and B = [0,1,-1]
Dot Product:
𝐴 ⋅𝐵 = A⋅B=(1×0)+(0×1)+(−1×−1)=0+0+1=1
Magnitudes:
∥A∥= (1 power2 +0 power 2 +(−1) power2 ) power 1/2 = 2
∥B∥= (0 power 2 +1 power2 +(−1) power 2 ) power 1/2 = 2
Cosine Similarity:
cos(θ)= 1 / (2 power 1/2 * 2 power 1/2) = 0.5
Cosine distance : 1 - 0.5 = 0.5
Word2Vec is supported by
Neuronetworks
Word2Vec is a popular algorithm introduced by Google, which uses two main approaches:
Continuous Bag of Words (CBOW): Predicts a word given its surrounding context.
Skip-Gram: Predicts the surrounding words given a specific word.
What is a Context Window?
A context window defines the span of words around a target word that are used during training to learn its embedding. For example, in the sentence:
“Thequickbrownfoxjumpsoverthelazydog.”
“Thequickbrownfoxjumpsoverthelazydog.”
If the target word is “fox”, and the context window size is 2, the words “quick”, “brown”, “jumps”, and “over” are included in the context window.
What is supervise learning
This is when the labels are provided
What are the components of a network
Input
Hidden layer
Output layer
The work to be predicted
To multiply matrices they have to the have the following structure
matrix 1 = [1 * 5 ] * [5 * 1] = [1 * 3]
What is The Continuous Bag of Words (CBOW) model
It is a method for generating word embeddings, introduced as part of the Word2Vec framework by Google. In CBOW, the goal is to predict a target word based on its surrounding context words. It is an efficient approach for learning dense, low-dimensional vector representations of words.
The CBOW Model Overview
Input: A context window of words surrounding a target word.
Output: The target word.
Objective: Minimize the error in predicting the target word given its context words.