전체 글
-
[논문리뷰] Training language models to follow instructionswith human feedback(2022, InstructGPT)카테고리 없음 2024. 1. 24. 22:08
# 요약 - Language Model의 크기를 증가시키는 것이 반드시 사람의 의도를 잘 파악하지는 않음 - LM을 다양한 Task에서 사용자의 의도에 맞게 Fine-tuning 하는 방법을 제시 - GPT-3 보다 100배 작은 매개변수를 가진 InstructGPT는 GPT-3 보다 더 사람의 의도에 맞는 출력을 생성함 # 도입 - LM은 Few-shot 프롬프팅을 통해 다양한 NLP Task 적용이 가능 - 그러나 사실을 지어내거나, 사용자 지침을 잘 따르지 않는 등 의도하지 않은 출력이 발생함 - 원인은 LM에 사용되는 목표, 다음 토큰을 예측하는 목표가 "사용자의 지시를 유용하게 따르기"라는 목표와 다르기 때문 - 본 논문에서는 사람의 피드백을 통한 강화 학습(RLHF)을 사용하여 다양한 지침을 ..
-
[LlamaIndex] Storing카테고리 없음 2024. 1. 22. 16:24
데이터를 로드하고 Indexing한 후에는 다시 Indexing하는 데 드는 시간과 비용을 피하기 위해 해당 데이터를 저장하는 것이 좋습니다. 기본적으로 Indexing된 데이터는 메모리에만 저장됩니다. ○ 특정 경로에 저장 아래 코드는 지정된 경로에 Indexing 데이터를 저장하고 다시 불러오는 예시 입니다. from llama_index import StorageContext, load_index_from_storage # Indexing된 데이터를 특정 경로에 저장 storage_context.persist(persist_dir="") # rebuild storage context storage_context = StorageContext.from_defaults(persist_dir="") # ..
-
[LlamaIndex] Indexing카테고리 없음 2024. 1. 22. 16:08
데이터가 로드되면 이제 Document 개체 목록(또는 Node 목록)이 생성됩니다. 이제 쿼리를 시작할 수 있도록 Index를 빌드할 시간입니다. Index는 Document 객체로 구성된 데이터 구조로, LLM에서 쿼리할 수 있도록 설계되었습니다. LlamaIndex는 다양한 인덱스 유형을 제공합니다. ○ Vector Store Index Vector Store Index는 가장 자주 접하게 되는 인덱스 유형입니다. Vector Store Index는 문서를 가져와서 노드로 분할합니다. 그런 다음 모든 노드의 텍스트에 대한 벡터 임베딩을 생성하여 LLM에서 쿼리할 수 있도록 준비합니다. # Embedding 벡터 임베딩은 LLM 애플리케이션이 작동하는 방식의 핵심입니다. 흔히 임베딩이라고 부르는 벡터..
-
[LlamaIndex] Prompt카테고리 없음 2024. 1. 16. 22:23
Prompt는 LLM이 출력을 생성할때 가장 많은 영향을 미치는 요소 중 하나 입니다. Prompt는 답변 합성, 검색, 인덱스 구성 등에 사용됩니다. LlamaIndex에서는 Prompt를 개선하기 위한 간단한 방법부터 고급 방법까지 제공하고 있습니다. ○ Prompt 사용 패턴 # 사용자 정의 프롬프트 LlamaIndex에서는 PromptTemplate 클래스를 사용하여 간단하게 기본 Prompt를 수정 할 수 있습니다. from llama_index.prompts import PromptTemplate # 텍스트 질의응답 프롬프트 수정 text_qa_template_str = ( "Context information is" " below.\n---------------------\n{context_..
-
[LlamaIndex] Loading Data카테고리 없음 2024. 1. 16. 16:03
LLM을 설정한 이후, 데이터와 관련된 작업을 시키기 위해서는 먼저 데이터를 로드 하고 처리해야 합니다. 로드 & 처리된 데이터는 색인화 및 저장 단계를 거쳐 활용할 수 있습니다. Loading Data 단계에서는 Loaders와 Transformaions으로 데이터를 어떻게 불러들이고 처리하는지 살펴보겠습니다. ○ Loaders LlamaIndex에서는 Data Connector를 통해 데이터를 Load 합니다. Data Connector는 다양한 데이터 원본에서 데이터를 수집한 것을 'Document'라는 개체로 저장합니다. 'Document'는 텍스트, 이미지 등의 데이터를 의미하는것 뿐만 아니라 관련된 메타데이터도 포함하여 의미합니다. # 기본 Data Connector 사용 LlamaIndex에..
-
[LlamaIndex] LLM 설정 및 사용카테고리 없음 2024. 1. 16. 12:26
○ LLM 설정 및 기본 사용 LLM 기반 애플리케이션을 구축할 때 먼저 고려해야 할 사항은 어떤 LLM을 사용할 것인가입니다. 필요한 경우 둘 이상의 LLM을 사용할 수도 있습니다. LLM은 파이프라인의 여러 단계에서 사용될 수 있으나 대표적으로는 아래와 같이 사용 됩니다. Indexing 중에 LLM을 사용하여 텍스트를 Embeding 하는 경우 질의문과 관련된 문서를 바탕으로 답변 생성 시 그 외 텍스트를 요약하여 Indexing 하거나 문서를 분할 할때 Semantic 한 정보를 고려하여 분할 할 경우 등 일반적으로 LLM은 아래 코드처럼 인스턴스화 하여 'ServiceContext'에 보내는 방법으로 사용합니다. from llama_index.llms import OpenAI from llama..
-
[LlamaIndex] LlamaIndex는 무엇인가요?카테고리 없음 2024. 1. 15. 22:35
○ What is LlamaIndex? LlamaIndex는 LLM 기반 애플리케이션 개발을 지원하는 데이터 프레임워크 입니다. 다양한 데이터 소스를 LLM과 통합할 수 있도록 지원합니다. 다양한 데이터 소스라 함은 PDF, PowerPoint와 같은 다양한 파일 형식은 물론 Notion 및 Slack과 같은 애플리케이션, 심지어 Postgres 및 MongoDB와 같은 데이터베이스도 포함합니다. LlamaIndex는 데이터 수집 및 처리를 지원하는 다양한 커넥터를 제공하여 LLM과의 원활한 연동이 가능하게 합니다. 또한 LlamaIndex는 효율적인 데이터 검색 및 쿼리 인터페이스를 갖추고 있습니다. 이 기능들을 통해 개발자는 RAG(Retrieval Augmented Generation, 검색증강생성..
-
[논문리뷰] Finetuned Language Models Are Zero-Shot Learners(2022, Instruction following)카테고리 없음 2024. 1. 12. 12:55
# 요약 - Language Model의 Zero-shot 학습 능력을 향상시키는 간단한 방법을 연구 - 명령어를 통해 설명된 Dataset에서 Instruction tuninig이 Zero-shot 성능을 크게 향상 시키는것을 입증 - 137B의 Pre-trained LM을 명령어 템플릿을 통해 변형된 60개 이상의 NLP 데이터 세트에 대해 Instruction Tuninig 수행 - FLAN(Instruction Tuned Model)을 평가한 결과, FLAN은 수정하지 않은 모델보다 성능이 크게 향상되었으며 평가한 25개 데이터 세트 중 20개에서 제로 샷 175B GPT-3를 능가 # 서론 - GPT-3(Brown et al., 2020)와 같은 대규모 언어 모델(LM)은 다양한 Task를 매우..