Skip to main content

35 posts tagged with "ai"

View all tags

[LLM 4/10] DPO: When a Language Model Becomes Its Own Reward Model

· 7 min read
Kobkrit Viriyayudhakorn
CEO, iApp Technology

In the last chapter we did RLHF with PPO, and you saw how many moving parts it has — a separate reward model to train, four models resident in VRAM at once, a dozen-plus PPO hyperparameters to tune, and if the reward model is off, the policy finds a shortcut that games the score. In this chapter we'll accomplish the same thing with an ordinary supervised training loop — no reward model, no RL. And crucially, this is not an approximation. We'll prove algebraically that those two pieces genuinely cancel out.

[LLM 5/10] GRPO: Deleting the Value Network and Letting a Group of Answers Be Its Own Baseline

· 9 min read
Kobkrit Viriyayudhakorn
CEO, iApp Technology

The last chapter ended on DPO's gap: it can only rank answers someone prepared in a file. And chapter 3 paid PPO's full price: 4 models in VRAM, plus an entire value network to train on the side. This chapter combines the good halves of both — the model samples its own answers to learn from, genuine RL — but deletes the value network wholesale, using a statistical observation so simple it's almost irritating nobody framed it sooner: if you sample several answers to the same problem, the group's mean reward is already the baseline the value network was trying to estimate. And if the problem can be graded by code, we need no human preference data at all — zero pairs, zero baht.

[LLM 6/10] Context Distillation: Moving the System Prompt into the Model's Weights

· 8 min read
Kobkrit Viriyayudhakorn
CEO, iApp Technology

Every time a user messages your chatbot, you attach the same system prompt, hundreds of tokens long — every request, for the lifetime of the system, paid again and again with no end. This chapter moves that block of knowledge from the prompt into the model's weights, using a technique called Context Distillation in its on-policy version (OPCD). The most beautiful part: the teacher and the student are the exact same model — the only thing that differs is who gets to see the prompt.

[LLM 7/10] Model Distillation: The Teacher's Wrong Answers Are the Most Valuable Part

· 8 min read
Kobkrit Viriyayudhakorn
CEO, iApp Technology

In chapter 6 we distilled a context into the weights of the same model. In this chapter we distill an entire model into a smaller one. The two chapters are a deliberate pair: context distillation changes what the model knows without having to tell it anymore — model distillation changes the size of the model while trying not to change what it can do. And the heart of this chapter cuts hard against intuition: the most valuable thing a teacher can hand its student is not the right answer, but the way the teacher is wrong — and the dial called temperature is what makes that visible.

[LLM 8/10] Guardrails: The Real Safety Fence Isn't a Model, It's a Threshold

· 7 min read
Kobkrit Viriyayudhakorn
CEO, iApp Technology

The Thai chatbots my team and I deploy for real customers don't only meet polite questions — people ask for recipes for illegal things, people try to trick the bot into insulting others, and there was a day the model volunteered a customer's phone number all by itself. In this chapter we build protection in both directions: a classifier that checks incoming prompts for danger and an outbound PII filter. But the central point of the chapter isn't the model — it's the fact that a guardrail is a threshold decision under asymmetric costs, and the "94% accuracy" figure people love to show off is very nearly meaningless.

[LLM 9/10] Benchmarking: An Accuracy Number Without a Confidence Interval Is a Rumor

· 7 min read
Kobkrit Viriyayudhakorn
CEO, iApp Technology

Since chapter 1, this series has repeated the same sentence every time it reports a number: "accuracy without a confidence interval is not an experimental result, it's a rumor" — and promised a full explanation in chapter 9. This is that chapter. We won't train a single step. Instead we'll build a three-mode evaluation system from scratch, put every checkpoint trained across the series on real Thai exams, and prove that the settings nobody writes down in papers move the very same model's score by more than the leaderboard gaps people argue about.

[LLM 10/10] Deployment: You're Not Waiting on Compute, You're Waiting on Weights to Travel

· 8 min read
Kobkrit Viriyayudhakorn
CEO, iApp Technology

Across nine chapters we've injected knowledge, taught format, arranged preferences, distilled models, kept models from breaking, and measured honestly. But even our best model is still just a checkpoint file that nobody can call. This final chapter puts it into real service, and proves the single sentence that governs every decision in LLM serving: decoding one token at a time is not limited by compute power, it is limited by memory bandwidth — we'll compute the speed ceiling from the GPU's datasheet before writing a single line of code, then measure the real thing against it.

รวบรวม Link สำหรับเรียนรู้ Transformer สำหรับ SuperAIEngineer Season 3

· 3 min read
Kobkrit Viriyayudhakorn
CEO, iApp Technology

Schedule​

27 Feb 2023

13:00–13:05 แนะนำว่าโจทย์ QA คืออะไร และ Transformer เอาไปอะไรได้บ้าง
13:05–14:00 NLP Core Knowledge
14:00–14:05 — — Brain Break — —
14:05–15:00 Transformer Core Knowledge
15:00–15:05 — — Brain Break — —
15:05–16:00 Colab 1 (Preprocessing + Text Class) + Colab สร้าง QA
16:00–16:15 Q/A Session

— —

28 Feb 2023
09:00–10:00 Colab 2 (NE + POS+ WS + SS)
10:00–10:05 — — Brain Break — —
10:05–11:00 How ChatGPT Build and Works?
11:00–11:05 — — Brain Break — —
11:05–12:00 Colab: Making Your Own ChatGPT (As the way we did on OpenThaiGPT 0.0.1) + Colab: Reinforcement Learning with Human Feedback (RLHF)
12:00–12:15 Q/A Session + OpenThaiGPT Open for Volunteers.

โจทย์ QA​

อะไรคือ QA: https://ai.iapp.co.th/product/thai_automatic_qa
Colab สร้าง QA: https://colab.research.google.com/drive/1inDOJzCh-iG3_aAU-73tq3FzlCwM8nvY

NLP Core Knowledge​

Slide (Basic NLP -> Word Embbeding -> LSTM): https://drive.google.com/file/d/14AVefnJvgaNXWw6wo-kpmHQyjLAikMgp/view?usp=sharing

Transformer Core Knowledge​

Slide​

Slide (Thai NLP in Transformers Era): https://drive.google.com/file/d/1-V-Gy45c7vHQ4GejvWDBHk0w9oJ4z18I/view?usp=sharing

Colab​

Colab 1 (Preprocessing + Text Class): https://colab.research.google.com/drive/1fGKoS1WH6dbw3mYffOgTtdmPN2Wi9doF?usp=sharing
Colab 2 (NE + POS+ WS + SS): https://colab.research.google.com/drive/1CWamaQH1Lgd7mSZ0UZ4jx2AUMAGDpsfq?usp=sharing#scrollTo=cvrnEG4mOm1p

ChatGPT Core Knowledge​

Website​

https://openthaigpt.aieat.or.th/

Slide​

Slide (ChatGPT: How it works?): https://docs.google.com/presentation/d/1Q6_S_GDWHuNC0DfprNMn9EH0kyqK_y-RbdK5fJB6EUk/edit#slide=id.g1f3418062d6_0_156

Slide (OpenThaiGPT):
https://docs.google.com/presentation/d/1JJxtwo1pCJC3u6aSfslSp1FJSb5ZS5xBKIiQ-6Kip_g/edit?usp=sharing

Colab
Finetuning OpenThaiGPT version POC 0.0.1:
https://colab.research.google.com/drive/1MA1FHwknrs6mVstOHcSyFTnDNWrus-G-?usp=sharing

RLHF: สอนให้ Model Generate ข้อความเชิงบวก (Positive Sentiment) ได้มากขึ้นด้วย PPO https://colab.research.google.com/drive/1qce78Q00SY7CKXLVtiSGFbP5C1V_nypn?usp=sharing


รวบรวม Link สำหรับเรียนรู้ Transformer สำหรับ SuperAIEngineer Season 3 was originally published in Kobkrit on Medium, where people are continuing the conversation by highlighting and responding to this story.

แจกวิธี Train Thai Question Answering AI ใช้ Wangchanberta บน Dataset iApp QA โดย Simple Transformer

· 2 min read
Kobkrit Viriyayudhakorn
CEO, iApp Technology

แจกวิธี Train Thai Question Answering AI ใช้ Wangchanberta บน Dataset iApp QA โดย Simple Transformer​

How to make Thai QA System using SimpleTransformer

Colab:

https://colab.research.google.com/drive/1inDOJzCh-iG3_aAU-73tq3FzlCwM8nvY#scrollTo=vLChKnukd3gC


แจกวิธี Train Thai Question Answering AI ใช้ Wangchanberta บน Dataset iApp QA โดย Simple… was originally published in Kobkrit on Medium, where people are continuing the conversation by highlighting and responding to this story.

ศักยภาพของ AI สู่โอกาสใหม่แห่งการแข่งขันและความสำเร็จ

· 7 min read
Kobkrit Viriyayudhakorn
CEO, iApp Technology

https://medium.com/media/f8ead5836ef79253f028959f246dd628/href

สวัสดีครับ เจอกันอีกแล้วนะครับ ผม กอบกฤตย์ นะครับ

เนื่องจากทางผมมีโอกาสได้ไปพูดที่งาน Metalex 2019 เป็นครั้งที่สองแล้วนะครับ ในฐานะกรรมการสมาคมปัญญาประดิษฐ์ประเทศไทย (AIAT) ในหัวข้อเรื่อง ศักยภาพของ AI สู่โอกาสใหม่แห่งการแข่งขันและความสำเร็จ ซึ่งเป็นแนวที่ค่อนข้าง Abstract มาก ผมเลยคิดว่า มันก็เป็นโอกาสอันดีเหมือนกัน ที่ได้สรุปข่าว AI ที่สำคัญๆในปี 2019 มารวบรวมให้กับผู้อ่านทุกท่าน และให้ทุกท่านได้เตรียมตัวปรับตัวกับกระแส AI Disruption ที่จะรุนแรงขึ้นเรื่อยๆในปี 2020 นะครับ โดยหัวข้อที่ผมพูดแบ่งเป็น 3 หัวข้อหลักดังนี้นะครับ

หัวข้อที่ 1: เรื่องความก้าวหน้าด้าน AI ของทั้งโลกในปี 2019 ต้องยอมรับว่า สิ่งที่ก้าวหน้าที่สุดในปี 2019 นี่ ผมต้องยกให้กับเรื่อง Transfer Learning เลยครับ Transfer Learning คือการที่ AI เรียนรู้ข้อมูลจากแหล่งอื่นมาก่อน (มักจะเป็น Unsupervised Learning) แล้วสามารถนำมาสร้าง Model ใหม่ตามที่เราต้องการได้โดยใช้ข้อมูลน้อยลงมากๆ และ ไม่ว่าจะเป็น Domain ที่ชัดเจนมากๆ อาทิเช่น Natural Language Processing โดยการสร้าง Langauge Model จาก Corpus บทความขนาดใหญ่ ด้วยวิธี Pre-training แล้วค่อยมาปรับ Fine-tune กับงานที่เราต้องการใช้ภายหลังนะครับ ตัวอย่างที่ชัดเจนคือ Google BERT (https://github.com/google-research/bert)

หนึ่งในนั้นที่น่าสนใจก็คือเรื่อง Machine Translation นะครับ ที่ไม่ต้องใช้เนื้อหา Translation Pair ในการสอน AI แล้ว เพียงแค่นำ Pre-training ของแต่ละภาษามาแล้ว AI จะหาคู่คำแปลได้เองอัตโนมัติด้วยเทคนิคการ Map ให้ Word-Embedding ตรงกันนะครับ ทำให้เราสามารถทำ Machine Translation ได้ด้วยต้นทุนที่ถูกลงมากเลยครับ หากใครสนใจไปลองอ่าน Facebook XLM ดูนะครับ (https://github.com/facebookresearch/XLM)

เรื่อง Speech นะครับ ตอนนี้เค้าสามารถสร้าง Speech Model ด้วยเทคนิค Pre-training โดยให้ AI ฟังเสียงตัวอย่างการพูดจากคนหลายๆพันคนนะครับ โดยที่ไม่ต้องมี Text Script ที่ควบคู่กับเสียงแล้วนะครับ และสามารถสร้างตัว Text-to-Speech (TTS) เป็นเสียงของใครก็ได้ ขอเพียงแค่มีตัวอย่างเสียงของผู้พูดที่เราต้องการเพียงแค่ 5 วินาทีเท่านั้น สามารถลองไปดูรายละเอียดเพิ่มเติมที่ https://github.com/CorentinJ/Real-Time-Voice-Cloning ได้เลยนะครับ

หัวข้อที่ 2 โอกาสใหม่ๆครับ ในปี 2020 เราจะเริ่มเห็นหุ่นยนต์มากขึ้นเรื่อยๆ ในปี 2025 เราจะเห็นหุ่นยนต์จนชินตา และคาดว่าจำนวนประเภทหุ่นยนต์จะมากกว่าจำนวน Species ของสัตว์ทั้งหมดในช่วงปี 2030 เราจะเห็นบริษัททางด้านหุ่นยนต์เติบโตขึ้นมหาศาลครับ อาทิเช่น หุ่นยนต์ทำความสะอาด,​หุ่นยนต์ประจำบ้าน, Smart Speaker และโอกาสต่างๆจากหุ่นยนต์ก็มหาศาลเช่นกัน อาทิเช่น

  1. งานการเขียนโปรแกรม AI เพิ่มความสามารถหุ่นยนต์ในด้านต่างๆ ความต้องการ
  2. ระบบศุนย์รวมข้อมูลและ Control ผ่านระบบ IOT ที่สามารถเชื่อมโยงหุ่นยนต์เข้าไว้ด้วยกัน
  3. ระบบ Big Data ที่ทำให้ AI เข้าใจข้อมูลมากยิ่งขึ้น จนกระทั่งรู้ใจลูกค้ามากยิ่งกว่าตัวลูกค้าเอง เราจะสามารถสร้าง Personalize Marketing ซึ่งจะช่วยสร้างเม็ดเงินมหาศาลจากความสามารถเหล่านี้ครับ

ส่วนประเทศไทยต้องเริ่ม Focus จากฐานการผลิตชิ้นส่วนรถยนต์เครื่องยนต์ที่ใช้นำมัน มาเป็นการผลิตชิ้นส่วนหุ่นยนต์ หรือตัวหุ่นยนต์เองได้แล้วนะครับ (รถยนต์ไฟฟ้าใช้ชิ้นส่วนไม่กี่ชี้นเอง และมักจะผลิตเป็นเนื้อเดียวกันแต่แรก) จะและต้องเร่งให้บริษัททางด้าน IT และ Software House ต้องสามารถใช้งาน AI ได้เป็น พร้อมตอบรับความต้องการของลูกค้าที่มีมากขึ้นในปี 2020 นะครับ

หัวข้อที่ 3 คือเรื่องการแข่งขันนะครับ ก็ค่อนข้างชัดเจนว่า งานที่ถูกสร้างเพราะการมาถึงของ AI จะเพิ่มตำแหน่งงานมากถึงประมาณ 133 ล้านตำแหน่งนะครับ แต่ก็จะทำลายตำแหน่งงานเก่าๆ ที่มาถูก AI ด้วยประมาณ 75 ล้านตำแหน่งเช่นกัน ในประเทศไทยจะมีปัญหาใหญ่มากๆ อันนึงก็คือปัญหา Skill Gap ครับ คือคนที่ทำ AI ได้ จะถูกแย่งตัวกันมาก และคนที่ทำ AI ไม่ได้ จะใช้เวลานานพอสมควร (3 เดือน — 1 ปี) กว่าจะสามารถมาเรียนรู้จนมาทำ AI ได้ คนที่ทำไม่ได้ จะหางานยากขึ้นกว่าเดิมมาก (เพราะตำแหน่งลดลงไปถึง 33%) ส่วนคนที่ทำได้แล้ว จะมีความต้องการเพิ่มขึ้นเป็น 2 เท่าในปี คศ. 2022

คนไทยมีปัญหาในเรื่องพื้นฐานความรู้สำหรับงาน AI ค่อนข้างมาก (ขาดทักษะ STEM) จะส่งผลให้คนจำนวนมากตกที่นั่งลำบากในอนาคตอันใกล้นี้ครับ วิธีการแก้ไขก็คือกลับไปทบทวนวิชาคณิตศาสตร์และคอมพิวเตอร์ครับ เพราะ AI คือใช้คณิตศาสตร์เป็นหลัก จำพวก Linear Algebra, Differiential Equation และทักษะทางด้าน Programming โดยเฉพาะภาษา Python ที่สามารถนำมาเขียน AI ได้ดีที่สุดนะครับ

รายละเอียด Slide ทั้งหมดสามารถดูได้ที่ Slideshare ด้านบนนะครับ

หากท่านชอบ Blog ความรู้แบบนี้ฝากกดรูปตบมือ หรือ ช่วยแชร์บทความลง Social Network ที่ท่านชื่นชอบได้เลยครับ

ขอบคุณครับ

หากใครสนใจอยากจะพัฒนาหรือต้องการที่ปรึกษาด้าน AI สามารถเข้าไปดูผลงานของบริษัทเรา iApp Technology ได้ที่ https://iapp.co.th และ https://ai.iapp.co.th หรือติดต่อได้ที่ kobkrit@iapp.co.th ได้เลยนะครับ #Ai #iApp

https://ai.iapp.co.th

ดูเพิ่มเติมได้ที่ https://iapp.co.th และ https://ai.iapp.co.th :D


ศักยภาพของ AI สู่โอกาสใหม่แห่งการแข่งขันและความสำเร็จ (รายงานความก้าวหน้าของ AI ในช่วงปี 2019) was originally published in Kobkrit on Medium, where people are continuing the conversation by highlighting and responding to this story.