Alex Xu Profile picture
Jan 31 12 tweets 5 min read
/1 How does ChatGPT work?

Disclaimer: since OpenAI hasn't provided all the details, some parts of the diagram may be inaccurate. @sama, we would love to hear your feedback.

We attempted to explain how it works in the diagram below. The process can be broken down into two parts.
/2 1. Training. To train a ChatGPT model, there are two stages:

- Pre-training: In this stage, we train a GPT model (decoder-only transformer) on a large chunk of internet data.
/3 The objective is to train a model that can predict future words given a sentence in a way that is grammatically correct and semantically meaningful.

After the pre-training stage, the model can complete given sentences, but it is not capable of responding to questions.
/4 - Fine-tuning: This stage is a 3-step process that turns the pre-trained model into a question-answering ChatGPT model:
/5 1). Collect training data that comprise (questions and answers), and fine-tune the pre-trained model on this data. The model takes a question as input and learns to generate an answer similar to the training data.
/6
2). Collect more data that comprise (question, several answers) and train a reward model to rank these answers from most relevant to least relevant.
3). Use reinforcement learning (PPO optimization) to fine-tune the model, so the model's answers are more accurate.
/7 2. Answer a prompt
🔹Step 1: The user enters the full question.

🔹Step 2: The question is sent to a content moderation component. This component ensures that the question does not violate safety guidelines and filters inappropriate questions.
/8 🔹Steps 3-4: If the input passes content moderation, it is sent to the chatGPT model. If the input doesn’t pass content moderation, it goes straight to template response generation.
/9 🔹Step 5-6: Once the model generates the response, it is sent to a content moderation component again. This ensures the generated response is safe, harmless, unbiased, etc.
/10 🔹Step 7: If the input passes content moderation, it is shown to the user. If the input doesn’t pass content moderation, it goes to template response generation and shows a template answer to the user.
/11 Subscribe to our weekly free newsletter to learn something new every week: bit.ly/3FEGliw
/12 I hope you've found this thread helpful.

Follow me @alexxubyte for more.

Like/Retweet the first tweet below if you can:

• • •

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

Keep Current with Alex Xu

Alex Xu 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 @alexxubyte

Jan 30
/1 𝐃𝐨𝐞𝐬 𝐭𝐡𝐞 𝐜𝐥𝐨𝐮𝐝 𝐫𝐞𝐚𝐥𝐥𝐲 𝐬𝐚𝐯𝐞 𝐜𝐨𝐬𝐭𝐬?

Let’s look at this question 𝐢𝐧 𝐚 𝐥𝐨𝐧𝐠𝐞𝐫 𝐭𝐢𝐦𝐞 𝐫𝐚𝐧𝐠𝐞 to see what the cloud brings us.
/2 🔹 When a company or a business line initially starts, product-market fit is key. The cloud enables quick setup to run the system with minimal necessary hardware. The cost is also transparent.
/3 For example, if we run the databases on-premise, we need to take care of hardware setup, operating system installation, DBMS maintenance, etc. But if we use Amazon RDS, we need to take care of optimization.

This saves us the trouble to hire Linux admins and DB admins
Read 10 tweets
Jan 26
/1 What is Buy Now, Pay Later (BNPL), and how does it work? What is the revenue model for BNPL providers?
/2 The growth of BNPL has been dramatic in recent years. The BNPL provider represents the primary interface between the merchants and the customers for both eCommerce and POS (Point of Sale).
/3 The diagram below shows how the process works:

Step 0. Bob registers with AfterPay. An approved credit/debit card is linked to this account.

Step 1. The "Buy Now, Pay Later" payment option is chosen by Bob when he wants to purchase a $100 product.
Read 10 tweets
Jan 24
/1 𝐆𝐢𝐭 𝐌𝐞𝐫𝐠𝐞 𝐯𝐬. 𝐆𝐢𝐭 𝐑𝐞𝐛𝐚𝐬𝐞

What are the differences? Image
/2 When we 𝐦𝐞𝐫𝐠𝐞 𝐜𝐡𝐚𝐧𝐠𝐞𝐬 from one Git branch to another, we can use ‘git merge’ or ‘git rebase’. The diagram below shows how the two commands work.
/3 𝐆𝐢𝐭 𝐌𝐞𝐫𝐠𝐞
This creates a new commit G’ in the main branch. G’ ties the histories of both main and feature branches.

Git merge is 𝐧𝐨𝐧-𝐝𝐞𝐬𝐭𝐫𝐮𝐜𝐭𝐢𝐯𝐞. Neither the main nor the feature branch is changed. Image
Read 8 tweets
Jan 23
/1 8 Data Structures That Power Your Databases. Which one should we pick?
/2 The answer will vary depending on your use case. Data can be indexed in memory or on disk. Similarly, data formats vary, such as numbers, strings, geographic coordinates, etc. The system might be write-heavy or read-heavy.
/3 All of these factors affect your choice of database index format.

The following are some of the most popular data structures used for indexing data:

🔹Skiplist: a common in-memory index type. Used in Redis
Read 9 tweets
Jan 19
/1 How do Visa 𝐝𝐢𝐬𝐩𝐮𝐭𝐞 and 𝐜𝐡𝐚𝐫𝐠𝐞𝐛𝐚𝐜𝐤 work?

A dispute happens when a cardholder disagrees with a merchant’s charge. A chargeback is a process of reversing the charge. Sometimes, the two terms are used interchangeably. Image
/2 A dispute is 𝐞𝐱𝐩𝐞𝐧𝐬𝐢𝐯𝐞: for every dollar in disputed transactions, an additional $1.50 is spent on fees and expenses.

The diagram below shows why. 👇 Image
/3 🔹 Steps 1-3: The cardholder Bob raises a dispute with the card issuer. Details are reviewed by the issuing bank. In cases of legitimate disputes, the issuing bank submits a chargeback request to the card network. Image
Read 9 tweets
Jan 17
1/ 𝐖𝐡𝐚𝐭 𝐢𝐬 𝐭𝐡𝐞 𝐩𝐫𝐨𝐜𝐞𝐬𝐬 𝐟𝐨𝐫 𝐝𝐞𝐩𝐥𝐨𝐲𝐢𝐧𝐠 𝐜𝐡𝐚𝐧𝐠𝐞𝐬 𝐭𝐨 𝐩𝐫𝐨𝐝𝐮𝐜𝐭𝐢𝐨𝐧?

The diagram below shows several common 𝐝𝐞𝐩𝐥𝐨𝐲𝐦𝐞𝐧𝐭 𝐬𝐭𝐫𝐚𝐭𝐞𝐠𝐢𝐞𝐬.
2/ 𝐁𝐢𝐠 𝐁𝐚𝐧𝐠 𝐃𝐞𝐩𝐥𝐨𝐲𝐦𝐞𝐧𝐭

Big Bang Deployment is quite straightforward, where we roll out a new version in one go with service downtime. We roll back to the previous version if the deployment fails.

💡 No downtime ❌
💡 Targeted users ❌
3/ 𝐑𝐨𝐥𝐥𝐢𝐧𝐠 𝐃𝐞𝐩𝐥𝐨𝐲𝐦𝐞𝐧𝐭

Rolling Deployment applies phased deployment compared with big bang deployment. The whole plant is upgraded one by one over a period of time.

💡 No downtime ✅
💡 Targeted users ❌
Read 9 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!

:(