Akshay 🚀 Profile picture
Jun 9 9 tweets 4 min read Twitter logo Read on Twitter
LLMs are everywhere but do you know how they generate text❓

Let's take the magic out of it and break things down to first principles!

Today I'll explain what is conditional probability and how it is related to LLMs!

A Thread 🧵👇 Image
Before diving into LLMs, lets understand conditional probability.

We consider a population of 14 individuals:

- Some of them like Tennis 🎾
- Some like Football ⚽️
- A few like both 🎾 ⚽️
- And few like none

Here's how it looks 👇 Image
So what is Conditional probability ⁉️

It's a measure of the probability of an event given that another event has occurred.

If the events are A and B, we denote this as P(A|B).

This reads as "probability of A given B"

Check this illustration 👇 Image
For instance, if we're predicting whether it will rain today (event A), knowing that it's cloudy (event B) might impact our prediction.

As it's more likely to rain when it's cloudy, we'd say the conditional probability P(A|B) is high.

That's conditional probability for you! 🎉
Now, how does this apply to LLMs like GPT-4❓

These models are tasked with predicting the next word in a sequence.

This is a question of conditional probability: given the words that have come before, what is the most likely next word? Image
To predict the next word, the model calculates the conditional probability for each possible next word, given the previous words (context).

The word with the highest conditional probability is chosen as the prediction. Image
The LLM learns a high-dimensional probability distribution over sequences of words.

And the parameters of this distribution are the trained weights!

The training or rather pre-training** is supervised.

I'll talk about the different training steps next time!**

Check this 👇 Image
Hopefully, this thread has demystified a bit of the magic behind LLMs and the concept of conditional probability.

if you want to learn more about building with LLMs, @LightningAI has some top resources on the same!

Check this out👇
lightning.ai/pages/blog/ Image
That's a wrap!

If you interested in:

- Python 🐍
- Data Science 📈
- Machine Learning 🤖
- MLOps 🛠
- NLP 🗣
- Computer Vision 🎥
- LLMs 🧠

I'm sharing daily content over here, follow me → @akshay_pachaar if you haven't already!!

Cheers! 🥂

• • •

Missing some Tweet in this thread? You can try to force a refresh
 

Keep Current with Akshay 🚀

Akshay 🚀 Profile picture

Stay in touch and get notified when new unrolls are available from this author!

Read all threads

This Thread may be Removed Anytime!

PDF

Twitter may remove this content at anytime! Save it as PDF for later use!

Try unrolling a thread yourself!

how to unroll video
  1. Follow @ThreadReaderApp to mention us!

  2. From a Twitter thread mention us with a keyword "unroll"
@threadreaderapp unroll

Practice here first or read more on our help page!

More from @akshay_pachaar

Jun 10
Businesses need data analysis more than ever!

Microsoft offers a highly practical & hands-on roadmap to become a skilled Data Analyst! 🧑‍🎓

You will learn:

- Story telling
- Data modeling
- Data visualization
- Decision making
- Data analysis in Power BI

A Thread 🧵👇 Image
1️⃣ Get started with Microsoft data analytics

You will learn how the suite of Power BI tools and services are used by a data analyst to tell a compelling story through reports & dashboards.

Check this out👇
learn.microsoft.com/en-us/training…
2️⃣ Prepare data for analysis

You will learn to use Power Query to extract and clean data from various sources.

Load data into Power BI for modeling.

Check this out👇
learn.microsoft.com/en-us/training…
Read 8 tweets
Jun 8
Not every Data Scientist makes a hefty salary, those who do often have a strong foundation in Mathematics and Statistics.

However, many of us struggle to learn these subjects!

Let me show you how interactive learning can help you master them: 🧵👇
Strong fundamentals in stats and maths are crucial for Data Science.

After careful research, I discovered that the courses offered by @brilliantorg truly stand out!

They make learning easy with interactive lessons!

Let me share my experience ...👇
Visual, interactive lessons make concepts feel intuitive — so even complex ideas just click.

I took their lesson on hypothesis testing and was genuinely amazed by how they broke it down and provided real-world examples.

Here's a glimpse of the same 👇
Read 6 tweets
Jun 7
K-Means has two major problems:

- Number of clusters must be known
- Doesn't handle outliers

But there's a solution!

Introducing DBSCAN, a Density based clustering algorithm. 🚀

Read more 🧵👇 Image
Simply put, DBSCAN groups together points in a dataset that are close to each other based on their spatial density.

It's very easy to understand, just follow along ...👇
DBSCAN has two important parameters.

1️⃣ Epsilon (eps):

`eps`: represents the maximum distance between two points for them to be considered part of the same cluster.

Points within this distance of each other are considered to be neighbours.

Check this out 👇 Image
Read 9 tweets
Jun 6
LightningAI sped up the best open-source LLM (Falcon 40B) by 20%! 🚀

Falcon is fast, Lit-Parrot just made it faster! 🔥

-- more on Lit-Parrot to follow --

A Thread 🧵👇
Incase you missed my thread on finetuining LLMs, using @LightningAI's Lit-Parrot! 🦜

Check this 👇
LightningAI integrated Falcon-40B into Lit-Parrot and sped it up by 20%!

They’ll keep adding optimizations to squeeze out more performance!

You can follow @LightningAI for latest & greatest in building with LLMs! 🚀

Check it out👇
github.com/Lightning-AI/l…
Read 4 tweets
Jun 5
K-Means++ from scratch using Python 🔥

K-Means++ has a smarter way to initialise cluster centroids & is much more robust than K-Means ✔️

-- step by step explanation with code --

A Thread 🧵👇 Image
First of all, we create a sample data for clustering.

We'll use `make_blobs` from sklearn to do so.

Check this out 👇 Image
Initialising the cluster centroids is a key challenge in KMeans.

KMeans++ starts by selecting random centroid.

Then uses a probability-based approach to select next centroid that is far away from the previously chosen centroids.

This makes the initialization spread out. Image
Read 6 tweets
Jun 4
Google has created a Generative AI learning path with 9 FREE courses!

Topics cover:
- Intro to LLMs
- Attention Mechanism
- Image Generation/Captioning
- Intro to Responsible AI

From the fundamentals of LLMs to creating & deploying generative AI solutions! 🚀

Read more 🧵👇 Image
1️⃣ Introduction to Generative AI:

An introductory level micro-learning course aimed at explaining:

- What Generative AI is
- How it is used
- How it differs from traditional ML

Check this out👇
cloudskillsboost.google/course_templat… Image
2️⃣ Introduction to Large Language Models:

The course explores:

- Fundamentals LLMs
- Their use cases
- Prompt engineering on LLMs

Check this out👇
cloudskillsboost.google/course_templat… Image
Read 11 tweets

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3/month or $30/year) and get exclusive features!

Become Premium

Don't want to be a Premium member but still want to support us?

Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal

Or Donate anonymously using crypto!

Ethereum

0xfe58350B80634f60Fa6Dc149a72b4DFbc17D341E copy

Bitcoin

3ATGMxNzCUFzxpMCHL5sWSt4DVtS8UqXpi copy

Thank you for your support!

Follow Us on Twitter!

:(