Code&Data Insights

[Prompt Engineering] RAG란? (Retrieval-Augmented Generation) 본문

Artificial Intelligence/Prompt Engineering

[Prompt Engineering] RAG란? (Retrieval-Augmented Generation)

paka_corn 2024. 4. 27. 14:08

검색증강생성(Retrieval-Augmented Generation)

: 응답 생성 전 외부의 신뢰할 수 있는 데이터를 추가적으로 제공함으로써 LLM의 출력을 최적화시키는 방법 

 

- 목적: Generative AI가 잘못된 답을 하는 환각현상을 줄일 수 있음 

=> LLM의 외부에서 추가 데이터를 제공해서 질문과 관련도가 높은 답변을 하도록 함 

 

- 유사한 활용 기법 : According to' + 사전정보를 참고하여 더 정교화되고 정확한 답변을 제공 

 

 

"According to ...": Prompting Language Models Improves Quoting from Pre-Training Data

Large Language Models (LLMs) may hallucinate and generate fake information, despite pre-training on factual data. Inspired by the journalistic device of "according to sources", we propose according-to prompting: directing LLMs to ground responses against p

arxiv.org

 

 

- 활용 방법 

1) 라이브 소셜 미디어 피드 | 뉴스 사이트 같은 정보 소스에 직접 연결하여 최신 정보를 참고하도록 . 

 

2) 외부 데이터 생성 후 활용 

: API, 데이터베이스 또는 문서 리포지토리와 같은 여러 데이터 소스에서 가져옴 

=> 파일, 데이터베이스 레코드 

 

 

 

RAG takes an input and retrieves a set of relevant/supporting documents given a source (e.g., Wikipedia). The documents are concatenated as context with the original input prompt and fed to the text generator which produces the final output. This makes RAG adaptive for situations where facts could evolve over time. This is very useful as LLMs's parametric knowledge is static. RAG allows language models to bypass retraining, enabling access to the latest information for generating reliable outputs via retrieval-based generation.

=> RAG는 입력을 받아 관련 문서를 찾고 이를 원본 입력과 함께 텍스트 생성기에 제공. 이는 시간이 지나면 변하는 상황에 적응할 수 있게 해주며, 최신 정보에 접근하여 신뢰할 수 있는 출력을 생성할 수 있음! 

 

 

 

 

 

reference 

https://aws.amazon.com/ko/what-is/retrieval-augmented-generation/

https://www.promptingguide.ai/techniques/rag

Comments