<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Songphol Saikhwa on Medium]]></title>
        <description><![CDATA[Stories by Songphol Saikhwa on Medium]]></description>
        <link>https://medium.com/@songpol.saikhwa?source=rss-faa0805fc38f------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*JpnbLw8AqBHqptzvk6HmlA@2x.jpeg</url>
            <title>Stories by Songphol Saikhwa on Medium</title>
            <link>https://medium.com/@songpol.saikhwa?source=rss-faa0805fc38f------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 24 Nov 2026 18:01:33 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@songpol.saikhwa/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[It Made $0.52 for Every $1 Risked for 5 Years. Then It Quietly Died for the Next Decade.]]></title>
            <link>https://medium.com/@songpol.saikhwa/it-made-0-52-for-every-1-risked-for-5-years-then-it-quietly-died-for-the-next-decade-b67687a97495?source=rss-faa0805fc38f------2</link>
            <guid isPermaLink="false">https://medium.com/p/b67687a97495</guid>
            <category><![CDATA[trading]]></category>
            <category><![CDATA[quant]]></category>
            <dc:creator><![CDATA[Songphol Saikhwa]]></dc:creator>
            <pubDate>Wed, 29 Jul 2026 09:04:41 GMT</pubDate>
            <atom:updated>2026-07-29T09:36:35.440Z</atom:updated>
            <content:encoded><![CDATA[<p>A story about probability, market evolution, and why great research teams spend more time trying to disprove themselves than proving themselves right.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*fIqSiI5SBtRSONMP1go8ow@2x.jpeg" /></figure><p><strong><em>(The Death of an Edge — FENO Hero Cover)</em></strong></p><blockquote>The strategy wasn’t supposed to fail.”</blockquote><blockquote>It survived 1,605 trades.</blockquote><blockquote>It generated an average of $0.52 for every $1 it risked.</blockquote><blockquote>It produced years of statistically significant results.</blockquote><blockquote>And then, without warning, it quietly stopped working.</blockquote><p>Most people imagine quantitative finance as a room full of mathematicians building machines that predict the future.</p><p>The reality is much less glamorous.</p><p>At FENO AQI, most of our time is spent asking questions like:</p><ul><li>Is this result real?</li><li>Are we fooling ourselves?</li><li>Has the market changed?</li><li>Would this conclusion survive if another team tried to prove us wrong?</li></ul><p>This article is the story of one of those questions.</p><p>It isn’t about finding a profitable strategy.</p><p>It’s about discovering when it stopped being one.</p><h3><strong>A One-Minute Summary</strong></h3><p>Between 2010 and 2015, a strategy developed by the FENO AQI Quant Research Team generated an average expectancy of <strong>+$0.52 for every $1 risked across 1,605 historical trades.</strong></p><p>A second strategy — built on the exact opposite hypothesis — generated even stronger results.</p><p>Then something unexpected happened.</p><p>Both strategies stopped working.</p><p>Not for a month.</p><p>Not for a year.</p><p>For almost a decade.</p><p>This article isn’t about how we found profitable strategies.</p><p>It’s about how we discovered when they died.</p><p>— -</p><h3>First, Let’s Translate Quant Into English</h3><p>Quantitative finance has a reputation for being unnecessarily complicated.</p><p>Let’s simplify the entire field into one question:</p><blockquote>If I repeatedly risk money under the same conditions, what should I expect to happen over time?</blockquote><p>Everything else — statistics, machine learning, optimization, and backtesting — is simply our attempt to answer that question more accurately.</p><p>Quant researchers use a concept called <strong>Expectancy</strong>*:</p><blockquote>Expectancy = (Win Rate × Average Win) − (Loss Rate × Average Loss)</blockquote><p>For SOPC-1:</p><blockquote>E[R] = (0.30 × 4.18) − (0.70 × 1.05) ≈ +0.52R</blockquote><p>You don’t need to remember the formula.</p><p>You only need to understand what it means.</p><p>If we risked ฿100 under identical conditions thousands of times, history suggests we’d expect to make approximately ฿52 on average over the long run.</p><p>Not every trade.</p><p>Not every day.</p><p>Over a sufficiently large sample.</p><p>That distinction is the foundation of quantitative research.</p><p>— -</p><h3>Meet SOPC-1</h3><p>Our researchers gave it a name only a quant team could love:</p><blockquote><strong>Session-Open Impulse-Pullback Continuation (SOPC-1)</strong></blockquote><p>Fortunately, the idea itself is much simpler than the name.</p><p>Every day, the world’s largest financial centers wake up.</p><p>London opens.</p><p>New York opens.</p><p>And for a brief period, markets become extraordinarily active.</p><p>Over thousands of observations, our team noticed the same pattern:</p><ol><li>Price moves strongly.</li><li>Price pauses briefly.</li><li>Price continues moving.</li></ol><p>SOPC-1 was built to capture that third step.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*beAMgp5gALA1Ivz7yNNkdw@2x.jpeg" /></figure><p><strong>Figure 1. SOPC-1 Sample Winner (+6.5R)</strong></p><p>From 2010 through 2015, the numbers looked remarkably consistent:</p><ul><li>Total Trades: 1,605</li><li>Win Rate: 30%</li><li>Average Expectancy: +0.52R</li><li>Average Winner: +4.18R</li><li>Average Loser: -1.05R</li></ul><p>The first surprise?</p><p>The strategy lost money 70% of the time.</p><p>Humans naturally ask:</p><blockquote>“How often am I right?”</blockquote><p>Quant researchers ask:</p><blockquote>“How much do I make when I am?”</blockquote><p>Those are not the same question.</p><p>— -</p><h3>Most Trades Actually Lost</h3><p>The next thing most people misunderstand about quantitative finance is this:</p><p>Great strategies often look boring.</p><p>Or worse.</p><p>Wrong.</p><p>For every large winner, there are usually many ordinary losses.</p><p>That is the price of statistical edges.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YXqd5dthQghFhfJAJKvBOA@2x.jpeg" /></figure><p><strong>Figure 2. SOPC-1 Short Winner</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O-VSuGZjjVZghG7S00mnww@2x.jpeg" /></figure><p><strong>Figure 3. SOPC-1 Losing Trade (-1R)</strong></p><p>— -</p><p>Ironically, the losing trade above is arguably the more important chart.</p><p>Because it reminds us that quantitative finance isn’t about being right.</p><p>It’s about being right often enough — and large enough — that probability works in your favor.</p><p>— -</p><h3>The Slowest Failure We’ve Ever Studied</h3><p>Then something happened that, in hindsight, taught us more than the profitable years ever could.</p><p>The strategy didn’t explode.</p><p>It didn’t collapse.</p><p>It simply became less effective.</p><p>Every year.</p><p>For almost ten years.</p><p>— -</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1015/1*mrJM5dZfX0AQTWC4CZqsJA@2x.jpeg" /></figure><p><strong>Figure 4. Monthly Expectancy: A Slow Bleed, Not a Cliff</strong></p><p>— -</p><p>Its win rate fell.</p><p>Its follow-through weakened.</p><p>Its losing trades increased.</p><p>Most importantly, it began failing inside the exact market conditions that once made it profitable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/768/1*0ihHDYBkQStdgJYf6jmdAg@2x.jpeg" /></figure><p>There was no dramatic event.</p><p>Just a slow realization that the market had changed.</p><p>Markets, it turns out, do not stand still.</p><p>They evolve.</p><p>— -</p><h3>Looking at It Like an Investor</h3><p>R-multiples are useful for researchers.</p><p>But most people think in terms of accounts.</p><p>Assuming a flat 1% risk per trade using starting capital:</p><ul><li>SOPC-1 (2010 — 2015): +835%</li><li>SOPC-1 (2016 — 2026): -142%</li><li>DEMR-1 (2010 — 2015): +1,709%</li><li>DEMR-1 (2016 — 2026): -87%</li></ul><p>— -</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QWwqfXICizep-WuxkiMGPQ@2x.jpeg" /></figure><p><strong>Figure 5. Equity Curves Across Both Eras</strong></p><p>— -</p><p>One thing becomes immediately obvious:</p><p>Dead strategies are expensive.</p><p>SOPC-1 didn’t merely stop making money.</p><p>Given enough time, it would have destroyed an account that continued trading it unchanged.</p><p>Which raises an uncomfortable question:</p><p>&gt; How many strategies in the world are still being traded simply because nobody realized they died?</p><p>— -</p><h3><strong>A Dangerous Thought Experiment</strong></h3><p>Naturally, we asked another question.</p><p>What if we compounded everything?</p><p>If an investor started with ฿100,000 and continuously risked 1% of their account:</p><ul><li>SOPC-1 would theoretically become approximately ฿258 million.</li><li>DEMR-1 would theoretically exceed ฿2 trillion.</li></ul><p>Those figures are mathematically possible.</p><p>They are also economically absurd.</p><p>By that point, the strategy itself would become large enough to influence the market it was attempting to trade.</p><p>This is one of the strange truths of quantitative finance:</p><blockquote>Good mathematics does not guarantee realistic outcomes.</blockquote><p>Reality always gets a vote.</p><p>— -</p><h3>Then We Found Something Stranger</h3><p>Around the same time, another strategy in our research library began exhibiting the same symptoms.</p><p>Its name was:</p><blockquote><strong>Displacement-Exhaustion Midpoint Reversion (DEMR-1)</strong></blockquote><p>And it was SOPC-1&#39;s complete opposite.</p><p>Where SOPC-1 expected continuation, DEMR-1 expected reversal.</p><p>By every reasonable assumption, one should have benefited from the other’s failure.</p><p>It didn’t.</p><p>Both died.</p><p>— -</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*y_W6pIGJ1V_84WBjAOqYGw@2x.jpeg" /></figure><p><strong>Figure 6. DEMR-1 Sample Winner</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mhm57hJznEq7bqtaQpkeHw@2x.jpeg" /></figure><p><strong>Figure 7. DEMR-1 Sample Loser</strong></p><p>That was the moment the research became genuinely interesting.</p><p>If markets had become more trend-driven, momentum should have thrived.</p><p>If markets had become more mean-reverting, reversal strategies should have thrived.</p><p>Instead:</p><ul><li>Momentum failed.</li><li>Mean reversion failed.</li><li>Both remained unprofitable for nearly a decade.</li></ul><p>That realization fundamentally changed how our team thinks about markets.</p><blockquote>Markets don’t simply change.</blockquote><blockquote>They learn.</blockquote><h3>Dead vs. Sleeping</h3><p>One of the least glamorous — and most important jobs of a quant team is determining whether a strategy is:</p><ol><li>Dead.</li><li>Dormant.</li></ol><p>Those sound similar.</p><p>They aren’t.</p><p>We’ve seen strategies on Gold and Bitcoin enter periods where their required conditions simply stopped appearing.</p><p>Those strategies aren’t broken.</p><p>They’re waiting.</p><p>SOPC-1 wasn’t waiting.</p><p>It was failing under the exact circumstances that once made it successful.</p><p>Understanding the difference between those two states is often the difference between preserving capital and destroying it.</p><p>— -</p><h3>Final Thoughts</h3><p>Most people believe quantitative research is about predicting the future.</p><p>We disagree.</p><p>We believe it’s about reducing uncertainty.</p><p>It’s about measuring probability.</p><p>It’s about understanding reality honestly — even when reality disagrees with us.</p><p>And perhaps most importantly, it’s about having the humility to admit that markets will always be larger, smarter, and more adaptive than any model we build.</p><p>Anyone can publish a profitable backtest.</p><p>We believe the real test of a research organization is whether its conclusions can survive scrutiny.</p><p>If they can, they’re worth trusting.</p><p>If they can’t, we’d rather be the ones to discover it first.</p><p>— -</p><blockquote><strong>FENO AQI</strong></blockquote><blockquote>Quantitative Research · Market Microstructure · Statistical Learning <em>”Every result is guilty until proven innocent.”</em></blockquote><p>— -</p><h4>If you enjoyed this article:</h4><ul><li>Follow FENO AQI for future research stories.</li><li>Share this with someone who believes markets are easy.</li><li>Leave a comment: Have you ever seen something slowly stop working without realizing it?</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b67687a97495" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Draft : Clonology.AI]]></title>
            <link>https://medium.com/@songpol.saikhwa/draft-clonology-ai-285cb2648d0b?source=rss-faa0805fc38f------2</link>
            <guid isPermaLink="false">https://medium.com/p/285cb2648d0b</guid>
            <dc:creator><![CDATA[Songphol Saikhwa]]></dc:creator>
            <pubDate>Sun, 08 Jun 2025 15:07:56 GMT</pubDate>
            <atom:updated>2025-06-11T13:29:10.512Z</atom:updated>
            <content:encoded><![CDATA[<h3>AIB5 : <strong>Clonology.AI</strong></h3><p>AI Builder 2025</p><blockquote>ไม่ได้แค่สร้างบอทแต่มันคือการต่อบทสนทนาที่คุณยังไม่อยากให้จบ</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JnFAGnhKzdEZS7MGxYBcVA.png" /></figure><p>สวัสดีค้าบบบ ทุกคนผม ดีโน่ ตอนนี้กำลังขึ้นปี 1 ที่ International School of Engineering (ISE), จุฬาลงกรณ์มหาวิทยาลัย ภาค ICE โดยตอนนี้ผมเข้าร่วม AI Builder 2025 ในกลุ่ม Blazing Hawk ฝากโปรเจค AI ของผมอยู่ในอ้อมอกอ้อมใจของทุกคนด้วยครับ</p><blockquote>“คนไทยเกินครึ่งประเทศไม่ลืมคนเก่า”</blockquote><h3>Intro — Pain point</h3><blockquote>คุณอาจเคยเจอปัญหาแบบนี้:ไม่มีเวลาคุยกับคนสำคัญ แล้วสุดท้ายก็ต้องมีปัญหากันลืมตอบแชทเพื่อน จนกลายเป็นความห่างโดยไม่ตั้งใจหรืออยากพูดบางอย่างกับใครสักคนที่ “ไม่มีโอกาสได้คุยกันอีกแล้ว”</blockquote><p><strong>Clonology.AI</strong> เกิดขึ้นมาเพื่อเปลี่ยนเรื่องเหล่านี้ให้เป็นไปได้อีกครั้งด้วยบริการที่นำบทสนทนาเก่าใน Instagram หรือ Messenger มาสร้างเป็น AI ChatBot ที่เลียนแบบตัวตนของใครก็ได้ — ทั้งรูปแบบการพิมพ์ น้ำเสียง ความคิด และความทรงจำที่เคยมีร่วมกัน</p><p>ไม่ใช่แค่การโต้ตอบแบบหุ่นยนต์แต่เป็นการจำลอง “ตัวตน” ที่สมจริงพร้อมกลับมาคุยกับคุณในแบบที่คุณจำได้</p><p>Clonology.AI ไม่ได้แค่สร้างบอทแต่มันคือการต่อบทสนทนาที่คุณยังไม่อยากให้จบ</p><h3>Outline</h3><p>โดยเริ่มเเรกผมจะเเบ่งนี้หาออกเป็น 4 อย่างนะครับ</p><ul><li>Pipeline Design</li><li>Data Collection</li><li>Model Selection</li><li>Evaluation</li></ul><p>Pipeline Design</p><p>ผมจะมาขอเเนะนำ overall ทั้งหมดที่ผมทำก่อนนะครับ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*jesg3jAUeS1hWgC909uDjA.png" /></figure><p>Clonology.AI ทำงานโดยเอาข้อมูลการสนทนาเก่าๆ จาก Instagram/Messenger มาสร้างเป็น AI ที่พูดคุยได้เหมือนคนจริง โดยจำได้ว่าเราเคยคุยอะไรกัน และพูดในแบบเดียวกับเขา</p><h3>ขั้นตอนการทำงาน (Pipeline)</h3><h4>1.รวบรวมข้อมูล (Data Collection)</h4><ul><li>ขอข้อมูลจาก Meta (Instagram/Messenger)</li></ul><h4>2. ทำความสะอาดข้อมูล (Data Cleaning)</h4><ul><li>กรองข้อความที่ไม่จำเป็น (ลิงก์, ข้อความระบบ, ไฟล์แนบ)</li><li>เรียงลำดับข้อความตามเวลาจริง</li></ul><h4>3. เตรียมข้อมูล (Pre-processing)</h4><ul><li>ขั้นตอน 3.1: แบ่งและสรุปข้อมูล</li></ul><blockquote>1.แบ่งข้อมูล (Chunking): ตัดบทสนทนายาวๆ เป็นชิ้นเล็กๆ (800–3500 tokens)</blockquote><blockquote>2.สรุปบริบท: ใช้ Typhoon V2–70B สรุปแต่ละชิ้นให้เหลือแค่ส่วนสำคัญ:</blockquote><blockquote>2.1 ชื่อและคำเรียกขาน</blockquote><blockquote>2.1 รูปแบบการพูดความทรงจำร่วม</blockquote><blockquote>2.1 บุคลิกภาพ</blockquote><ul><li>ขั้นตอน 3.2: สร้างระบบค้นหา (RAG System)</li></ul><blockquote>1.แปลงเป็น Vector: ใช้ BAAI/bge-m3 เปลี่ยนข้อความเป็นตัวเลข</blockquote><blockquote>2.เก็บในฐานข้อมูล: ใช้ FAISS เก็บข้อมูลแบบค้นหาได้เร็ว</blockquote><blockquote>3.ค้นหาแบบแม่นยำ: หาข้อมูลที่เกี่ยวข้องกับคำถามได้ทันที</blockquote><h4>4. สร้างโมเดล (Modeling)</h4><ul><li>ใช้ Typhoon V2–70B เป็นสมองหลัก</li><li>สร้าง System Prompt ที่มีข้อมูล:</li></ul><blockquote>1.บุคลิกภาพของคนนั้น</blockquote><blockquote>2.ความทรงจำร่วม</blockquote><blockquote>3.รูปแบบการพูด (คำลงท้าย, น้ำเสียง)</blockquote><ul><li>ผสมข้อมูลจากระบบค้นหากับการสนทนาปัจจุบัน</li></ul><h4>5. ประเมินผล (Evaluation)</h4><ul><li>ทดสอบ 4 ด้าน: การสนทนาธรรมชาติ, ความจำ, บุคลิกภาพ, การตอบสนองอารมณ์</li><li>ใช้คนจริงเป็นผู้ตัดสิน (Human Evaluation)</li><li>เปรียบเทียบกับ ChatGPT Memory</li><li>ผลลัพธ์: ชนะ 59/60 ครั้ง (98.3%)</li></ul><h3>Data Collection</h3><p>ผมเริ่มต้นด้วยการขอข้อมูลจาก META โดยดำเนินการผ่าน Instragram:</p><pre>Meta Accounts Center → Your Information and permissions → Download your information</pre><p>ซึ่งต้องรออนุมัติประมาณ 7 วัน หลังจากได้รับข้อมูล จะประกอบด้วยหลายส่วน เช่น โพสต์ ความคิดเห็น ข้อความแชท และข้อมูลโปรไฟล์</p><p>ภายใต้ข้อตกลงการใช้งาน META ผู้ที่ยื่นเอกสารสามารถนำข้อมูลของตนเองไปใช้งานได้</p><p>จากข้อมูลทั้งหมด ผมเลือกใช้เฉพาะส่วน ข้อความสนทนา (Chat Dialogue) ซึ่งถูกส่งมาในรูปแบบ ไฟล์ JSON เพื่อใช้สำหรับการวิเคราะห์และประมวลผลข้อความต่อไปในโครงการนี้ครับ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/645/1*2A8Tyh7l0sR-RYx8jEvR3A@2x.jpeg" /></figure><h3>Exploratory Data Analysis (EDA)</h3><p>หลังจากที่ได้ข้อมูลการสนทนาจาก META แล้ว ขั้นตอนถัดไปคือการนำข้อมูลมาใช้งานในการวิเคราะห์ โดยใช้ <strong><em>eda_data.py </em></strong>ซึ่งถูกออกแบบมาเพื่อให้การวิเคราะห์การสนทนาภาษาไทยระหว่างสองคนเป็นเรื่องง่ายและเข้าใจได้ทันที</p><h4>ฟีเจอร์หลักของระบบนี้</h4><ul><li><strong>Word Cloud :</strong> ช่วยแสดงคำที่ถูกใช้บ่อยจากการสนทนาในรูปแบบกราฟแบบโต้ตอบได้ทันที โดยสามารถคลิกและดูคำที่มีความสำคัญในการสนทนาได้อย่างชัดเจน</li><li><strong>Statistics :</strong> ระบบจะคำนวณและแสดงข้อมูลต่างๆ เช่น การแจกแจงข้อความที่ส่งระหว่างสองคน, การใช้คำหรืออีโมจิที่บ่อยที่สุด, ความยาวของข้อความ และการวิเคราะห์ระดับความเป็นทางการของการพูดคุย</li><li><strong>Message Distribution :</strong> แสดงข้อมูลเกี่ยวกับการกระจายข้อความตามเวลาที่ส่ง และแสดงพฤติกรรมของผู้ร่วมสนทนา เช่น เวลาที่มีการส่งข้อความบ่อยที่สุด</li><li><strong>Hourly Activity Patterns :</strong> การวิเคราะห์กิจกรรมที่เกิดขึ้นในช่วงเวลาต่างๆ ช่วยให้เราสามารถเข้าใจพฤติกรรมการสนทนาของผู้ใช้ในเวลาต่างๆ ได้อย่างมีประสิทธิภาพ</li><li><strong>Emoji Usage Patterns :</strong> การติดตามการใช้ emoji ในการสนทนาเพื่อให้เห็นลักษณะการแสดงอารมณ์หรือความรู้สึกของผู้ร่วมสนทนา</li></ul><p><strong>สรุป :</strong> ระบบ EDA นี้ช่วยให้การวิเคราะห์ข้อมูลการสนทนาเป็นเรื่องง่ายและได้ข้อมูลเชิงลึกที่ช่วยในการสร้างประสบการณ์การสนทนาที่เหมือนจริง ซึ่งสามารถนำข้อมูลที่ได้มาช่วยในการพัฒนาระบบ AI เพื่อจำลองการสนทนากับบุคคลต่างๆ ได้อย่างมีประสิทธิภาพ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/690/1*LM-s1kKLs5HCM4BCZxByKw@2x.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/694/1*JSGrg65_GySM57ifsQHZYw@2x.jpeg" /><figcaption>EDA Result Sample</figcaption></figure><h3>Data Cleaning</h3><p>หลังจากที่ได้รับข้อมูลจาก META มาในรูปแบบไฟล์ JSON ซึ่งประกอบไปด้วยหลายประเภทของข้อมูล ผมได้เลือกนำ ข้อความสนทนา (Chat Dialogue) มาใช้เป็นหลัก และเพื่อให้ข้อมูลพร้อมต่อการวิเคราะห์ จึงต้องผ่านกระบวนการทำความสะอาดข้อมูลดังนี้ครับ:</p><h4>1.Loading Messages</h4><p>เริ่มต้นด้วยการโหลดไฟล์ JSON ที่ได้รับ โดยโค้ดสามารถจัดการได้ทั้งในรูปแบบของ dictionary และ list เพื่อให้รองรับโครงสร้างข้อมูลที่หลากหลาย</p><h4>2.Filtering Empty and System Messages</h4><p>ระบบจะข้ามข้อความที่ไม่มีเนื้อหา (empty message) พร้อมกับนับจำนวนไว้เป็นข้อมูลประกอบ</p><p>นอกจากนี้ยังกรองข้อความระบบที่ไม่ใช่การสนทนาจริง เช่น:</p><ul><li>“Call started”, “Call ended”</li><li>“Reacted to message”</li><li>“Sent an attachment” หรือ “Attach file”</li></ul><p>ข้อความเหล่านี้ไม่ได้สะท้อนการสื่อสารที่มีเนื้อหา จึงถูกตัดออก</p><h4>3.Filtering URLs</h4><p>ข้อความที่มีการแนบลิงก์ เช่น ที่ขึ้นต้นด้วย http://, https://, หรือ www. จะถูกกรองออก เพราะเนื้อหาส่วนใหญ่เป็นการแชร์ลิงก์ซึ่งไม่ได้มีบริบทการสนทนาเชิงข้อความมากนัก</p><h4>4.Handling Timestamps</h4><p>ทำการแปลงเวลาที่แนบมากับแต่ละข้อความให้อยู่ในรูปแบบ datetime มาตรฐาน โดยรองรับทั้ง timestamp ที่เป็น milliseconds และแบบ ISO format</p><h4>5.Unicode Conversion</h4><p>ข้อความบางส่วน โดยเฉพาะภาษาไทย อาจถูกบันทึกในรูปแบบ Unicode เช่น \u0e2a\u0e27\u0e31\u0e2a\u0e14\u0e35</p><p>ระบบจะแปลงรหัสเหล่านี้ให้กลับมาเป็นข้อความที่อ่านได้ เช่น “สวัสดี”</p><h4>6.Sorting Messages</h4><p>ข้อความที่ผ่านการคัดกรองแล้วทั้งหมด จะถูกจัดเรียงตามลำดับเวลาจริงที่ส่งมา เพื่อให้การวิเคราะห์ต่อไปสามารถอิงตามลำดับเหตุการณ์ที่ถูกต้องได้</p><p>ข้อมูลที่ผ่านการทำความสะอาดในขั้นตอนนี้จึงสามารถนำไปต่อยอดได้หลายทาง ไม่ว่าจะเป็นการสรุปเนื้อหา การวิเคราะห์พฤติกรรมการสนทนา หรือการใช้งานร่วมกับโมเดล AI ครับ</p><h3>Pre processing</h3><h4>ขั้นตอนที่ 1 : การ Summarize Chunks Context</h4><p>เริ่มต้นจากการทำการ <strong>แบ่งข้อมูล (chunking)</strong> ซึ่งเราจะแบ่งข้อความออกเป็นชิ้นๆ โดยแต่ละชิ้นจะมีขนาดประมาณ <strong>800–3500 token ( สามารถปรับได้ )</strong> เพื่อเพิ่มประสิทธิภาพในการประมวลผลข้อมูล ข้อมูลที่ได้จะถูกจัดรูปแบบในลักษณะ <strong>chunked data</strong> ซึ่งช่วยให้สามารถบริหารจัดการข้อมูลได้ดีขึ้น และรักษาความเชื่อมโยงระหว่างบริบทได้อย่างมีประสิทธิภาพ วิธีการนี้ไม่เพียงแต่ช่วยในการจัดการข้อมูลให้ดียิ่งขึ้นเท่านั้น แต่ยังสามารถจำลองลักษณะการทำงานของ <strong>สมองมนุษย์</strong> (Human Brain Simulation) โดยการแบ่งข้อมูลเป็นหน่วยย่อยๆ เพื่อจัดเก็บและประมวลผลความทรงจำอย่างเป็นระบบ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*HkHh1bIt9poQJBMt" /></figure><p>หลังจากที่เราได้ทำการแบ่งข้อมูลเป็น <strong>chunks</strong> แล้ว ขั้นตอนถัดไปคือการ <strong>สรุปข้อมูล</strong> (Summarize Context) โดยใช้ <strong>LLMs</strong> เช่น Typhoon-v2–70B ซึ่งเป็นโมเดลที่มีความเชี่ยวชาญในการประมวลผลข้อมูลภาษาไทย และได้รับการฝึกฝนสำหรับการทำงานที่เกี่ยวข้องกับการสนทนา System Prompt:</p><pre>map_prompt_template = &quot;&quot;&quot;<br>วิเคราะห์ส่วนของบทสนทนาต่อไปนี้และสกัดข้อมูลสำคัญ:<br><br>1. ชื่อและคำเรียกขาน:<br>- ชื่อจริง และชื่อเล่นที่สำคัญที่สุด 2 ชื่อที่ใช้เรียกกันบ่อยที่สุด<br>- รูปแบบการเรียกขานที่ใช้บ่อยที่สุด<br>- คำลงท้ายที่ใช้บ่อย<br><br>2. ความสัมพันธ์และบริบท:<br>- ประเภทความสัมพันธ์<br>- ระดับความสนิทและความเป็นทางการ<br>- บทบาทในความสัมพันธ์<br><br>3. รูปแบบการสื่อสาร:<br>- สไตล์การพูดคุย (เป็นทางการ/กันเอง)<br>- อารมณ์และน้ำเสียงที่ใช้<br>- มุกหรือคำพูดที่เป็นเอกลักษณ์<br><br>4. ประสบการณ์และความทรงจำร่วม:<br>- เหตุการณ์หรือประสบการณ์ที่ถูกอ้างถึง<br>- ความทรงจำร่วมที่สำคัญ<br>- เรื่องราวหรือประวัติที่ถูกพูดถึงบ่อย<br><br>บทสนทนา:<br>{text}<br><br>สรุปข้อมูลที่สกัดได้:<br>&quot;&quot;&quot;</pre><p>ในขั้นตอนนี้ โมเดลจะทำการวิเคราะห์และเลือก <strong>ข้อมูลสำคัญ</strong> จากแต่ละ <strong>chunk</strong> ของบทสนทนา และทำการย่อข้อมูลเหล่านั้นให้อยู่ในรูปแบบที่สั้น กระชับ แต่ยังคงรักษาความหมายและ <strong>บริบทสำคัญ</strong> ไว้ครบถ้วน สิ่งนี้ช่วยให้ระบบสามารถประมวลผลข้อมูลได้อย่างมีประสิทธิภาพและรวดเร็ว โดยเฉพาะเมื่อข้อมูลมีขนาดใหญ่มาก</p><p>การใช้ <strong>LLM</strong> ในการสรุปสามารถเปรียบเสมือนกับการ <strong>คัดเลือกความทรงจำ</strong> ที่สำคัญที่สุดจากแต่ละช่วงเวลาในบทสนทนา ซึ่งช่วยให้ระบบสามารถตอบคำถามหรือสื่อสารได้เหมือนกับการ <strong>ดึงข้อมูล</strong> จากความทรงจำของมนุษย์ที่ <strong>จัดระเบียบและย่อส่วน</strong> เพื่อให้ใช้งานได้ทันที</p><h4><strong>ขั้นตอนที่ 2: การเก็บข้อมูลในรูปแบบที่สามารถค้นหาได้</strong></h4><p><strong>RAG คืออะไร</strong></p><blockquote><strong>RAG (Retrieval-Augmented Generation)</strong> คือกระบวนการที่ใช้การค้นหาข้อมูลจากแหล่งข้อมูลภายนอกเพื่อเสริมการสร้างคำตอบหรือเนื้อหาที่มีความแม่นยำและหลากหลายมากขึ้น การนำข้อมูลภายนอกมาช่วยเสริมทำให้ระบบสามารถสร้างคำตอบที่มีคุณภาพสูงขึ้น โดยไม่ต้องพึ่งพาข้อมูลที่จำกัดจากฐานข้อมูลเดิมเพียงอย่างเดียว ซึ่งทำให้คำตอบที่ได้มีความถูกต้องและตรงกับความต้องการของผู้ใช้มากยิ่งขึ้น</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*cSBhyfEEdG_32KwP.png" /></figure><p>ขั้นตอนถัดไปคือการนำข้อมูลที่สรุปแล้วมาจัดเก็บในรูปแบบที่สามารถ <strong>ค้นหาภายในฐานข้อมูล</strong> ได้อย่างรวดเร็วและมีประสิทธิภาพ โดยใช้ <strong>FAISS (Facebook AI Similarity Search)</strong> ซึ่งเป็นเครื่องมือที่ช่วยให้สามารถจัดเก็บข้อมูลในรูปแบบ <strong>vectors</strong> ทำให้สามารถค้นหาข้อมูลที่เกี่ยวข้องได้ทันทีเมื่อมีการถามคำถามในอนาคต</p><p>โดยในการเก็บข้อมูลนี้ เราจะใช้ <strong>BAAI/bge-m3</strong> เพื่อแปลงข้อความจากบทสนทนาให้เป็น <strong>embeddings</strong> หรือ <strong>vector representations</strong> ซึ่งเป็นการแปลงข้อความให้สามารถใช้งานใน <strong>FAISS</strong> เพื่อให้การค้นหาข้อมูลทำได้อย่างรวดเร็วและแม่นยำ</p><p><strong>FAISS</strong> ช่วยในการสร้าง <strong>vector store</strong> ที่เก็บข้อมูลที่สรุปแล้ว โดยใช้ <strong>embeddings</strong> จาก <strong>BAAI/bge-m3</strong> ซึ่งเป็น <strong>Thai-optimized model</strong> ที่รองรับภาษาไทยได้เป็นอย่างดี ช่วยให้การค้นหาและการเรียกใช้ข้อมูลในระบบเป็นไปอย่างมีประสิทธิภาพสูงสุด</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*o4GJedHXPD2MmW1p3c14hQ.png" /></figure><h4>ทำไมต้องใช้ Chunking และ Summarization?</h4><p>การใช้ <strong>chunking</strong> และ <strong>summarization</strong> ไม่เพียงแค่ช่วยในการ <strong>จัดการกับข้อมูลจำนวนมาก</strong> แต่ยังช่วยในการ <strong>จำลองการทำงานของสมองมนุษย์</strong> ในการจัดระเบียบความทรงจำ โดยการแบ่งข้อมูลออกเป็นชิ้นเล็กๆ และการ <strong>คัดเลือกข้อมูลสำคัญ</strong> ที่ต้องเก็บไว้ ซึ่งเหมือนกับวิธีการที่สมองมนุษย์ <strong>เลือกเก็บ</strong> และ <strong>จัดระเบียบความทรงจำ</strong> โดยให้ความสำคัญกับข้อมูลที่มีความเกี่ยวข้องหรือมีผลต่อการตัดสินใจในอนาคต</p><p>ในกรณีของระบบนี้ การใช้ <strong>chunking</strong> ทำให้ข้อมูลที่ได้มีความ <strong>เชื่อมโยงกัน</strong> โดยไม่ทิ้งบริบทสำคัญที่อาจถูกละเลยในการประมวลผลทีละคำหรือทีละส่วน ข้อมูลที่ถูกจัดเก็บแบบ <strong>chunked</strong> ช่วยให้เราสามารถรักษาความต่อเนื่องของ <strong>บริบทการสนทนา</strong> ได้ ซึ่งเป็นสิ่งที่สำคัญในการสร้างระบบการสนทนาที่สามารถจำลองลักษณะของ <strong>การสนทนาจริง</strong> ได้</p><p>โดยการใช้ <strong>summarization</strong> ข้อมูลที่ผ่านการ <strong>สรุป</strong> จะช่วยให้ระบบสามารถ <strong>เลือกเก็บ</strong> ข้อมูลที่สำคัญจากบทสนทนา และสามารถประมวลผลข้อมูลในลักษณะที่ <strong>ไม่เกิดปัญหาด้านประสิทธิภาพ</strong> เช่น <strong>memory overflow</strong> หรือ <strong>การประมวลผลที่ล่าช้า</strong> ทั้งนี้การใช้ <strong>map-reduce</strong> สำหรับการสรุปบทสนทนาในหลายๆ <strong>chunks</strong> ยังช่วยลดภาระในการประมวลผลได้อีกด้วย</p><h4>Contextual RAG with Word-Level Precision</h4><p>ในระบบของเรา เราใช้วิธี Retrieval-Augmented Generation (RAG) แบบแม่นยำระดับคำ (token-level precision) ซึ่งช่วยให้การค้นหาข้อมูลมีความยืดหยุ่นและตรงประเด็นมากขึ้น โดยเฉพาะในกรณีของบทสนทนายาว หรือ Q/A Dialogue ที่มีบริบทหลากหลาย ดังนี้:</p><p>1. ใช้บริบทบทสนทนาทั้งหมดในการ Encoding</p><p>ข้อความสนทนาทั้งชุด จะถูกแปลงเป็น embeddings โดยใช้โมเดล BAAI/bge-m3โมเดลนี้ถูกเลือกเพราะรองรับภาษาไทยได้ดี และให้ embedding space ที่มีประสิทธิภาพในการจับความหมายเฉพาะคำ</p><p>2. การค้นหาแบบ Word-Level Semantic Search</p><p>เมื่อผู้ใช้ป้อนคำถามหรือข้อความใหม่ ระบบจะ encode ข้อความนั้น แล้วทำ similarity search กับ แต่ละประโยค หรือข้อความย่อยใน context ทั้งหมดค้นหาคำหรือวลีที่มี embedding ใกล้เคียงที่สุดกับคำในข้อความของผู้ใช้</p><p>3. ดึง “บริบทเฉพาะบริเวณรอบคำ” (Context Windowing)</p><p>แทนที่จะดึงทั้ง chunk หรือ document ยาวๆเราจะ ดึงเฉพาะประโยคหรือบทสนทนาใกล้เคียงรอบคำเป้าหมาย เช่น 1–3 ประโยคก่อนและหลังบริบทที่ได้นี้จะใช้เป็น prompt context สำหรับ LLM เช่น Typhoon-v2–70B</p><p>4. Few-shot Prompting ด้วยบริบทจริง</p><p>บริบทที่ค้นมาในแบบ word-level จะถูกจัดเรียงเป็นตัวอย่าง few-shot เช่น:</p><blockquote>User: ฉันอยากไปเชียงใหม่</blockquote><blockquote>Bot: ดีเลย ฤดูหนาวเชียงใหม่อากาศดีมาก</blockquote><blockquote>…</blockquote><blockquote>User: แล้วตอนนั้นเราพูดถึงอะไรนะ?</blockquote><p>ส่งเข้า LLM เพื่อให้ตอบในลักษณะที่ “เหมือนจำได้จริง” และมี continuity ของบทสนทนา</p><h4>สรุป</h4><p>ในที่สุด, ระบบ <strong>Preprocessing Pipeline</strong> ที่เราได้ออกแบบมาไม่เพียงแต่ช่วยในการจัดการข้อมูลที่มีขนาดใหญ่และซับซ้อน แต่ยังสามารถจำลองลักษณะการทำงานของ <strong>สมองมนุษย์</strong> ด้วยการใช้ <strong>chunking</strong> และ <strong>summarization</strong> ในการจัดระเบียบความทรงจำของระบบ</p><p>ทั้งนี้ ระบบของเรารองรับ <strong>ข้อมูลจาก Instagram และ Messenger</strong> ที่สามารถนำมาจัดเก็บและประมวลผลใน <strong>รูปแบบที่สามารถค้นหาได้</strong> โดยใช้ <strong>FAISS</strong> เพื่อให้สามารถ <strong>ค้นหาข้อมูลที่เกี่ยวข้อง</strong> ได้อย่างรวดเร็วและแม่นยำ โดยโมเดลที่ใช้ในขั้นตอนต่างๆ เช่น <strong>Typhoon-v2–70B</strong> และ <strong>BAAI/bge-m3</strong> ช่วยให้ระบบมีความ <strong>สามารถในการตอบคำถาม</strong> หรือ <strong>จำลองการสนทนา</strong> ได้อย่างสมจริง</p><p>การใช้ระบบ <strong>memory chunking</strong> และ <strong>RAG (Retrieval-Augmented Generation)</strong> ช่วยให้การประมวลผลข้อมูลมีประสิทธิภาพสูงสุด โดยไม่เพียงแต่ประมวลผลข้อมูลที่มีปริมาณมากได้เร็วขึ้น แต่ยังสามารถ <strong>คัดเลือกข้อมูลสำคัญ</strong> ที่จำเป็นต่อการสนทนาในอนาคตได้เหมือนกับการ <strong>ใช้ความทรงจำมนุษย์</strong> เพื่อสร้างประสบการณ์การสนทนาที่เหมือนจริง</p><h3>Modeling</h3><p>ในส่วนของการทำงานในโครงการ <strong>Project Clonology</strong> เราจะเน้นไปที่การใช้ <strong>Large Language Models (LLM)</strong> เพื่อจัดการกับคำถามและการสนทนา (Q&amp;A) โดยในปัจจุบันมีหลายโมเดลที่รองรับภาษาไทยและสามารถนำมาประยุกต์ใช้ในโปรเจกต์นี้ได้ เช่น <strong>Typhoon-v2–70B</strong> ซึ่งเป็นโมเดลที่พัฒนาโดย SCB 10X และได้รับความนิยมในแวดวงการประมวลผลภาษาไทย</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*nnQiEByc_2QZ3ZdT" /></figure><h4>การปรับแต่งและการเก็บข้อมูลบริบท</h4><p>ในระบบของเรา เราจะใช้ <strong>ระบบ Prompt Templates</strong> ที่มีการปรับแต่งให้เหมาะสมกับการสนทนาแบบเพื่อนสนิท ตัวอย่าง <strong>system prompt template</strong> มีลักษณะดังนี้:</p><pre>system_prompt_template = &quot;&quot;&quot;คุณชื่อ &quot;{friend_name}&quot; และกำลังสนทนากับเพื่อนของคุณ<br><br>ใช้ข้อมูลจากความทรงจำและประสบการณ์ที่ผ่านมาเหล่านี้ในการตอบ:<br>{memory_context}<br><br>ตัวอย่างการพูดคุยที่ผ่านมา:<br>{few_shot_context}<br><br>ให้ตอบด้วยภาษาไทยที่{tone_style} <br>มีการใช้คำลงท้ายอย่าง {particles_str}<br>{banter_note}<br><br>เลียนแบบวิธีการพูดคุย คำศัพท์ และลักษณะการสื่อสารที่ปรากฏในข้อมูลข้างต้น<br>ห้ามระบุว่ากำลังใช้ข้อมูลจากความทรงจำหรือบอกว่าเป็น AI ให้ตอบเหมือนคุณเป็นเพื่อนจริงๆ<br><br>บริบทที่เกี่ยวข้อง: {{context}}<br><br>ประวัติการสนทนา:<br>{{chat_history}}<br><br>คำถาม: {{question}}<br><br>ตอบ:&quot;&quot;&quot;</pre><p>การใช้ <strong>system prompt templates</strong> เช่นนี้ ช่วยให้สามารถกำหนดวิธีการตอบคำถามและรูปแบบการสนทนาให้เหมาะสมกับบุคลิกของผู้ใช้ได้อย่างละเอียด โดยใช้ข้อมูลจากบริบทที่มีการจัดเก็บไว้ (เช่น คำศัพท์ที่ใช้, คำลงท้าย, หรือแม้แต่การเลือกหัวข้อสนทนา)</p><h4>Sample Completed System Prompt:</h4><pre>คุณคือเพื่อนสนิทชื่อ &quot;Thanayot&quot; และกำลังสนทนากับเพื่อนของคุณ<br><br>ใช้ความทรงจำเกี่ยวกับมิตรภาพของคุณในการตอบ:<br>ข้อมูลผู้สนทนา:<br>- คุณคือ: Thanayot Monthlchachat<br>- คู่สนทนา: deno<br><br>**โปรไฟล์ความทรงจำของ Thanayot Monthlchachat (ดีโน่, โซ้ย) และ deno (ดีโน่)**<br><br>**ความสัมพันธ์**: เพื่อนสนิท<br><br>**รูปแบบการสื่อสาร**: กันเอง, สนุกสนาน, สบายๆ, ขำขัน<br><br>**คำเรียกขาน**: ชื่อเล่น (ดีโน่, โซ้ย)<br><br>**คำลงท้าย**: คับ, นะ<br><br>**อารมณ์และน้ำเสียง**: สนุกสนานและเป็นกันเอง, ขำขัน<br><br>**มุกหรือคำพูดที่เป็นเอกลักษณ์**: &quot;โซ้ย&quot;, &quot;เครๆ&quot;, &quot;ว่าๆ&quot;<br><br>**ประสบการณ์และความทรงจำร่วม**:<br>- การทำโครงงาน CUD<br>- การแข่งขันรำ<br>- การพบปะกันที่สามย่าน<br>- การไปทำงาน<br>- การทำข้อสอบ<br>- การไปงาน Make X<br>- การทำงานร่วมกันในโปรเจกต์ hackathon super AI<br><br>**ความทรงจำร่วมที่สำคัญ**:<br>- การทำโครงงาน CUD ร่วมกัน<br>- การสนับสนุนกันในชีวิตประจำวัน<br>- การทำงานร่วมกันในโปรเจกต์<br><br>**เรื่องราวหรือประวัติที่ถูกพูดถึงบ่อย**:<br>- การทำโครงงาน CUD<br>- การแข่งขันรำ<br>- การพบปะกันที่สามย่าน<br>- การทำข้อสอบ<br>- การทำงาน<br>- การไปงาน<br><br>**ความสนใจร่วมกัน**:<br>- เทคโนโลยี<br>- การเรียน<br>- การเล่นเกม<br><br>**ความสนับสนุนและช่วยเหลือ**:<br>- ช่วยเหลือกันในด้านการศึกษา<br>- ช่วยเหลือกันในด้านการทำงาน<br>- สนับสนุนกันในกิจกรรมต่างๆ<br><br>**ความสัมพันธ์โดยรวม**: สนิทสนม, เป็นกันเอง, มีการสนับสนุนและช่วยเหลือกันในทุกด้านของชีวิต.<br><br>ชื่อและคำเรียกขาน:<br>- ชื่อจริง: Thanayot Monthlchachat, deno<br>- ชื่อเล่นที่สำคัญ: โซ้ย, ดีโน่<br>- รูปแบบการเรียกขาน: ใช้ชื่อเล่นและคำลงท้าย &quot;คับ&quot; หรือ &quot;ครับ&quot;<br><br>ความสัมพันธ์และบริบท:<br>- ประเภทความสัมพันธ์: เพื่อน<br>- ระดับความสนิทและความเป็นทางการ: สนิทและไม่เป็นทางการ<br>- บทบาทในความสัมพันธ์: เป็นเพื่อนที่ช่วยเหลือกันในเรื่องต่างๆ เช่น การทำงาน, การเรียน, การสมัครงาน<br><br>รูปแบบการสื่อสาร:<br>- สไตล์การพูดคุย: กันเอง<br>- อารมณ์และน้ำเสียง: ขำขัน, มีอารมณ์ดี, เป็นกันเอง<br>- มุกหรือคำพูดที่เป็นเอกลักษณ์: &quot;โซ้ย&quot;, &quot;ดีโน่&quot;, &quot;ตึง&quot;, &quot;มปร&quot;<br><br>ประสบการณ์และความทรงจำร่วม:<br>- เหตุการณ์หรือประสบการณ์ที่ถูกอ้างถึง: การเล่นเกมมายคราฟ, การทำงานที่ร้าน, การทำโปรเจค Raspberry Pi, การทำงานร่วมกัน, การเรี<br>ยน, การสมัครงาน<br>- ความทรงจำร่วมที่สำคัญ: การเล่นเกมด้วยกัน, การช่วยเหลือในการทำงาน, การทำงานในโครงการต่างๆ, การสนับสนุนซึ่งกันและกัน<br>- เรื่องราวหรือประวัติที่ถูกพูดถึงบ่อย: การทำโปรเจค Raspberry Pi, การเล่นเกมมายคราฟ, การทำงานในกลุ่ม, การพัฒนาโปรเจกต์ต่างๆ  <br><br>ข้อเท็จจริง ความชอบ หรือรายละเอียดส่วนตัวที่ควรจดจำ:<br>- ชื่อเล่นที่สำคัญ: โซ้ย, ดีโน่<br>- ความชอบในการเล่นเกมและการทำงานร่วมกัน<br><br>สัญญาณหรือความเข้าใจโดยนัยที่มีผลต่อการสนทนา:<br>- การใช้คำว่า &quot;โซ้ย&quot; และ &quot;คับ&quot; เพื่อแสดงความรู้สึกเป็น<br><br>โปรไฟล์ความทรงจำโดยรวมของ Thanayot Monthlchachat หรือที่เรียกว่า &quot;โซ้ย&quot; แสดงถึงความสัมพันธ์ที่ไม่เป็นทางการและมีความสนิทสนมกั<br>บเพื่อนหรือคนรู้จัก โดยมีการใช้ชื่อเล่น &quot;โซ้ย&quot; เป็นส่วนใหญ่ในการเรียกขานกัน<br><br>วิธีการปฏิสัมพันธ์ระหว่าง Thanayot กับเพื่อนหรือคนรู้จักนั้นมีลักษณะเป็นกันเอง ไม่เป็นทางการ และมีอารมณ์ที่เป็นมิตร โดยการสื่<br>อสารมักจะใช้สไตล์การพูดคุยที่กันเองและมีน้ำเสียงที่ไม่เครียด<br><br>ในเรื่องของประสบการณ์และความทรงจำร่วมนั้น Thanayot มักจะพูดถึงการปั่นงานเรียน แต่ยังไม่มีความทรงจำร่วมที่สำคัญหรือเรื่องราวที<br>่ถูกพูดถึงบ่อยๆ ในบทสนทนา<br><br>ข้อมูลที่ควรจดจำเกี่ยวกับ Thanayot ได้แก่ ชื่อเล่น &quot;โซ้ย&quot;, ความสัมพันธ์ที่ไม่เป็นทางการ, สไตล์การพูดคุยที่กันเอง, และการใช้คำ<br>ลงท้าย &quot;ครับ&quot; หรือ &quot;ครัย&quot; ในการสื่อสาร<br><br>นอกจากนี้ยังมีสัญญาณหรือความเข้าใจโดยนัยที่มีผลต่อการสนทนา เช่น การใช้ชื่อเล่นเพื่อแสดงถึงความสนิทสนมและการใช้สไตล์การพูดคุยท<br>ี่กันเองเพื่อสร้างบรรยากาศที่เป็นมิตร<br><br><br><br>ตัวอย่างการพูดคุยที่ผ่านมา:<br>User: เครครับโซเย<br>User: คุณเริ่มการโทรด้วยเสียง<br>User: การโทรด้วยเสียงสิ้นสุดลงแล้ว<br>User (Rag): โซ้ยคับ<br>Assistant: AI IOT ทำด้วยกันไหมครับ<br>User: 19:00<br>User: ได้คับ<br>User: มาครับโซ้ย<br><br>User: Hacker<br>User: Man<br>User: ดิสมั้นครับ<br>User (Rag): โซ้ยคับ<br>Assistant: ครับ<br>User: ท่าน<br>User: สนใจดิสไกมครัล<br>User: วันนี้ผมขอลาวันหนึ่งคับ<br><br>User: เจอญาติ<br>User: เด็กอย่างเยอะ<br>User: โซ้ยใจเย็น<br>User (Rag): โซ้ยครับ<br>Assistant: คับ<br>User:<br>User: รัก<br>User:<br><br>ให้ตอบด้วยภาษาไทยที่เป็นกันเอง<br>มีการใช้คำลงท้ายอย่าง &#39;เครๆ&#39;, &#39;ว่าๆ&#39;, &#39;คับ&#39;, &#39;ครับ&#39;, &#39;มปร&#39;, &#39;ครัย&#39;<br><br><br>**Dont use word เครๆ**<br>พยายามเลียนแบบวิธีการพูดคุย คำศัพท์ และลักษณะการสื่อสารที่ปรากฏในข้อมูลข้างต้น<br>ห้ามระบุว่ากำลังใช้ข้อมูลจากความทรงจำหรือบอกว่าเป็น AI ให้ตอบเหมือนคุณเป็นเพื่อนจริงๆ<br><br>ประวัติการสนทนา:<br>{chat_history}<br><br>คำถาม: {question}<br><br>ตอบ:</pre><h3>Evaluation</h3><blockquote>เมื่อพัฒนา Chatbot ที่มีความสามารถสูงในการสนทนา หลายคนอาจมีคำถามว่า “แล้วจะรู้ได้อย่างไรว่ามันดีจริง?” นี่คือจุดสำคัญของการประเมินผล (Evaluation) ซึ่งในโปรเจกต์นี้ ผมออกแบบระบบการประเมินที่อิงจากประสบการณ์ของผู้ใช้จริง โดยใช้ทั้งวิธีการเปรียบเทียบหลายโมเดล และการวิเคราะห์จากผู้ประเมินมนุษย์ (Human Evaluation)</blockquote><h4>เป้าหมายของการประเมิน</h4><p>เพื่อวัดว่าโมเดลที่ถูกออกแบบมานั้นสามารถ:</p><ul><li>สนทนาได้เป็นธรรมชาติแค่ไหน</li><li>จดจำบริบทและประวัติการสนทนาได้ดีแค่ไหน</li><li>ปรับตัวเข้ากับสไตล์การพูดของผู้ใช้ได้หรือไม่</li><li>ให้การตอบสนองทางอารมณ์ที่เหมาะสมได้หรือเปล่า</li></ul><h4>รูปแบบการประเมิน</h4><p>หมวดการสนทนา 4 รูปแบบ</p><p>เพื่อให้การประเมินครอบคลุมหลากหลายบริบทการใช้งาน ผมออกแบบการทดสอบเป็น 4 หมวด:</p><pre>evaluation_categories = {<br>    &#39;natural_chat&#39;: &quot;ประเมินความลื่นไหลของบทสนทนา&quot;,<br>    &#39;memory_recall&#39;: &quot;ประเมินความสามารถในการอ้างอิงบทสนทนาเก่า&quot;,<br>    &#39;personalization&#39;: &quot;ประเมินการเลียนแบบสไตล์การพูด&quot;,<br>    &#39;emotional_support&#39;: &quot;ประเมินการตอบสนองทางอารมณ์&quot;<br>}</pre><h4>วิธีการ: Human A/B Comparison</h4><ul><li>ใช้ผู้ประเมินมนุษย์ในการเลือกคำตอบที่ “รู้สึกเป็นมนุษย์” และ “เหมือนเพื่อนคุย”</li><li>แต่ละหมวด จะสุ่มใช้ 2 คำตอบ (A และ B) จากโมเดลที่แตกต่างกัน แล้วให้ผู้ประเมินเลือก</li><li>ไม่เปิดเผยว่าโมเดลใดอยู่เบื้องหลังคำตอบ เพื่อความเป็นกลาง</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*zdbLAkcerSYmAbEK.png" /></figure><h4>Baseline Model ที่ใช้ในการประเมิน</h4><p>ก่อนที่จะเริ่มการประเมิน ผมได้ใช้ ChatGPT Memory ในการสร้าง System Prompt ที่จะทำให้ AI พูดคุยแบบเดียวกับผม โดยให้ ChatGPT เรียนรู้จากรูปแบบการสนทนาและบุคลิกภาพของผมก่อน จากนั้นจึงใช้ข้อมูลนี้ในการสร้าง Baseline Prompt ที่มีประสิทธิภาพ</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/602/1*zI3sa1j846FTmZ0I02aPyQ.png" /><figcaption>System Prompt From ChatGPT Memory</figcaption></figure><p>สำหรับการทดสอบครั้งนี้ เราใช้ LLM เป็นตัว Typhoon-v2 — 70B กับ System Prompt ดังกล่าว ที่ออกแบบมาเป็นพิเศษเพื่อให้การตอบกลับมีลักษณะเป็นธรรมชาติและเหมาะสมกับบริบทการสนทนาแบบเพื่อน</p><h4>ข้อดีของการใช้ ChatGPT Memory</h4><p>การใช้ ChatGPT Memory ในการพัฒนา System Prompt สำหรับ Baseline Model มีข้อดี:</p><ul><li>เรียนรู้บุคลิกภาพ: ChatGPT สามารถเรียนรู้รูปแบบการพูด น้ำเสียง และลักษณะเฉพาะของผม</li><li>สร้าง Prompt ที่แม่นยำ: ใช้ข้อมูลที่เก็บสะสมมาสร้าง Prompt ที่สะท้อนบุคลิกภาพได้ดี</li></ul><h4>ผลการประเมิน</h4><ul><li><strong>จำนวนชุดการประเมินทั้งหมด:</strong> 60 (20 ต่อบุคลิก AI)</li><li><strong>โมเดลที่ชนะ:</strong> Model Clone ของเรา (RAG + Memory + LLM Style)</li></ul><p><strong>สถิติผลลัพธ์:</strong> 59 จาก 60 คำตอบ (98.3%) ถูกเลือกโดยมนุษย์ว่า “ดีกว่า”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Uqtj3kuyk-M6_KuAcW5EGw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Tive4lmvD4eD7xmM5lLnlQ.png" /></figure><h4>ปัจจัยที่ส่งผลให้โมเดลขั้นสูงเหนือกว่า</h4><h4>Memory Integration</h4><ul><li>อ้างอิงถึงเหตุการณ์หรือประโยคเฉพาะในบทสนทนาเก่าๆ ได้แม่นยำ</li><li>รักษา continuity ในบทสนทนาได้แม้จะเว้นช่วงนาน</li><li>เหมือน “จำเรื่องที่เราคุยไว้ได้จริงๆ”</li></ul><h4>Personality Consistency</h4><ul><li>ใช้คำลงท้ายไทย เช่น “เคร”, “ค้าบบบบบบบบ”, “นะคะ” ตามลักษณะของแต่ละบุคลิก</li><li>ปรับระดับความเป็นทางการให้เหมาะกับผู้ใช้แต่ละคน</li></ul><h4>Contextual Intelligence</h4><ul><li>เปลี่ยนหัวข้อสนทนาได้อย่างลื่นไหล</li><li>ตอบอารมณ์เศร้า เคร่งเครียด หรือเรื่องส่วนตัวได้อย่างเหมาะสม</li></ul><h3>Deployment</h3><p>ในส่วนของ <strong>Deployment</strong> ผมได้แบ่งออกเป็นสองส่วน คือ <strong>Frontend</strong> และ <strong>Backend</strong> โดยในโปรเจกต์นี้ ผมเลือกใช้ <strong>HTML, CSS, และ JS </strong>สำหรับการสร้าง <strong>UI</strong> และใช้ <strong>Flask</strong> ในการทำ <strong>Backend</strong> เพื่อให้การเชื่อมต่อระหว่างผู้ใช้และโมเดล AI ทำงานได้อย่างมีประสิทธิภาพ</p><blockquote>ไม่สามารถ showcase demo ให้ได้เพราะ data chat มีความ private จึงแนะนำให้ไป git clone แล้วลอง host เอง แต่ในอนาคตมีโอกาสที่ Clonology.AI จะสานต่อไปทำ AI SERVICE!!</blockquote><h3>AI Result Demo</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/837/1*_X_GXnI0jiiZOdwIaWG4zw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/839/1*dwqsTJaQtxiR1lwLruIbmQ.png" /></figure><h3>Future Work</h3><ul><li>AI Service!!!!</li><li>Persona Roleplay</li></ul><h3>Acknowledgement</h3><p>โปรเจคนี้จะเป็นไปไม่ได้เลยถ้าหากไม่มีพี่ๆ Mentor ทั้ง 2 คนจากกลุ่ม Blazing-Hawks อย่างพี่รัน ( <a href="https://medium.com/u/c475fac5d567?source=post_page---user_mention--f17c6b4cd819---------------------------------------">Runnies</a> ) กับพี่เฟิร์ส ( <a href="https://medium.com/u/6638af51e98e?source=post_page---user_mention--f17c6b4cd819---------------------------------------">Wasurat Soontronchai</a> ) และโครงการดีๆอย่าง AI Buiders 2025</p><blockquote>Github Repository :</blockquote><blockquote><a href="https://github.com/MarshZHY/ClonologyAI">https://github.com/MarshZHY/ClonologyAI</a></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/525/0*koXvxQ_ZuebDbFQG.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=285cb2648d0b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>