1 of 62

OpenThaiGPT

Vision and Roadmap�

Kobkrit Viriyayudhakorn�AIEAT

kobkrit@aieat.or.th

Latest Update: 29 July 2023

2 of 62

2023: Year of Generative AI

3 of 62

New AI Startup Start From �English LLM

  • Search Engine + ChatGPT: You.com
  • CopyWriter: copy.ai
  • Image Generator
  • Code Generator
  • Design Generator
  • SEO Automatic Generator
  • Knowledge Chatbot
  • Virtual Assistant
  • Music Generator
  • Law Generator
  • Scientific Research Accelerator
  • Movie Generator
  • Much more…

4 of 62

English Language?

Date: Feb 2023

4,145 Models

5 of 62

How about Thai language?

14 Models

Date: Feb 2023

6 of 62

LLMs is foundation for AI Startup

7 of 62

OpenThaiGPT

OpenThaiGPT is a chat-based assistant focused on Thai language that understands tasks, can interact with third-party systems, and retrieve information dynamically.

It can be extended and personalized easily and is developed as free, open-source software.

8 of 62

Collaboration Founding Members

  • Dr. Kobkrit Viriyayudhakorn
  • Dr. Sumeth Yuenyong
  • Dr. Chanwit Boonchuay
  • Issaret Prachitmutita
  • Autsadang Somboonphol

  • Dr. Thanaruk Theeramunkong
  • Dr. Thepchai Supnithi
  • Dr. Prachya Bookwan

9 of 62

Vision

OpenThaiGPT is to contribute to the advancement of AI technology and its applications in Thailand, and to create a more inclusive and accessible digital environment for Thai language users.

10 of 62

Value Proposition

Building Block for Next Generation AI for Thailand

Open for everyone

Be able to integrate OpenThaiGPT into your application via API or downloadable package under the free and open source license.

Retrieval Knowledge via�Search Engine or External API�Be able to connect to External knowledge, Upgradable without retraining the billions of parameters.

Personalized Chat Assistant�

State-of-the-Art Chat-based Assistant priority on Thai language that can be customized and fine-tuned to all user needed.

11 of 62

OpenThaiGPT นำไปใช้ประโยชน์อะไรได้บ้าง

OpenThaiGPT

Smart Chatbot:

สามารถตอบคำถามใดๆ ตามเนื้อหา

ที่เจ้าของธุรกิจ หรือผู้ให้บริการใส่ความรู้ไว้ให้ได้ และเชื่อม API ไปดึงคำตอบมาได้

Decentralized AI: Building Block พื้นฐานสำคัญของ AI Startup ของไทย

เพราะเป็น Open Source ต่อยอดได้ ปรับแต่งได้ ใช้ทำ Commercial ได้จึง

ไม่มีค่าใช้จ่ายในการเรียกใช้

Finetuning เพื่อใช้ในงาน Generative ด้านอื่นๆ อาทิเช่น เขียนสัญญาทางกฎหมาย เขียนนิทาน ออกแบบละครต่างๆ เป็นต้น เป็นวัตถดิบหลักให้ก่อเกิด Startup AI ในไทย โดย สามารถ Host Model ได้ด้วยตัวเอง และไม่มีค่าบริการเรียกใช้

AGI Classifier: สามารถนำไปสร้างโมเดล AI Classifier แบบ AGI ได้ ด้วยความสามารถของ Few shot Learning โดยไม่ต้องใช้ Data จำนวนมหาศาลแบบ ANI

12 of 62

OpenThaiGPT Road Map

Q3 2023

Mainstream Release

+ Release the first production version of OpenThaiGPT and API.�+ Developing the knowledge retrieval from external source.�+ Allow for business to customization and personalization.

Q4 2023

Reflection

+ Evaluation�+ Quality Improvement�+ What will the Thai society want next?

Q1 2023

PoC

+ Release the PoC of OpenThaiGPT�+ Setup Data Labelling Website�+ PoC RL on Human Feedback (RLHF)�+ PoC of API release�

Q2 2023

Core Development

+ Pre-training the largest auto-gressive LM ever in Thai language.�+ Finetuning with Thai Instruct Dataset.�+ Tuning model with RLHF.

13 of 62

OpenThaiGPT Release Plan

GPT-2 Thai

120 million params

11 March 2023

Finetune: 1-3 Datasets

No RLHF

0.0.4

  • Thai language
  • No Few-shot Learning
  • Identify correct topic and can answer some of questions.
  • OpenThaiGPT-Zero ChatGPT Checker

LLama v1

7,13 billion params

ก-ฮ Character Level Tokens

May 2023

Finetune: 10-20 Datasets

RLHF: Preliminary

0.1.0

  • Thai/English language
  • Few-shot Learning
  • Full Chatbot Capability
  • Thai / English Translation
  • Basic O-Net Exam Capability

Llama v2

7, 13 billion params

Thai Word-Level Tokens�10,000 words

16-17 August 2023

Finetune: 50+ Datasets

RLHF: Conclusived

1.0.0

  • Thai/English language
  • Few-shot Learning
  • Full Chatbot Capability
  • Thai / English Translation
  • Full O-Net Exam Capability
  • Plugged in with API and Search�for Thai Businesses

Dr. Kobkrit Viriyayudhakorn

Dr. Prachya�Boonkwan

Dr. Sumeth�Yuenyong

First Thai Autoregressive�LLM!

First Thai 7b LLM!

8 X Faster than GPT-4 in Thais

14 of 62

Difference between OpenAI ChatGPT vs OpenThaiGPT

  • Generate 1 Thai character at a time.
  • Proprietary Models
  • Need to send the knowledge and information to OpenAI to use and finetune.
  • Usage cost: 0.07 THB per 500 Thai characters (GPT-3.5-Turbo) and 4.11 THB per 500 characters (Custom Fine-tuned Model)
  • Generate 1 Thai word at a time (8x faster)
  • Better accuracy on Thai language.
  • Free and Opensource model.
  • DO NOT send the knowledge and information to outsider to use and finetune. You can use it internally without Internet connection.
  • Free of Charge
  • Customizable Knowledge GUI

15 of 62

Demo (Version 1.0.0)

Version 1.0.0-alpha

Version 1.0.0-beta

16 of 62

17 of 62

Installation Package

1,000 downloads�over 1 month

18 of 62

How to use OpenThaiGPT?

19 of 62

How to use OpenThaiGPT

Zero?

20 of 62

Open Source on Github

18

21 of 62

Open Datasets

22 of 62

Open Training / �Finetuning Code

23 of 62

Open Model / Open Weight

24 of 62

Inference Consumption Needed

Model

fp-16

8bit

4bit

2bit

OpenThaiGPT 7b

16GB

8GB

CPU OK

CPU OK

OpenThaiGPT 13b

32GB

16GB

8GB

CPU OK

OpenThaiGPT 33b

64GB

32GB

16GB

8GB

OpenThaiGPT 65b

128GB

64GB

32 GB

16 GB

OpenThaiGPT 175b

340GB

170GB

86GB

44 GB

VGA GeForce RTX 3090 Ti GAMING X TRIO 24GB GDDR6X 384-bit

34,500 THB (24GB)

NVIDIA Tesla A100 80G Deep Learning GPU Computing Graphics Card OEM Version�600,000 THB (80GB)

25 of 62

Number of parameters are not everything

26 of 62

OpenThaiGPT 7b �Quantized in 4bit model: Running on Macbook Air M2�

27 of 62

Volunteers

150+ persons

28 of 62

Teams

Pretraining�80+ persons

Finetuning + RLHF

40+ persons

Collaboration + Safety Net + ETC�30+ persons

29 of 62

30 of 62

Join us!

31 of 62

Appendix�Evaluations

32 of 62

Q: Evaluations on OpenThaiGPT #1

Full Results: https://docs.google.com/spreadsheets/d/1T85vDGDnmwvYDQLrXad5R-2hS55tkufVtUbJPOFe6GA/edit?usp=sharing

Version

  • OpenThaiGPT 7b 0.1.0-beta (as 1 June 2023)
  • Latest WangchanGLM (as 1 June 2023)

Evaluation Dataset:

  • Human ChatGPT Comparison Corpus (HC3)
  • datasets/Thaweewat/hc3-24k-th
  • This is a 🇹🇭 Thai-instructed dataset translated using Google Cloud Translation from HC3 ( Included total 24K, 17K reddit_eli5, 4K finance, 1.2K medicine, 1.2K open_qa and 0.8K wiki_csai )
  • Unseen Evaluation Dataset ONLY (Not the Training Dataset!)

33 of 62

Q: Evaluations on OpenThaiGPT #2

  • AI2 Reasoning Challenge (ARC) - เป็นชุดคำถามวิทยาศาสตร์ระดับโรงเรียนพื้นฐาน �
  • HellaSwag - เป็นชุดคำถามทดสอบสามัญสำนึกซึ่งง่ายสำหรับมนุษย์แต่ท้าทายสำหรับโมเดล LLMs�
  • MMLU - แบบทดสอบวัดความแม่นยำตอบคำถามของโมเดล LLMs การทดสอบครอบคลุม 57 เรื่อง รวมถึงคณิตศาสตร์ระดับประถมศึกษา, ประวัติศาสตร์สหรัฐ, วิทยาการคอมพิวเตอร์, กฎหมาย, และอื่น ๆ �
  • TruthfulQA - แบบทดสอบวัดความว่า Model ได้หลงเชื่อข่าวเท็จที่พบได้บ่อยครั้งจากอินเตอร์เน็ต/ออนไลน์ หรือไม่

*คะแนนยิ่งเยอะยิ่งดี

34 of 62

Appendix�Using OpenThaiGPT as Text Classifier

35 of 62

Q: OpenThaiGPT can be used as a text classifier?

A: Yes! It can be done in two ways!

  1. Few shot learning with correct configuration.

Using temperature = 0 and logit_bias to scope down the choice.

Finetuning : No need

Supported only limited number of examples due to the limit of max input length.

(2) Finetuning

If the examples (training datasets) are large and complex, fine tuning is recommended.

Using the method (1) on the fine tuned SCBGPT weight, which will increase classification accuracy.

No Finetuning Need

Finetuning Need

36 of 62

(1) Fewshot Learning technique for text classification

Q: OpenThaiGPT can be used as a text classifier?

Settings

  • Temperature = 0
  • Setting all possible options as the whitelist �(logit_bias)

Advantage

  • No fine tuning.
  • Very flexible

Disadvantage

  • Supported only limited number of examples due� to the limit of max input length. (We can solved it in step 2)

37 of 62

Setting the list of options into a whitelist.

Q: OpenThaiGPT can be used as a text classifier?

get_logit_bias([“pos”,“neu”,”neg”])

38 of 62

Method (2) Along with Method (1), Fine tuning the Model for Larger examples.

Q: OpenThaiGPT can be used as a text classifier?

  • Making dataset for the �text classification.
  • Fine Tuning OpenThaiGPT�to generate the single digit�answer
    • 0 = pos
    • 1 = neu
    • 2 = neg
  • Combine with (1) make�it become text classifier.

39 of 62

Multiclass classification?

Q: OpenThaiGPT can be used as a text classifier?

  • We can make OpenThaiGPT to print out all possibility score (logit_prob) at the final softmax layer of the model.

40 of 62

Evaluating the Accuracy of GPT as a Classifier

Q: OpenThaiGPT can be used as a text classifier?

https://github.com/sh0416/llama-classification

41 of 62

Appendix�ChatGPT Development Steps

42 of 62

ChatGPT Development Steps

  1. Empty Weight
  2. GPT-3
  3. InstructGPT
  4. Reinforcement Learning�With Human Feedback�(RLHF)
  5. ChatGPT
  6. Add Safety Net

https://lifearchitect.ai/chatgpt/

43 of 62

GPT-3 Pretraining

Decoder-only�Transformers Architecture

Large Language�Corpus (~600 Billion tokens)

WebText2

Large Language Model�(LLM)

Pretraining

My name is Julien and I like to

My name is Julien and I like to use C#, which is all I really know. In the C# universe, I have two C# friends, Dan and Kevin. I have two boys. Dan is obsessed with C# and when

Gen

44 of 62

Instruct GPT Finetuning

Large Language Model�(LLM)

Fine Tuned LLM that can�follow instruction.

InstructGPT

13K Training Set Prompts

Why is it important to eat socks after meditating?

Gen

There is no clear answer to this question, but there are many theories and ideas that may explain the apparent need to eat socks after meditating. …

Finetuning

https://arxiv.org/abs/2203.02155

45 of 62

Reward Model (RM)

RM dataset has 33k training prompts

Classifier

RM Model

Classify

  • 7: Great Response!
  • Appropriate
  • No Sexual Content
  • No insult

Training

https://arxiv.org/abs/2203.02155

46 of 62

Reinforcement Learning from Human Feedback (RLHF)

InstructGPT

RM Model�(Learned from Human Feedback)

Reinforcement Learning:�Proximal Policy

Optimization (PPO)

Adjust Gradient

Prompt�Input

Prompt�Output

  • 7: Great Response!
  • Appropriate
  • No Sexual Content
  • No insult

31K Prompt for PPO�Training

Generated�Human Feedback

Quality Score : 1.0��Finetuning

Inference

Inference

https://arxiv.org/abs/2203.02155

47 of 62

https://arxiv.org/abs/2203.02155

48 of 62

ETC

49 of 62

OpenThaiGPT Consortium

OpenThaiGPT Consortium

Committees from AIEAT, AIAT, and external partnerships / sponsorships.

OpenThaiGPT Working Group

50 of 62

OpenThaiGPT Usage / Extension

51 of 62

Getting Start

  • Transformer Model Candidates (Prefer over 1 billion parameters):
    • CodeGen
    • GPT-J
    • GPT-2 XL Thai
    • XLM
    • mT5
  • Conversational / Instruct Dataset for Fine Tuning:
    • Collecting from various QA / FAQ / Webboard in Thailand
    • Thai QA Datasets from Wikipedia
  • RLHF
    • Conditional Proximal Policy Optimization (PPO) Training by using RM Model on how similarity of the result with InstructDataset

52 of 62

Tasks & Resource Needs

  1. Pre-training the largest auto-gressive LM ever in Thai language.
      • Large Thai Pre-training Dataset
      • Very Large GPU Training Server
  2. Thai Conversational / Instruct Dataset for Fine Tuning.
      • Collect (human) demonstrations of assistant interactions (At least 30K pairs)
      • Additional Dataset from Summarization, Wiki QA & Community and Webboard
      • Development of Data Collection Website
  3. Reward Model Classifier (RM Model)
      • Human-evaluated on the Prompt Generation Quality (At least 30K pairs)
      • Development of Data Labeling Website
  4. PPO Model
      • Collect (human) demonstrations of assistant interactions (Only prompt part) (At least 30K pairs)

53 of 62

Main Efforts

  • Data Collection Code → Backend, website
  • Instruction Dataset Gathering → Scraping & cleaning web data
  • Gamification → Leaderboards & more, to make data collection more fun
  • Model Training → Experiments on pseudo- and real-data
  • Infrastructure → Collection, training, and inference
  • Data Collection → Crawling, Cleaning, Data Packaging
  • Data Augmentation → Making more data from little data
  • Privacy and Safety → Protecting sensitive data

54 of 62

OpenThaiGPT

Backup Slides

55 of 62

OpenThaiGPT

OpenThaiGPT Volunteer Meet Up #1

2023-03-05

56 of 62

57 of 62

Thai GPT-2�(124 m)

Thai InstructGPT�7,000 Pairs

None

None

OpenThaiGPT�POC Model = 0.0.3

https://github.com/OpenThaiGPT/openthaigpt

58 of 62

OpenThaiGPT

Azure Opensource Day

Microsoft Cloud Squad

Global AI Bootcamp - Thailand

59 of 62

Next for OpenThaiGPT

60 of 62

Thai GPT-2

(124 m)

Thai InstructGPT�7,000 Pairs

None

None

OpenThaiGPT�POC 0.0.3

OpenThaiGPT�POC 0.0.4

Thai GPT-2

(124 m)

Thai InstructGPT�14,000 Pairs + 71 Tagged Dataset

Perplexity + ???

Thai Tweet Toxicity�+ ???

Thai GPT-2-base (124 million) = 0.0.X

61 of 62

Thai GPT-2

(124 m)

Thai InstructGPT�7,000 Pairs

None

None

OpenThaiGPT�POC 0.0.3

OpenThaiGPT�POC 0.1.0

mGPT�(1.5 b)

Thai InstructGPT�14,000 Pairs + 71 Tagged Dataset

Perplexity + ???

Thai Tweet Toxicity�+ ???

mGPT (1.5B) = 0.1.X

62 of 62

OpenThaiGPT - Zero

Thai Text GPT Checker

Coming soon