æ¥æ¬èªã®åèªãã¯ãã«æ¼ç®ãã§ãããµã¤ãã pythonã§ããã¯ã¨ã³ãã®ç·´ç¿
Deleted articles cannot be recovered. Draft of this article would be also deleted. Are you sure you want to delete this article? ã¯ããã« æ¬è¨äºã§ã¯ããã¯ãã«ãã¼ã¿ãã¼ã¹ã®æ§ç¯ã¨RAGã§ã®æ¤ç´¢ãåå¿è åãã«ã¾ã¨ãã¦ãã¾ãã GoogleColaboratoryç°å¢ã§å®è£ ããããããããããç°å¢è¨å®ã¯ã»ã¨ãã©ããã¾ãããå ¨é¨ç¡æã§ãã çæAIãRAGããã¯ãã«ãã¼ã¿ãã¼ã¹ã¯é£ããã¤ã¡ã¼ã¸ãæã¤äººãå¤ãã§ãããå®ã¯ã¨ã¦ãã·ã³ãã«ã§å®è£ ãç°¡åã§ãã15åç¨åº¦ã§å®è£ ã§ããããã«ãªãããã¤èªããããã«ãªãã¾ãã ãã¯ãã«ãã¼ã¿ãã¼ã¹ã¨ã¯ï¼ ãããããã£ããåããããã説æãã¾ããã¤ã¡ã¼ã¸ãæ´ããã¨ãåªå ãã¾ãã ã¾ãæ®éã®ãã¼ã¿ãã¼ã¹ã«ã¤ã㦠æ®éã®ãã¼ã¿ãã¼ã¹ã«ã¯æ°å
RAGã«é¢ãã主è¦ãªè«æã¾ã¨ãã¦ããã¾ãã(éå»ã®åå«ãã¦éææ´æ°äºå®) è¦ã¤ãããã®ããã¾ã¨ãã¦ããã®ã§ãææ°ã®2024年以éã®è«æå¤ãã§ãã Retrieval-Augmented Generation for Knowledge-Intensive NLP Tasks(22/05/2022) ä¸è¨ç´¹ä»â LLMã£ã¦ãäºåå¦ç¿ãããç¥èã«é¢ãã¦ã¯çãã¦ããããã©ãææ°ã®ãã¥ã¼ã¹ã ã£ãããå°éçãªæ å ±ãçµç¹åºæã®æ å ±ã«ã¯å¯¾å¿ã§ããªãããªã ð¡ å¤é¨ç¥èãLLMã«æ¤ç´¢ãããã!âRAGã®èªç Abstractæ¥æ¬èªè¨³å¤§è¦æ¨¡ãªäºåå¦ç¿æ¸ã¿è¨èªã¢ãã«ã¯ããã®ãã©ã¡ã¼ã¿ã«äºå®ç¥èãèç©ããä¸æµã®èªç¶è¨èªå¦çï¼NLPï¼ã¿ã¹ã¯ã«å¾®èª¿æ´ãããã¨ãã«æå 端ã®ææãéæãããã¨ã示ããã¦ãã¾ããããããç¥èãã¢ã¯ã»ã¹ãã¦æ£ç¢ºã«æä½ããè½åã¯ä¾ç¶ã¨ãã¦éããã¦ãããç¥èéç´åã¿ã¹ã¯ã§ã¯ãã¿ã¹ã¯åºæã®ã¢ã¼ã
ã¯ããã« ããã«ã¡ã¯ï¼ AI ã¨ã³ã¸ãã¢ã®ã¤ãã¾ã¼ã§ãã è¿å¹´ãçæ AI ã®é²åãç®è¦ã¾ãããçæ AI ãæ´»ç¨ããã·ã¹ãã ã®éçºãçãã«è¡ããã¦ãã¾ãããã®ä¸ã§æãæåãªãã¯ããã¯ã RAG ã§ããRAG ã¨ããã®ã¯æ¤ç´¢æ¡å¼µçæ (Retrieval Augmented Generation) ã®ç¥ã§ã質åã®é¢é£æ å ±ãæ¤ç´¢ãã質åã¨é¢é£æ å ±ãã»ããã§å ¥åãã¦åçãããæè¡ã®ãã¨ã§ãã åä¼æ¥ã§ã¯ãã® RAG ã·ã¹ãã ãç©æ¥µçã«å°å ¥ãã¦ãã¾ãããã»ã¼ç¢ºå®ã«èª²é¡ã«ãªãã®ãæ¤ç´¢é¨åã®ç²¾åº¦ã§ããããã¦æ¤ç´¢ç²¾åº¦ãä¸ããããã«ã¯æ¤ç´¢ã¨ã³ã¸ã³ã®ç¥èãå¿ è¦ä¸å¯æ¬ ã§ãã æ¬è¨äºã§ã¯æ¤ç´¢ã¨ã³ã¸ã³ã®çé ãµã¼ãã¹ã§ãã Azure AI Search ãé¡æã«ãæ¤ç´¢ã¨ã³ã¸ã³ã®åºæ¬çãªä»çµã¿ãæ¤ç´¢ã¯ã¨ãªã®æ¸ãæ¹ã«ã¤ãã¦åå¦è åãã«è§£èª¬ãã¾ãã RAG ã®æ¤ç´¢é¨åã "Retriever" ã¨å¼ã³ã¾ããããã®èªæº
èªç¶è¨èªå¦çæ¡ä»¶ãAIã½ãªã¥ã¼ã·ã§ã³éçºæ¡ä»¶ããªã¼ããã¦ããé»ç°ã§ãããã¡ãã¯ã¯ãªã¨ã¼ã·ã§ã³ã©ã¤ã³ã¢ããã³ãã«ã¬ã³ãã¼ã16æ¥ç®ã®è¨äºã§ãã å æ¥ç¤¾å ã§å®æ½ããåå¼·ä¼ã®å 容ãå ¬éãã¾ãããã¼ãã¯RAG(Retrieval-Augmented Generationã®ç¥ï¼ã§ãã åå¼·ä¼ã®çµç·¯ ä»åãªãRAGã®è©±ããããã¨ããã¨ãå¼ç¤¾ã®AIã½ãªã¥ã¼ã·ã§ã³äºæ¥æ¦ç¥ã®ï¼ã¤ã§ããã¨ã³ã¿ã¼ãã©ã¤ãºLLMã¨å¯æ¥ã«é¢ä¿ããããã¼ãã ããã§ãã ç®æ¬¡ ç®æ¬¡ã§ããè·ç¨®ã«é¢ä¿ãªãå ¨å¡ã«ããã£ã¦ããããå 容ãç®æãã¾ãããä»æ¥ã®ç®æ¨ã¨ãã¦ããã®è©±ãèããå¾ã«ãRAGãããã£ãæ°ã«ãªã£ã¦ãRAGã£ã¦é¢ç½ããã ãªã¨æã£ã¦ããã ãããã大æåããªã¨æãã¾ãã RAGã¨ã¯ RAGã®åèªã®æå³ã¯ãã®ã¾ã¾è¨³ãã¨æ¤ç´¢/å¢å¼·/çæã«ãªãã®ã§ããã è¦ããã«å¤§éã®æ å ±ããå¿ è¦ãªãã®ãè¦ã¤ãåºããããã使ã£ã¦æ°ããæç« ãä½ãæè¡ã§ãã
åãã¾ãã¦ãçµå¶ä¼ç»æ¬é¨AIæ¨é²å®¤ã®é¡å³ã窪ç°ãå°æã¨ç³ãã¾ããå½ç¤¾ã¯æ¬å¹´åº¦ãAIæ¨é²å®¤ã¨ããæ°çµç¹ãçºè¶³ããã主ã«çæAIã«ã¤ãã¦ã®ç¤¾å ã®å©ç¨ä¿é²ãããã³ã¦ã¼ã¶ã¼ã¸çæAIãæ´»ç¨ããã½ãªã¥ã¼ã·ã§ã³ã®æä¾ãé²ããã¹ããæ°æè¡ã®å±éãæ¤è¨¼ãè¡ã£ã¦ãã¾ãã ä»åã¯ãæè¿è©±é¡ã¨ãªã£ã¦ãããMicrosoftãçºè¡¨ããRAGï¼Retrieval Augmented Generationï¼æè¡ã§ããGraphRAG â§ã«ã¤ãã¦ãå ã¨ãªãè«æãããã°è¨äºãGitHubã®ã³ã¼ããå ã«å é¨ã®æ§é ã解æããããã«ç¾æç¹ã§ã©ã®ç¨åº¦å®ç¨çããèå¯ãã¦ããã¾ãã GraphRAGã¨ã¯ GraphRAGã¯ããã¬ãã¸ã°ã©ãã¨çæAIã®æè¡ãçµã¿åããããã¨ã§ãå¾æ¥ã®RAGã§ã¯å¯¾å¿ãé£ããã£ãåãåããã«åçã§ããããã«ãªã£ãRAGã§ãã2024å¹´2æã«Microsoftã«ãã£ã¦çºè¡¨ â§ããããã®å¾ã2024å¹´7æã«ãª
æ ªå¼ä¼ç¤¾ãã¬ãã¸ã»ã³ã¹ã¯ãçæAIãRAGã使ã£ããããã¯ãããã¨ã³ã¿ã¼ãã©ã¤ãºåãã«éçºæä¾ãã¦ããã¹ã¿ã¼ãã¢ããã§ããæ¬è¨äºã§ã¯ãRAGã®æ§è½ãé«ããããã®ãGolden-Retrieverãã¨ããææ³ã«ã¤ãã¦ããã£ããç解ãã¾ãã ãã®è¨äºã¯ä½ ãã®è¨äºã¯ãRAGã·ã¹ãã ãå°éç¨èªã«å¼·ãããããã®ææ³ãGolden-Retrieverãã®è«æ[1]ã«ã¤ãã¦ãæ¥æ¬èªã§ç°¡åã«ã¾ã¨ãããã®ã§ãã ä»åããããããRAGã¨ã¯ï¼ãã«ã¤ãã¦ã¯ãç¥ã£ã¦ããåæã§é²ã¿ã¾ãã確èªããå ´åã¯ä»¥ä¸ã®è¨äºããåèä¸ããã æ¬é¡ ãã£ãããµããªã¼ Golden-Retrieverã¯ãRAGï¼Retrieval Augmented Generationï¼ããæ¥çç¹æã®ç¨èªã»ç¤¾å ç¨èªãå«ããããªè³ªåã«å¼·ãããããã®ææ³ã§ããã«ãªãã©ã«ãã¢å¤§å¦ã®ç 究è ãã«ãã£ã¦2024å¹´8æã«ææ¡ããã¾ããã å¾æ¥ã®RAGã·ã¹ãã
ã©ããªäººåãã®è¨äºï¼ ããããRAGãä½ã£ã¦ã¿ãã DifyãLangChainã«ãã ããããèªåã§éçºããã³ããªã³ã°ããã ãã¯ãã«DBãåãè¾¼ã¿ã¢ãã«ã®é¸å®ã®åæããµãã¨ç¥ããã ããã§ã¯RAGã¨ã¯ä½ãã®ãããªè©±é¡ã¯æ±ãã¾ããã RAGããã»ã¼AIæ´»ç¨ã®ç¾å®çãªæé©è§£ã«ãªãã¤ã¤ãã LLMã¯é«åº¦ãªç¥çã¿ã¹ã¯ãå®è¡å¯è½ã§ããã ãããªç解ãä¸çã«åºã¾ã£ã¦ããä¸ã§ãä¼æ¥ã¯èªããèãããã¼ã¿ãLLMã«çµã¿åããã¦ã©ãæ´»ç¨ãããèºèµ·ã«ãªã£ã¦ãã¾ããããããã¯ããã°ãã¼ã¿ã ï¼ã¨ããæ代ãçµã¦ãããããæ å ±ã¤ã³ãã©ã«æè³ããä¼æ¥ãå¤ããAIã§ãã¼ã¿ãæ´»ç¨ããæµãã¯ãã¯ã確å®è·¯ç·ã¨è¨ãã¾ãã ãã®åé¡ã解決ããææ³ã¨ãã¦ä¸çªæåã«æãã¤ãã®ã¯ãã¢ãã«èªä½ãæ¹å¤ãããã¡ã¤ã³ãã¥ã¼ãã³ã°ã§ãããããããã¡ã¤ã³ãã¥ã¼ãã³ã°ã«ã¯ããã¤ãã®å®ç¨ä¸ã®åé¡ãããã¾ãããã¡ã¤ã³ãã¥ã¼ãã³ã°èªä½ã«å°éç¥èãå¿ è¦ã§ãã
RAGã®ç²¾åº¦æ¹åããããã«ä½ãããããå¦ã³ã¾ãããåºæ¬ç³»ã®Naive RAGãç¥ã£ã¦ãã人åãã®è¨äºã§ãã æ¹æ³ãå¤ãããã®ã§ãYoutubeã®ãRAG From Scratchããä¸å¿ã«å°ãæ´çãã¦ã¿ã¾ãããLangChainããã使ã£ã¦ããã®ã§ãLangChainåºå ¸ãå¤ãã§ãã å ¨ä½å ã¾ãã¯ãRAGã®å ¨ä½åãIndexingãåãæµãã«ããã®ãå°ããããã«ããã®ã§ãããå®è¡ã¿ã¤ãã³ã°ã¨ãã¦ã¯RAGã®åæºåã¨ãã¦ãã£ã¦ããã¾ãã ç»ååºå ¸: RAG from scratch: Overview ããå°ãç²åº¦ãç´°ããããå³ã§ãã ç»ååºå ¸: RAG from scratch: Overview 表形å¼ã§åé¡ãã¾ããGenerationã ãå°ãç¹æ®ã§ãã 大åé¡ ä¸åé¡ å 容
ãã¾ãã¾ãªæ°å¦çãããã¯ãã ã¼ãã¼å½¢å¼ã§è§£èª¬ãããµã¤ãã3Blue1Brownãã«ããã¦ãChatGPTã«ä»£è¡¨ãããAIãå½¢ä½ã£ã¦ãããTransformerãæ§é ã®å¿èé¨ãAttention(ã¢ãã³ã·ã§ã³)ãã«ã¤ãã¦ã®è§£èª¬ãè¡ããã¦ãã¾ãã 3Blue1Brown - Visualizing Attention, a Transformer's Heart | Chapter 6, Deep Learning https://www.3blue1brown.com/lessons/attention AIã®ä¸èº«ã¨è¨ãã大è¦æ¨¡è¨èªã¢ãã«ã®ãã¼ã¹ã¨ãªãä»äºã¯ãæç« ãèªãã§æ¬¡ã«ç¶ãåèªãäºæ¸¬ãããã¨ãããã®ã§ãã æç« ã¯ããã¼ã¯ã³ãã¨ããåä½ã«å解ããã大è¦æ¨¡è¨èªã¢ãã«ã§ã¯ãã®ãã¼ã¯ã³åä½ã§å¦çãè¡ãã¾ããå®éã«ã¯åèªãã¨ã«1ãã¼ã¯ã³ã¨ãã訳ã§ã¯ããã¾ãããã3Blue1Brownã¯åç´åãã¦
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}