RAG, MCP

이정훈·2026년 1월 15일


위 빨간 box가 lammaIndex

Role in RAG

  • Query Engine (passage -> summery로 변환하여 LLM의 context limit을 맞춰줌)
  • External Knowlege Db management
  • Embedder (text 뿐만아니라 이미지, 영상 등등..)

query engine에서도 LLM이 parametic knowliege으로 생성할 수 있기때문에 할루시네이션이 발생할 수 있음
--> prompt를 통해 prior knowlege를 사용할지, passage를 더 적극적으로 활용할지, passage정보가 틀렸다면 prior knowlege를 사용할지 설정할 수 있음


1/15 복습
classic IR, BM25은 spase matric을 이용하여 similarity를 계산
DPR, ColBERT는 Dense한 metric은 생성하여 similarity를 계산

MCP (Model Context Protocl)


Graph RAG

앞서 배운 내용은 textRAG

Knowledge G = (U, E)에서 U와 E를 vectorization 시킴 (Triplets이라는 structured representation of relationship을 나타내는 자료구조, 예로 datapedia가 있음)
vectorized된 Query와 U, E vector를 각각 cosine simmiraritiy top_k를 구해서 그걸 LLM input으로 넣어주는듯

Top-k Approximation

왼쪽 식이 retriever, 오른쪽 식이 LLM으로 생각하면 될듯

x를 빼면 조건부 확률과 동일
결국 모든 Docs(z)를 다 뒤질수 없으니 top-k만 가져와서 approximation하겟다

loss function을 만들어서 미분하고 보니

profile
AngDDo

0개의 댓글