BRAINWARE UNIVERSITY
[PCC-BES00022] CLASS NOTES [Artificial Intelligence]
Module: 2
Traditional Programming:
In traditional programming, a developer explicitly writes a set of rules and instructions for a
computer to follow to produce a desired output. This approach is deterministic; for a given input,
the program will always produce the same, predictable output because the logic is predefined by a
human programmer.
• Explicit Rules: Programmers define every step and condition the program should take. For
example, if you want a program to calculate the area of a rectangle, you would explicitly
tell it:
area = length * width.
• Data as Input, Rules as Logic: Data is processed according to these predefined rules. The
program's behaviour is entirely governed by the rules encoded by the developer.
• Limited Adaptability: Traditional programs are good at solving problems for which clear,
logical rules can be formulated. However, they struggle with complex, ambiguous, or
constantly changing problems where rules are difficult to define or enumerate. Examples
include recognizing patterns in images or understanding natural language.
• Debugging: Errors usually stem from flaws in the explicit logic written by the programmer.
Artificial Intelligence (AI) - Focusing on Generative AI:
In contrast to traditional programming, AI, particularly Generative AI, involves training models
on vast amounts of data to learn patterns, relationships, and structures within that data. Instead of
being explicitly programmed with rules, the AI model infers these rules from the data it's exposed
to.
• Learning from Data: Generative AI models are trained on large datasets (e.g., text,
images, audio, code) to understand their underlying distribution.
• Implicit Rules (Learned Patterns): The "rules" are not hardcoded but are learned patterns
and statistical relationships extracted during the training process.
• Generation of New Content: Generative AI excels at creating new, original content that
resembles the training data but isn't an exact copy. For example, a Generative AI model
trained on images of cats can generate new images of cats that have never been seen before.
• Examples of Generative AI Applications: The course specifically mentions applications
like ChatGPT (for text generation), DALL-E (for image generation), and Diffusion models
2025-26 Prepared by: Dept. of CSE ( Brainware University, Barasat )
BRAINWARE UNIVERSITY
[PCC-BES00022] CLASS NOTES [Artificial Intelligence]
(also for image generation). These models can write essays, create art, compose music, or
even generate code based on a given prompt.
• Probabilistic Nature: The output of Generative AI models can be probabilistic; given the
same input, they might produce slightly different but still coherent outputs, reflecting the
learned distribution of the data.
• Ethical Considerations and Challenges: The micro-lecture plan also highlights that
Module 2 covers "Ethics & Challenges in GenAI," indicating the importance of
understanding the societal implications, biases, and potential misuse of these powerful
tools.
Key Differences Summarized:
Feature Traditional Programming Artificial Intelligence (Generative AI)
Logic/Rules Explicitly defined by programmer. Implicitly learned from data by the model.
Behaviour Deterministic and predictable. Can be probabilistic; generates novel
content.
Adaptability Limited to predefined rules; Highly adaptable; learns from patterns;
struggles with ambiguity. handles complex data.
Primary Goal Execute specific tasks based on Learn patterns to generate new, similar, or
given instructions. transformative content.
"Intelligence" Programmed intelligence. Emergent intelligence from data-driven
learning.
1. Discriminative Models:
• Goal: Discriminative models focus on learning a direct mapping from inputs (X) to outputs
(Y), essentially drawing a boundary or decision surface between different classes. They are
primarily concerned with
classification or prediction.
• What they learn: They learn the conditional probability distribution P(Y∣X), which
represents the probability of an output given an input. They do not model the underlying
distribution of the input data itself.
2025-26 Prepared by: Dept. of CSE ( Brainware University, Barasat )
BRAINWARE UNIVERSITY
[PCC-BES00022] CLASS NOTES [Artificial Intelligence]
• How they work: These models directly identify the differences between classes. For
example, in a classification task, they learn to distinguish between "cat" and "dog" images
without needing to understand what a "typical" cat or dog image looks like.
• Examples: Common discriminative models include:
o Support Vector Machines (SVMs)
o Logistic Regression
o Decision Trees
o Neural Networks (often used for discriminative tasks)
• Strengths:
o Generally, perform very well in classification tasks, especially with large datasets.
o Can be simpler and faster to train than generative models for prediction tasks.
o Robust to noisy data.
• Weaknesses:
o Cannot generate new data samples.
o Don't provide insights into the underlying data distribution.
o May require more data to achieve good performance compared to generative models
in some scenarios.
2. Generative Models:
• Goal: Generative models aim to understand and model the underlying distribution of the
data (P(X)) or the joint probability distribution of inputs and outputs (P(X,Y)). Once this
distribution is learned, they can then generate new data samples that resemble the training
data. They can also be used for
classification by calculating P(Y∣X) using Bayes' theorem.
• What they learn: They learn P(X) (for unsupervised generation) or P(X,Y) (for supervised
tasks). From
P(X,Y), they can infer P(Y∣X) for classification and P(X∣Y) for generation.
• How they work: These models learn the characteristics of each class or the overall data,
allowing them to create new, synthetic data points that share similar properties with the
training data. For instance, a generative model trained on cat images can generate new,
unseen cat images.
• Examples: Common generative models include:
o Naive Bayes
o Generative Adversarial Networks (GANs)
o Variational Autoencoders (VAEs)
o Hidden Markov Models (HMMs)
o Large Language Models (LLMs) like ChatGPT and Diffusion models like DALL-
E (as discussed in the course outline as applications of Generative AI).
2025-26 Prepared by: Dept. of CSE ( Brainware University, Barasat )
BRAINWARE UNIVERSITY
[PCC-BES00022] CLASS NOTES [Artificial Intelligence]
• Strengths:
o Can generate new, realistic data samples.
o Can handle missing data more naturally.
o Can learn from unlabelled data (unsupervised learning).
o Potentially requires less labelled data for certain tasks compared to discriminative
models.
• Weaknesses:
o Can be more complex and computationally expensive to train.
o Evaluating the quality of generated samples can be challenging.
o Might not always achieve superior classification performance compared to
discriminative models designed specifically for classification.
Summary Table of Differences:
Feature Discriminative Models Generative Models
Data generation, understanding
Primary Goal Classification, prediction
data distribution
Learns $P(Y X)$ (conditional probability)
Focus Distinguishing between classes Modelling the data itself
Can Generate Data No Yes
Image classification, spam detection, Image generation, text
Common Tasks
sentiment analysis generation, anomaly detection
Often more complex and
Complexity Generally simpler for prediction
computationally intensive
2025-26 Prepared by: Dept. of CSE ( Brainware University, Barasat )
BRAINWARE UNIVERSITY
[PCC-BES00022] CLASS NOTES [Artificial Intelligence]
Applications of Generative AI: ChatGPT, DALL-E, and Diffusion
Generative AI focuses on creating new, original content that resembles human-created data.
ChatGPT, DALL-E, and Diffusion models are prominent examples showcasing the power and
versatility of this field.
1. ChatGPT (Generative Pre-trained Transformer):
• Nature: ChatGPT is a type of Large Language Model (LLM). It is a generative model
specifically designed for natural language processing tasks.
• Functionality: It can understand and generate human-like text based on the prompts it
receives. Its capabilities include:
o Conversation: Engaging in coherent and contextually relevant dialogues.
o Content Creation: Writing articles, stories, poems, scripts, emails, and various
other forms of text.
o Summarization: Condensing long texts into shorter, digestible summaries.
o Translation: Translating text between different languages.
o Question Answering: Providing informative answers to a wide range of questions.
o Code Generation: Generating code snippets or even entire programs in various
programming languages.
• Underlying Principle: ChatGPT learns patterns, grammar, and context from vast amounts
of text data, allowing it to predict the most probable next word or sequence of words to
generate meaningful responses.
• Applications: Customer service chatbots, virtual assistants, content generation for
marketing and media, educational tools, and programming assistance.
2. DALL-E:
• Nature: DALL-E is a generative AI model primarily focused on image generation from
textual descriptions.
2025-26 Prepared by: Dept. of CSE ( Brainware University, Barasat )
BRAINWARE UNIVERSITY
[PCC-BES00022] CLASS NOTES [Artificial Intelligence]
• Functionality: It can create unique and diverse images from scratch based on natural
language prompts. Key capabilities include:
o Text-to-Image Synthesis: Generating images from descriptive text (e.g., "a cat
wearing a top hat riding a bicycle").
o Image Inpainting/Outpainting: Modifying existing images by filling in missing
parts or extending them beyond their original borders.
o Variations: Generating different variations of a given image or concept.
o Stylization: Applying specific artistic styles to generated images.
• Underlying Principle: DALL-E connects concepts in text to visual representations,
learning how words describe visual attributes, objects, and their relationships. It can then
synthesize these elements into novel images.
• Applications: Art and design, content creation for advertising, media, and entertainment,
prototyping and visualization, and generating unique visual assets.
3. Diffusion Models:
• Nature: Diffusion models are a class of generative models that have gained significant
traction for their high-quality image and audio generation capabilities. They are explicitly
mentioned as an application within the course.
• Functionality: These models work by learning to reverse a diffusion process.
1. Forward Diffusion:
o The process starts with real data (e.g., an image) and progressively adds random
noise at each step.
o This gradually transforms the data into a state resembling pure noise.
o The forward process is fixed and predefined.
2. Reverse Sampling (or Reverse Diffusion):
o The model learns to reverse the noise addition process, effectively removing the
noise and reconstructing the original data.
o This is achieved by training a neural network to predict the noise at each step.
o By iteratively removing the predicted noise, the model can generate new, realistic
data samples.
2025-26 Prepared by: Dept. of CSE ( Brainware University, Barasat )
BRAINWARE UNIVERSITY
[PCC-BES00022] CLASS NOTES [Artificial Intelligence]
• Strengths:
o High Fidelity: Known for generating exceptionally high-quality and realistic
images.
o Diversity: Can generate a wide variety of samples.
o Controllability: Often allow for fine-grained control over the generation process
through techniques like conditional generation (e.g., generating an image based on
text).
• Applications: High-resolution image synthesis, text-to-image generation (DALL-E 2,
Stable Diffusion, and Midjourney are examples that utilize diffusion techniques), video
generation, and audio synthesis.
These applications highlight the transformative potential of Generative AI across various domains,
from creative industries to automating content generation and enhancing user experiences. The
course also notes that ethical considerations and challenges in Generative AI will be discussed,
which is crucial given the capabilities of these powerful models
Large Language Models (LLMs)
1. Definition and Core Concept:
• Large Language Models (LLMs) are a class of artificial intelligence models designed to
understand, generate, and process human language.
• They are "large" because they contain billions or even trillions of parameters, which allow
them to learn complex patterns and relationships within vast amounts of text data.
• They are "language models" because their primary function is to predict the next word in a
sequence, which enables them to generate coherent and contextually relevant text.
2. Architecture (General Overview):
Large language models or LLMs typically have three architectural elements:
1. Encoder: After a tokenizer converts large amounts of text into tokens, which are numerical
values, the encoder creates meaningful embeddings of tokens that put words with similar
meanings close together in vector space.
2. Attention mechanisms: These algorithms are used in LLMs that enable the model to focus
on specific parts of the input text, for related words of text. This is not separate from the
encoder and decoder.
2025-26 Prepared by: Dept. of CSE ( Brainware University, Barasat )
BRAINWARE UNIVERSITY
[PCC-BES00022] CLASS NOTES [Artificial Intelligence]
3. Decoder: The tokenizer converts the tokens back into words so we can understand. In this
process, the LLM predicts the next word, and the next word, for millions of words. Once
the models complete their training process, they can now accomplish new tasks such as
answering questions, doing language translations, semantic search and more.
Encoder Decoder
Attention
Mechanism
3. Training Process:
• LLMs are trained on enormous datasets of text and code, often sourced from the internet
(e.g., books, articles, websites, conversations).
• The training process involves tasks like:
o Next-word prediction: Predicting the next word in a sentence given the preceding
words.
o Masked language modeling: Predicting masked (hidden) words within a sentence.
• This pre-training phase allows the model to learn grammar, syntax, semantics, factual
knowledge, and common-sense reasoning embedded in human language.
• After pre-training, LLMs often undergo a
fine-tuning phase, which can involve supervised fine-tuning or reinforcement learning
from human feedback (RLHF) to align their outputs with human preferences and
instructions.
4. Key Capabilities:
• Text Generation: Creating coherent and contextually appropriate text, including articles,
stories, poems, emails, and code.
• Question Answering: Providing informed answers to a wide range of questions.
• Summarization: Condensing long documents or conversations into shorter summaries.
• Translation: Translating text between different languages.
• Code Generation and Debugging: Assisting with programming tasks.
• Conversation: Engaging in natural and interactive dialogues.
• Sentiment Analysis: Determining the emotional tone of a piece of text.
• Information Extraction: Identifying and extracting specific entities or facts from text.
5. Real-World Applications (as mentioned in the course):
• ChatGPT: Powers conversational AI agents for customer service, virtual assistants,
content creation, and educational support.
2025-26 Prepared by: Dept. of CSE ( Brainware University, Barasat )
BRAINWARE UNIVERSITY
[PCC-BES00022] CLASS NOTES [Artificial Intelligence]
• Content Creation: Automating the generation of various forms of written content for
marketing, media, and publishing.
• Search and Information Retrieval: Enhancing search engines by understanding natural
language queries and providing more relevant results.
• Education: Acting as tutoring tools, generating explanations, or creating study materials.
• Software Development: Assisting developers with code completion, bug detection, and
generating documentation.
6. Challenges (as mentioned in the course):
• Bias: LLMs can inherit biases present in their training data, leading to unfair or
discriminatory outputs.
• Hallucination: They can sometimes generate factually incorrect or nonsensical
information.
• Ethical Concerns: Issues related to misuse, misinformation, copyright, and job
displacement.
• Computational Cost: Training and running LLMs require significant computational
resources.
• Explainability: Understanding why an LLM produces a particular output can be difficult
due to their black-box nature.
2025-26 Prepared by: Dept. of CSE ( Brainware University, Barasat )