ชักจะไปกันใหญ่แล้วครับ 5555 เดิมว่าจะลองเล่นเฉย ๆ สุดท้ายนั่งดูจนเพลิน

ช่วงนี้ผมกำลังทดลองเอา GraphRAG มาทำเป็น “ความจำ” ให้ AI agent ครับ พูดง่าย ๆ คือ RAG ปกติเราจะเก็บข้อมูลเป็นก้อน text แล้วค้นด้วย similarity เฉย ๆ แต่ GraphRAG จะไปอีกขั้น คือมันอ่านเอกสารแล้วดึง entity ออกมาเป็นโหนด (node) — คน, องค์กร, หัวข้อ, เครื่องมือต่าง ๆ — แล้วลากเส้นความสัมพันธ์ (relationship) เชื่อมกันเป็น knowledge graph เวลา agent จะ retrieve อะไรขึ้นมา มันก็เดินตามเส้นความสัมพันธ์ได้ ไม่ใช่แค่หยิบก้อนที่หน้าตาคล้ายกันมา ส่วนตัวผมว่านี่แหละคือจุดที่น่าสนใจ เพราะมันใกล้เคียงกับ “ความจำ” ระยะสั้น-ยาวจริง ๆ มากกว่า vector RAG เฉย ๆ

ที่ทำคือป้อนเอกสารเข้าไปเรื่อย ๆ แล้วเปิดหน้าจอนั่งดูกราฟมันโตแบบเรียลไทม์ครับ สนุกแบบสะกดจิตเลย เห็นโหนดใหม่ ๆ ผุดขึ้นมาทีละตัว ทั้งชื่อองค์กร ชื่อคน หัวข้อ security แล้วใน legend ก็มี entity type เต็มไปหมด ทั้ง Person, Organization, ไปจนถึงประเภทย่อย ๆ ที่โมเดลมันแยกออกมาเองอีกเพียบ

เอาจริง ๆ ปัญหาคือยิ่งป้อนยิ่งบานครับ เส้นโยงกันมั่วจนภาพปัจจุบันมันวุ่นวายสุด ๆ พอ entity เยอะขึ้น relationship ก็โยงกันเป็นใยแมงมุมไปหมด สวยนะ แต่เริ่มอ่านด้วยตาไม่รู้เรื่องแล้ว 5555 ก็เลยกลายเป็นโจทย์ต่อไปว่าจะคุมไม่ให้ graph มันโตจนเป็น chaos ได้ยังไง เพราะความจำที่ดีไม่ใช่แค่จำเยอะ แต่ต้องหยิบของที่ใช่ออกมาได้ด้วย เดี๋ยวลองเล่นต่อแล้วจะมาเล่าให้ฟังครับ

This is getting out of hand, lol. I meant to just poke at it for a bit and ended up glued to the screen.

Lately I’ve been experimenting with GraphRAG as a “memory” for an AI agent. Here’s the gist: with regular RAG you store knowledge as plain text chunks and retrieve them by similarity. GraphRAG goes a step further — it reads your documents, pulls out entities as nodes (people, organizations, topics, tools), and draws relationship edges between them to form a knowledge graph. When the agent needs to retrieve something, it can walk those relationships instead of just grabbing the chunks that look alike. Personally, that’s the part I find interesting, because it feels much closer to an actual long/short-term memory than plain vector RAG.

So I kept feeding it documents and left a screen up to watch the graph grow in real time. It’s oddly mesmerizing — new nodes kept popping in one by one: organization names, people, security topics. The legend filled up with entity types too, from Person and Organization all the way down to oddly specific subtypes the model decided to invent on its own.

Honestly, the catch is that the more I fed it, the more it sprawled. The edges started crisscrossing until the current state was total chaos — as entities pile up, the relationships weave into a giant spiderweb. It’s gorgeous, but barely readable by eye anymore. So the next problem is obvious: how do you keep the graph from growing into pure chaos? Good memory isn’t about remembering everything — it’s about pulling out the right thing. I’ll keep playing with it and report back.