GenAI Workflow Automation NPTEL Zoom Course
GenAI Workflow Automation NPTEL Zoom Course
Automation
Session 1
Introduction
About NPTEL+
elearn.nptel.ac.in
3
About EdTech Society
▪ Public forum, professional non-profit association, committed to
improving instruction and learning through the use of educational
technologies.
▪ Launched in April 2022.
▪ 370+ members; 2 online events per month; T4E conference per
year.
etsociety.org
4
Instructors
https://www.menti.com/alzsc5es5bja
Basics of NLP
NLP – Analysing a sentence
▪ Lemmatisation – Grouping the inflected form of words
• Eating, Ate, Eats - Eat
• Talking, Talked, Talks, Talk – Talk Finding out the root word
Remove suffixes
What is the difference – Ate will not become eat in Stemming but in Lemmatization it will become
12
Activity
NLP
▪ Example Sentence: Walking is good for health. But Jogging is better
than walking
13
Activity Response
NLP
▪ Example Sentence: Walking is good for health. But Jogging is better
than walking
▪ Lemmatised: Walk be good for health. But jog be good than walk
▪ Stemmed: walk is good for health. But jog is bett than walk
14
N-Gram
▪ Unigram Sentence: I like to drink coffee.
▪ Bi-gram
▪ tri-gram
Unigram Dictionary: Bigram Dictionary:
▪ N-gram I I like
Like Like to
To To drink
Drink Drink coffee
coffee
15
Which word will come next?
▪ Markov assumption: The P(current word) depends only on
last word P(Current Word/Previous word) ~
• P(Word_n)/,P (Word_n-1, Word_n-2)
Mark likes to eat meal with his family. Kail likes to sing and
eats meal with her friend. Kiran likes music.
P (to/likes) = ?
P (to/likes) = 2/3
16
How similar is two words or sentence?
▪ Minimum edit distance
17
How similar is two words or sentence?
▪ Minimum edit distance
18
Bag of Words
▪ Word frequency
▪ Similar words
▪ Sparse Vector
Sentence 1: Students interact with peers in class.
Sentence 2: Peer instruction increases students’ interest
Bow_sen1 = {students:1, interact:1, with:1, peer:1, in:1, class:1}
Bow_sen2 = {peer:1, instruction:1, increases:1, students:1, interest:1}
Bow = {students:2, interact:1, with:1, peer:2, in:1, class:1, instruction:1,
increases:1, interest:1}
19
Bag of words
Bow = {1: students, 2:interact, 3:with, 4:peer, 5:class, 6:instruction,
7:increases, 8:interest}
Sentence 1: Students interact with peers in class.
Sentence 2: Peer instruction increases students’ interest
Sen1 = {1,1,1,1,1,0,0,0}
Sen2 = {1,0,0,1,0,1,1,1}
Index
Sen1 = {1,2,3,4,5}
Sen2 = {4,6,7,1,}
20
Activity
Bag of Words
▪ 100 students wrote essay and validated by human experts. If
we want to create a algorithm to grade essays?
21
Preliminary Idea
Bag of Words
22
Tools
▪ https://corenlp.run/
23
Session 3
Intro to WordEmbedding
Basics of LLMs
What is latest before GPT
▪ Word embedding
▪ Vector for each words
• We can define the dimension and context
25
Word2Vec
Introduced by Mikolov et al., 2013, Word2Vec learns word
embeddings (dense vector representations of words) from raw text.
It uses a shallow neural network to predict either :
After training, the hidden-layer weights become the word vectors that
capture semantic meaning .
CBOW & Skip-Gram
▪ Continuous Bag of Words (CBOW): Given surrounding words
(context window) as input, predict the target (center) word.The
model averages (or sums) the context-word embeddings and
applies a softmax output to guess the missing word.
▪ For example, in “The cat sat on the mat” with window size 2,
CBOW would use “The, cat, on, the” to predict “sat”.
https://projector.tensorflow.org/
http://epsilon-it.utu.fi/wv_demo/
28
Word2Vec
▪ Word embedding
▪ Vector for each words
• We can define the dimension and context
Euclidean Distance
http://epsilon-it.utu.fi/wv_demo/
● Two-part architecture :
● Context Vector : The final hidden state from the encoder, serving as a
condensed representation of the entire input sequence.
2. Introduction of Attention : Allows the decoder to focus on different parts of the input
sequence at each step, mitigating the fixed-vector limitation.
4. Supports parallel computation , making it efficient and scalable for large datasets.
Transformers - Attention is All You Need
1. Encoder
2. Decoder
3. Attention
5. Layer Normalization
6. Positional Encodin g
Transformers - Attention is All You Need
1. Encoder
Transformers - Attention is All You Need
2. Decoder
Transformers - Attention is All You Need
3 . Attention
Transformers - Attention is All You Need
4. Feed Forward Network
5. Layer Normalization
6. Positional Encodin g
Transformers - Bert & GPT
BERT - Bidirectional Encoder Representations from
Transformers
1. BERT , introduced in October 2018 by researchers at Google.
2. BERT utilizes only the encoder part of the Transformer architecture, comprising
multiple identical layers.Each token is represented by the sum of three
embeddings:Token,Segment and Position.
3. BERT is pre-trained on two unsupervised tasks: Masked Language Modeling (MLM)
and Next Sentence Prediction (NSP). After pre-training, BERT can be fine-tuned with
just one additional output layer to perform specific tasks like question answering,
sentiment analysis, or named entity recognition.
Visualize BERT
https://colab.research.google.com/drive/1hXIQ77A4TYS4y3UthWF-Ci7V7vVUoxm
Q?usp=sharing
GPT - Generative Pre-trained Transformer
1. GPT utilizes a multi-layer Transformer decoder
architecture with masked self-attention , enabling it
to consider preceding tokens when processing text.
2. Input tokens are converted into context vectors by
passing them through token and position
embedding layers
3. The final output is generated by a softmax layer ,
which produces a probability distribution over
potential target tokens.
https://bbycroft.net/llm
LLMs - From GPT to Now
Session 4
Think what are the ways you improve your interaction with LLMs.
Code Methods
No Code Methods
How do you use LLMs effectively? - Response
How to Customize LLMs effectively?
▪ Prompt Engineering
▪ RAG
▪ Agent
▪ Fine-Tuning
▪ Parameterization
▪ RLHF
Interactive Tools
▪ Prompt Engineering -> Frameworks - Choose your own and rate
them
▪ RAG -> Gemini Gems
▪ Parameterization -> Google Collab Notebook
▪ Agent - Gems, n8n
▪ Fine-Tuning
▪ RLHF
Prompt Engineering
▪ Prompt engineering is writing and optimizing prompts for LLMs
• The goal is to get optimal response
▪ Prompt - the input you provide to the model for a specific response.
▪ Why? Mostly people assume LLMs are human and not provide all relvent
deatils in the required format. LLMs are probabilistic sequence model that
predicts the next token based on context.
▪ Is it important to learn? Not for all tasks. For example prompt fine-tuning
systems like Anthropic’s Dashboard automated the prompt engineering. But
for sepcific it is good to understand
https://cloud.google.com/discover/what-is-prompt-engineering , https://console.anthropic.com/dashboard
Prompt Engineering - Components
▪ Prompt format
▪ Context and Examples
▪ Fine Tuning and Adapting
▪ Iterative Conversations
https://arxiv.org/pdf/2201.11903 , https://www.promptingguide.ai/techniques/cot
Effective Prompting Guidelines
▪ Set Clear Goals and Objectives- Define the desired length and format of
the input,specify the target audience.
▪ Important Terms related to Prompt Size-
• Token Limit – Maximum number of tokens (input + output) the
model can process.
Max Tokens
https://colab.research.google.com/drive/16NXoGqppNy6Pj20pwB7-ftpIZZRCBdwG?usp=sharing
How to Customize LLMs effectively?
▪ Prompt Engineering
▪ RAG
▪ Agent
▪ Fine-Tuning
▪ Parameterization
▪ RLHF
Reinforcement learning from human feedback -
RLHF
▪ RLHF fine-tunes LLMs by aligning their responses with human preferences.
▪ Requires two datasets: preference pairs (for reward model) and prompt-responses (for
RL loop).
Reinforcement learning from human feedback - RLHF
▪ Implemented using libraries like trl (Transformers Reinforcement Learning).
▪ Limitations: High cost of human feedback and compute → Alternatives like DPO & RLAIF.
▪ HF LINK
Session 5
Generation Steps:
Response
▪ Augmented Query Creation:
Combine top retrieved chunks with the user query to form
context-enriched input.
▪ Generation Step:
Feed augmented query into the LLM to generate a more accurate,
knowledge-grounded response.
Retrieval Augmented Generation - Brainstorm
Advantages of RAG:
● Reduces hallucinations and improves factual accuracy. What will be your use
cases for RAG?
● Easily adapts general LLMs to domain-specific tasks. In which instances will
RAG be better than just
● Doesn’t require re-training or fine-tuning the base model.
simple prompting?
Common Use Cases:
● Customer support bots with internal docs.
An agent is a system that can perceive its environment through sensors, process this information, and act
upon the environment through actuators to achieve specific goals.
● What is an AI Agent?
An AI agent is an agent that applies artificial intelligence techniques—such as machine learning, search, logic,
or knowledge representation—to make decisions or improve its behavior over time.
AI Agents - Components
● Sensors: Collect data from the environment.
● Actuators: Execute actions in the environment.
● Percept Sequence: History of all that the agent has perceived.
● Agent Function: Maps percept sequence to actions.
● Agent Program: Implements the agent function.
● PEAS Framework
AI Agents - Characteristics
● Autonomy
● Reactive and Proactive Behavior
● Adaptability
● Goal-Oriented
● Interactivity
● Persistence
AI Agents - Tools
● Autogen Studio : A Microsoft tool for visually building multi-agent LLM systems that
collaborate or converse with each other.
● Superagent : A platform to create and manage AI agents with memory, tool use, and API
integrations—backed by Y Combinator.
● Modern agents often operate through workflows —structured sequences of decisions, tool use,
and API calls.
● Visual Studios like Langflow, Flowise, and Autogen Studio help design these AI workflows
without intensive coding.
● This opens the door to tools like n8n , where agents and automations can be visually built and
deployed.
n8n - Community
▪ https://n8n.io/workflows/3499-ai-powered-student-assistant-for-course-information-via-
twilio-sms/
▪ https://n8n.io/workflows/
▪ You can contribute your template and publish it in the n8n community , being a
creator.
Demo 2:
https://drive.google.com/file/d/15O9gkPSoXFYUu7nzwuSfK3rpfxtJFSEV
/view?usp=sharing
Course Project
Create n8n or customised Gem
Course Project
As an assessment of this workshop, participants should work on a
hands-on project applying the concepts learned.
Two options:
We will share the Google form to collect your responses. Due 13th June.
Next Session
14th June 5 pm
Project Presentation
- We will select 10-12 projects from the submissions and play the
videos - diverse projects will be selected
- Discuss on the project ideas
- Listen to different project and learn from them
Thank You
Final Submission
Title
Description
Yes, No