Graph

GraphRAG 공부: RAG에 Graph를 붙여보자!

graph-dev 2024. 7. 6. 14:50
728x90

 

GPT가 그린 그래프 네트워크

 

 

 

얼마전에, PARIS AI Society라는 그룹에서 공개한 좋은 graphRAG 레퍼런스를 공유하여 살펴볼 수 있었다.

 

GRAPH RAG라는 개념에 대해, 최근 Microsoft 사에서 공개한 코드부터 graph 빌더로 활동하신 이태님의 리뷰 블로그와 논문에 이르기까지, 괜찮은 레퍼런스를 잘 정리해두었다.

 

하나씩 살펴보면서 다시한번 graph에 대해 배워보고, 최근 인기있는 RAG가 어떻게 표현될 수 있는지 확인해보려고 한다.

 

Microsoft

 

특히, 마이크로소프트사의 자료가 좋아보인다.

https://www.microsoft.com/en-us/research/project/graphrag/

 

데모 영상부터 살펴본다. 아주 화려하다. 그래프의 최고 장점은 "화려함"이 아닐까 생각이 든다.

graphRAG 영상

 

 

정이태님: LLMOps + Graph = GraphRAG

Graph는 기본적으로 노드와 엣지로 모든 것을 표현한다.

RAG vs GraphRAG

  1. 표현
  2. 유사성 연산
  3. 조회 방식이 다름.

Why GraphRAG?

  1. Reasoning
    1. explicit 방식에서 정보를 Deductive, Inductive, Abductive..넣는다.
  2. MDM(Master Data Management)
    1. Data Silo의 데이터 분석하여 연관성 파악 후 그래프 데이터로 관리하면 효율적이다.

질문의 형태: 여러 Hop (데이터)를 거쳐 답변 할 수 있는 질문들을 대답할 때 유리합니다.

  • 질문의 형태가 추론 / 여러 데이터 거쳐 답변하려면 유리.
  • CoT와 유사한 관점이다. 라우팅과도 유사한 관점이다.

GraphRAG ideal architecture - Store Strategy

  • 생성된 노드와 엣지 잘 저장됩니다.
  • 여러 종류의 데이터 → 우측으로 뽑으면 각각의 엔티티가 도출된다.
    • Docs2KG 논문을 본다.

Knowledge Graph Construction

  • 엔티티를 뭐로 뽑는가? 지식 베이스 사이트 참고해보세요.
    • 외부 지식베이스

GraphRAG ideal architecture - Query Strategy

  • text2cypher
    • storage - architecture
      • graphQL? 랭체인? 엔지니어링으로 접근하길 추천한다.
    • LLM-Fine Tuning
      • codestral-textcypher (허깅페이스)
    • prompt - few-shot learning
      • 프롬프트를 본인 케이스에 입력하면, 케이스 부적합한 경우가 많다.

GraphRAG ideal architecture - Pruning Strategy

  • 요약: graphRAG, RAG 핵심은 동일함. (잘 저장, 쿼리, 가지치기 등)

Q1. 한국어 임베딩 graphRAG?

  • 랭체인앞에 그냥 translate chain 넣어서 한다.
  • 그래프 rag는 영어로 넣고, 결과는 그냥 한글로 결과 나오게함. 비용이 많이 들어서 그렇다.
  • 성능 향상이 있다면 그 때 파인튜닝해도 늦지 않다.

Q2. 응답 만드는데 시간이 지연되는 것 → 하드웨어 향상으로 속도 향상?

  • RAG 10초 딜레이?

차원을 높여서 좋은 예측 성능을 받았다. molecular는 불가피하게 그래프로 가야한다.

 

GraphRAG 레퍼런스

Microsoft

  • GraphRAG: New tool for complex data discovery now on GitHub

https://www.microsoft.com/en-us/research/blog/graphrag-new-tool-for-complex-data-discovery-now-on-github/

  • GitHub repository

https://github.com/microsoft/graphrag

 

GitHub - microsoft/graphrag: A modular graph-based Retrieval-Augmented Generation (RAG) system

A modular graph-based Retrieval-Augmented Generation (RAG) system - microsoft/graphrag

github.com

 

  • GitHub: Responsible AI FAQ
 

graphrag/RAI_TRANSPARENCY.md at main · microsoft/graphrag

A modular graph-based Retrieval-Augmented Generation (RAG) system - microsoft/graphrag

github.com

 

정이태님 자료

From RAG to GraphRAG , What is the GraphRAG and why i use it?

https://jeongiitae.medium.com/from-rag-to-graphrag-what-is-the-graphrag-and-why-i-use-it-f75a7852c10c

 

From RAG to GraphRAG , What is the GraphRAG and why i use it?

Before discussing RAG and GraphRAG,

jeongiitae.medium.com

 

arXiv 논문

 

From Local to Global: A Graph RAG Approach to Query-Focused Summarization

The use of retrieval-augmented generation (RAG) to retrieve relevant information from an external knowledge source enables large language models (LLMs) to answer questions over private and/or previously unseen document collections. However, RAG fails on gl

arxiv.org

 


하나씩 보면서 자기 것으로 만들어보겠다.