Building Multi-document Agent
Last updated
Last updated
여러 문서 또는 데이터에서 RAG를 통해 문장을 생성할 때 Retrieval Tools를 만들고 여러 문서에서 지식을 탐색하여 원하는 답을 생성해야 할 때가 있습니다. 이때 Multi-document Agent는 여러개의 문서에서 RAG를 통해 3개의 상위 Similar tools를 만들고 이에 대한 쿼리를 기반으로 원하는 최종 Response를 이끌어 냅니다.
종합적인 정보 검색: 여러 문서에 걸친 집단적 지식을 활용함으로써 사용자에게 쿼리에 대한 보다 포괄적이고 정확한 답변을 제공할 수 있습니다. 이를 통해 더 풍부한 사용자 경험을 보장하고 더 깊은 이해를 촉진시킴
관련성 향상: 검색 중 문서의 순위를 재조정하는 기능으로 가장 관련성이 높은 정보의 우선 순위를 지정하여 응답의 품질을 개선할 수 있습니다. 이를 통해 사용자는 특정 쿼리에 맞는 가장 관련성 높은 정보를 제공 받음
효율적인 쿼리 계획: 쿼리 계획 도구가 포함됨으로써 검색 전략을 최적화하여 보다 효율적이고 효과적인 정보 검색을 수행할 수 있습니다. 이를 통해 사용자는 시의적절하고 관련성 있는 답변을 받을 수 있어 전반적인 사용자 만족도 향상
확장성: 대규모 문서를 활용하는 확장성으로 대량의 데이터를 처리하고 다양한 사용 사례를 지원할 수 있어 다양한 도메인의 애플리케이션에 이상적
Multi-document Agent를 구축할 때 각각의 문서는 Vector Tool, Summary Tool로 구성하고 3개의 문서를 아래의 Tool에서 지식을 탐색하고 Query 시에 원하는 Response 문장 생성을 이끌어 냅니다.
Metagpt 논문 : Summary Tool
Longlor 논문: Summary Tool
vr_mcl 논문: Vector Tool
import os
import nest_asyncio
from dotenv import load_dotenv, find_dotenv
# the format for that file is (without the comment) #API_KEYNAME=AStringThatIsTheLongAPIKeyFromSomeService
def load_env():
_ = load_dotenv(find_dotenv())
def get_openai_api_key():
load_env()
openai_api_key = os.getenv("OPENAI_API_KEY")
return openai_api_key
OPENAI_API_KEY = get_openai_api_key()
nest_asyncio.apply()
!mkdir dataset
!wget "https://openreview.net/pdf?id=VtmBAGCN7o" -O 'dataset/metagpt.pdf'
!wget "https://openreview.net/pdf?id=6PmJoRfdaK" -O 'dataset/longlora.pdf'
!wget "https://openreview.net/pdf?id=hSyW5go0v8" -O 'dataset/selfrag.pdf'
mkdir: cannot create directory ‘dataset’: File exists
--2024-05-11 17:07:13-- https://openreview.net/pdf?id=VtmBAGCN7o
Resolving openreview.net (openreview.net)... 35.184.86.251
Connecting to openreview.net (openreview.net)|35.184.86.251|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 16911937 (16M) [application/pdf]
Saving to: ‘dataset/metagpt.pdf’
dataset/metagpt.pdf 100%[===================>] 16.13M 8.29MB/s in 1.9s
2024-05-11 17:07:15 (8.29 MB/s) - ‘dataset/metagpt.pdf’ saved [16911937/16911937]
--2024-05-11 17:07:16-- https://openreview.net/pdf?id=6PmJoRfdaK
Resolving openreview.net (openreview.net)... 35.184.86.251
Connecting to openreview.net (openreview.net)|35.184.86.251|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1168720 (1.1M) [application/pdf]
Saving to: ‘dataset/longlora.pdf’
dataset/longlora.pd 100%[===================>] 1.11M 1.23MB/s in 0.9s
2024-05-11 17:07:18 (1.23 MB/s) - ‘dataset/longlora.pdf’ saved [1168720/1168720]
--2024-05-11 17:07:18-- https://openreview.net/pdf?id=hSyW5go0v8
Resolving openreview.net (openreview.net)... 35.184.86.251
Connecting to openreview.net (openreview.net)|35.184.86.251|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1244749 (1.2M) [application/pdf]
Saving to: ‘dataset/selfrag.pdf’
dataset/selfrag.pdf 100%[===================>] 1.19M 1.28MB/s in 0.9s
2024-05-11 17:07:20 (1.28 MB/s) - ‘dataset/selfrag.pdf’ saved [1244749/1244749]
papers = [
"dataset/metagpt.pdf",
"dataset/longlora.pdf",
"dataset/selfrag.pdf",
]
from llama_index.core import SimpleDirectoryReader, VectorStoreIndex, SummaryIndex
from llama_index.core.node_parser import SentenceSplitter
from llama_index.core.tools import FunctionTool, QueryEngineTool
from llama_index.core.vector_stores import MetadataFilters, FilterCondition
from typing import List, Optional
def get_doc_tools(
file_path: str,
name: str,
) -> str:
"""Get vector query and summary query tools from a document."""
# load documents
documents = SimpleDirectoryReader(input_files=[file_path]).load_data()
splitter = SentenceSplitter(chunk_size=1024)
nodes = splitter.get_nodes_from_documents(documents)
vector_index = VectorStoreIndex(nodes)
def vector_query(
query: str,
page_numbers: Optional[List[str]] = None
) -> str:
"""Use to answer questions over a given paper.
Useful if you have specific questions over the paper.
Always leave page_numbers as None UNLESS there is a specific page you want to search for.
Args:
query (str): the string query to be embedded.
page_numbers (Optional[List[str]]): Filter by set of pages. Leave as NONE
if we want to perform a vector search
over all pages. Otherwise, filter by the set of specified pages.
"""
page_numbers = page_numbers or []
metadata_dicts = [
{"key": "page_label", "value": p} for p in page_numbers
]
query_engine = vector_index.as_query_engine(
similarity_top_k=2,
filters=MetadataFilters.from_dicts(
metadata_dicts,
condition=FilterCondition.OR
)
)
response = query_engine.query(query)
return response
vector_query_tool = FunctionTool.from_defaults(
name=f"vector_tool_{name}",
fn=vector_query
)
summary_index = SummaryIndex(nodes)
summary_query_engine = summary_index.as_query_engine(
response_mode="tree_summarize",
use_async=True,
)
summary_tool = QueryEngineTool.from_defaults(
name=f"summary_tool_{name}",
query_engine=summary_query_engine,
description=(
f"Useful for summarization questions related to {name}"
),
)
return vector_query_tool, summary_tool
from pathlib import Path
paper_to_tools_dict = {}
for paper in papers:
print(f"Getting tools for paper: {paper}")
vector_tool, summary_tool = get_doc_tools(paper, Path(paper).stem)
paper_to_tools_dict[paper] = [vector_tool, summary_tool]
Getting tools for paper: dataset/metagpt.pdf
Getting tools for paper: dataset/longlora.pdf
Getting tools for paper: dataset/selfrag.pdf
initial_tools = [t for paper in papers for t in paper_to_tools_dict[paper]]
from llama_index.llms.openai import OpenAI
llm = OpenAI(model="gpt-3.5-turbo")
len(initial_tools)
6
from llama_index.core.agent import FunctionCallingAgentWorker
from llama_index.core.agent import AgentRunner
agent_worker = FunctionCallingAgentWorker.from_tools(
initial_tools,
llm=llm,
verbose=True
)
agent = AgentRunner(agent_worker)
response = agent.query(
"LongLoRA에 사용된 평가 데이터 세트에 대해 알려줄래?."
"그리고 평가 결과에 대해 알려줘"
)
Added user message to memory: LongLoRA에 사용된 평가 데이터 세트에 대해 알려줄래?.그리고 평가 결과에 대해 알려줘
=== Calling Function ===
Calling function: vector_tool_longlora with args: {"query": "evaluation dataset"}
=== Function Output ===
The evaluation dataset used in the experiments described in the provided context is the PG19 test split.
=== Calling Function ===
Calling function: vector_tool_longlora with args: {"query": "evaluation results"}
=== Function Output ===
Our model achieves comparable performance to LongChat-13B, the state-of-the-art model in this task. Unlike LongChat-13B, which is fully fine-tuned on self-collected long context conversation text, our model is efficiently adapted on RedPajama via next-token generation. Our model even slightly outperforms LongChat-13B in the 16k evaluation.
=== LLM Response ===
LongLoRA에 사용된 평가 데이터 세트는 PG19 테스트 분할이며, 모델은 LongChat-13B와 비교 가능한 성능을 달성했습니다. LongChat-13B는 자체 수집한 긴 대화 텍스트로 완전히 미세 조정된 반면, LongLoRA 모델은 RedPajama를 통해 다음 토큰 생성을 효율적으로 적응했습니다. 또한, LongLoRA 모델은 16k 평가에서 LongChat-13B를 약간 능가했습니다.
response = agent.query("Self-RAG와 LongLoRA에 대해 요약해줄래?")
print(str(response))
Added user message to memory: Self-RAG와 LongLoRA에 대해 요약해줄래?
=== Calling Function ===
Calling function: summary_tool_selfrag with args: {"input": "Self-RAG\ub294 \uc790\uae30 \uc8fc\ub3c4\uc801 \ub9ac\ub529\uc744 \uc704\ud55c \ub9ac\ub529 \uc774\ud574\ub97c \uc704\ud55c \uc9c8\ubb38 \uc0dd\uc131\uc744 \uc704\ud55c \ubaa8\ub378\uc785\ub2c8\ub2e4."}
=== Function Output ===
Self-RAG는 자기 주도적 리딩을 위한 리딩 이해를 위한 질문 생성을 위한 모델입니다. Self-RAG은 리플렉션 토큰을 활용하여 입력과 이전 생성물을 고려하여 지식 검색의 필요성을 판단하고, 검색된 지식의 관련성, 지원 여부, 유용성을 평가합니다. 이 모델은 featurized self-reflection을 통해 세분화된 평가를 수행하며, 학습 기반 방법을 사용하여 세밀한 자가평가 피드백 및 추론 시간 제어를 가능하게 합니다.
=== Calling Function ===
Calling function: summary_tool_longlora with args: {"input": "LongLoRA\ub294 \uae34 \ubb38\ub9e5\uc744 \uac00\uc9c4 \ubb38\uc11c\ub97c \uc694\uc57d\ud558\ub294 \ubaa8\ub378\ub85c, \uae34 \ubb38\uc11c\ub97c \ucc98\ub9ac\ud558\uae30 \uc704\ud574 \uc124\uacc4\ub418\uc5c8\uc2b5\ub2c8\ub2e4."}
=== Function Output ===
LongLoRA는 긴 문서를 처리하고 요약하는 모델로 개발되었습니다.
=== LLM Response ===
Self-RAG는 자기 주도적 리딩을 위한 리딩 이해를 위한 질문 생성을 위한 모델입니다. Self-RAG는 리딩 이해를 위한 질문 생성을 통해 자기 주도적 학습을 돕고, 학습 과정에서의 자기 반성과 학습 경험, 유용성을 강조합니다. 이 모델은 featurized self-reflection을 기반으로 하며, 학습 과정의 효율성을 높이고, 학습자의 학습 및 성과 시간을 효율적으로 관리할 수 있도록 설계되었습니다.
LongLoRA는 긴 문맥을 가진 문서를 요약하는 모델로, 긴 문서를 처리하기 위해 설계되었습니다.
assistant: Self-RAG는 자기 주도적 리딩을 위한 리딩 이해를 위한 질문 생성을 위한 모델입니다. Self-RAG는 리딩 이해를 위한 질문 생성을 통해 자기 주도적 학습을 돕고, 학습 과정에서의 자기 반성과 학습 경험, 유용성을 강조합니다. 이 모델은 featurized self-reflection을 기반으로 하며, 학습 과정의 효율성을 높이고, 학습자의 학습 및 성과 시간을 효율적으로 관리할 수 있도록 설계되었습니다.
LongLoRA는 긴 문맥을 가진 문서를 요약하는 모델로, 긴 문서를 처리하기 위해 설계되었습니다.
urls = [
"https://openreview.net/pdf?id=VtmBAGCN7o",
"https://openreview.net/pdf?id=6PmJoRfdaK",
"https://openreview.net/pdf?id=LzPWWPAdY4",
"https://openreview.net/pdf?id=VTF8yNQM66",
"https://openreview.net/pdf?id=hSyW5go0v8",
"https://openreview.net/pdf?id=9WD9KwssyT",
"https://openreview.net/pdf?id=yV6fD7LYkF",
"https://openreview.net/pdf?id=hnrB5YHoYu",
"https://openreview.net/pdf?id=WbWtOYIzIK",
"https://openreview.net/pdf?id=c5pwL0Soay",
"https://openreview.net/pdf?id=TpD2aG1h0D"
]
papers = [
"dataset/metagpt.pdf",
"dataset/longlora.pdf",
"dataset/loftq.pdf",
"dataset/swebench.pdf",
"dataset/selfrag.pdf",
"dataset/zipformer.pdf",
"dataset/values.pdf",
"dataset/finetune_fair_diffusion.pdf",
"dataset/knowledge_card.pdf",
"dataset/metra.pdf",
"dataset/vr_mcl.pdf"
]
for url, paper in zip(urls, papers):
!wget "{url}" -O "{paper}"
--2024-05-11 17:10:25-- https://openreview.net/pdf?id=VtmBAGCN7o
Resolving openreview.net (openreview.net)... 35.184.86.251
Connecting to openreview.net (openreview.net)|35.184.86.251|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 16911937 (16M) [application/pdf]
Saving to: ‘dataset/metagpt.pdf’
dataset/metagpt.pdf 100%[===================>] 16.13M 8.23MB/s in 2.0s
2024-05-11 17:10:28 (8.23 MB/s) - ‘dataset/metagpt.pdf’ saved [16911937/16911937]
--2024-05-11 17:10:28-- https://openreview.net/pdf?id=6PmJoRfdaK
Resolving openreview.net (openreview.net)... 35.184.86.251
Connecting to openreview.net (openreview.net)|35.184.86.251|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1168720 (1.1M) [application/pdf]
Saving to: ‘dataset/longlora.pdf’
dataset/longlora.pd 100%[===================>] 1.11M 1.26MB/s in 0.9s
2024-05-11 17:10:30 (1.26 MB/s) - ‘dataset/longlora.pdf’ saved [1168720/1168720]
--2024-05-11 17:10:31-- https://openreview.net/pdf?id=LzPWWPAdY4
Resolving openreview.net (openreview.net)... 35.184.86.251
Connecting to openreview.net (openreview.net)|35.184.86.251|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 366134 (358K) [application/pdf]
Saving to: ‘dataset/loftq.pdf’
dataset/loftq.pdf 100%[===================>] 357.55K 658KB/s in 0.5s
2024-05-11 17:10:32 (658 KB/s) - ‘dataset/loftq.pdf’ saved [366134/366134]
--2024-05-11 17:10:32-- https://openreview.net/pdf?id=VTF8yNQM66
Resolving openreview.net (openreview.net)... 35.184.86.251
Connecting to openreview.net (openreview.net)|35.184.86.251|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2680380 (2.6M) [application/pdf]
Saving to: ‘dataset/swebench.pdf’
dataset/swebench.pd 100%[===================>] 2.56M 2.39MB/s in 1.1s
2024-05-11 17:10:34 (2.39 MB/s) - ‘dataset/swebench.pdf’ saved [2680380/2680380]
--2024-05-11 17:10:35-- https://openreview.net/pdf?id=hSyW5go0v8
Resolving openreview.net (openreview.net)... 35.184.86.251
Connecting to openreview.net (openreview.net)|35.184.86.251|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1244749 (1.2M) [application/pdf]
Saving to: ‘dataset/selfrag.pdf’
dataset/selfrag.pdf 100%[===================>] 1.19M 1.33MB/s in 0.9s
2024-05-11 17:10:37 (1.33 MB/s) - ‘dataset/selfrag.pdf’ saved [1244749/1244749]
--2024-05-11 17:10:37-- https://openreview.net/pdf?id=9WD9KwssyT
Resolving openreview.net (openreview.net)... 35.184.86.251
Connecting to openreview.net (openreview.net)|35.184.86.251|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 511626 (500K) [application/pdf]
Saving to: ‘dataset/zipformer.pdf’
dataset/zipformer.p 100%[===================>] 499.63K 708KB/s in 0.7s
2024-05-11 17:10:38 (708 KB/s) - ‘dataset/zipformer.pdf’ saved [511626/511626]
--2024-05-11 17:10:39-- https://openreview.net/pdf?id=yV6fD7LYkF
Resolving openreview.net (openreview.net)... 35.184.86.251
Connecting to openreview.net (openreview.net)|35.184.86.251|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4171982 (4.0M) [application/pdf]
Saving to: ‘dataset/values.pdf’
dataset/values.pdf 100%[===================>] 3.98M 3.22MB/s in 1.2s
2024-05-11 17:10:41 (3.22 MB/s) - ‘dataset/values.pdf’ saved [4171982/4171982]
--2024-05-11 17:10:41-- https://openreview.net/pdf?id=hnrB5YHoYu
Resolving openreview.net (openreview.net)... 35.184.86.251
Connecting to openreview.net (openreview.net)|35.184.86.251|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 34710410 (33M) [application/pdf]
Saving to: ‘dataset/finetune_fair_diffusion.pdf’
dataset/finetune_fa 100%[===================>] 33.10M 11.1MB/s in 3.0s
2024-05-11 17:10:45 (11.1 MB/s) - ‘dataset/finetune_fair_diffusion.pdf’ saved [34710410/34710410]
--2024-05-11 17:10:45-- https://openreview.net/pdf?id=WbWtOYIzIK
Resolving openreview.net (openreview.net)... 35.184.86.251
Connecting to openreview.net (openreview.net)|35.184.86.251|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 877083 (857K) [application/pdf]
Saving to: ‘dataset/knowledge_card.pdf’
dataset/knowledge_c 100%[===================>] 856.53K 1.10MB/s in 0.8s
2024-05-11 17:10:47 (1.10 MB/s) - ‘dataset/knowledge_card.pdf’ saved [877083/877083]
--2024-05-11 17:10:47-- https://openreview.net/pdf?id=c5pwL0Soay
Resolving openreview.net (openreview.net)... 35.184.86.251
Connecting to openreview.net (openreview.net)|35.184.86.251|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 4775879 (4.6M) [application/pdf]
Saving to: ‘dataset/metra.pdf’
dataset/metra.pdf 100%[===================>] 4.55M 3.68MB/s in 1.2s
2024-05-11 17:10:49 (3.68 MB/s) - ‘dataset/metra.pdf’ saved [4775879/4775879]
--2024-05-11 17:10:50-- https://openreview.net/pdf?id=TpD2aG1h0D
Resolving openreview.net (openreview.net)... 35.184.86.251
Connecting to openreview.net (openreview.net)|35.184.86.251|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 1973959 (1.9M) [application/pdf]
Saving to: ‘dataset/vr_mcl.pdf’
dataset/vr_mcl.pdf 100%[===================>] 1.88M 1.74MB/s in 1.1s
2024-05-11 17:10:52 (1.74 MB/s) - ‘dataset/vr_mcl.pdf’ saved [1973959/1973959]
from pathlib import Path
paper_to_tools_dict = {}
for paper in papers:
print(f"Getting tools for paper: {paper}")
vector_tool, summary_tool = get_doc_tools(paper, Path(paper).stem)
paper_to_tools_dict[paper] = [vector_tool, summary_tool]
Getting tools for paper: dataset/metagpt.pdf
Getting tools for paper: dataset/longlora.pdf
Getting tools for paper: dataset/loftq.pdf
Getting tools for paper: dataset/swebench.pdf
Getting tools for paper: dataset/selfrag.pdf
Getting tools for paper: dataset/zipformer.pdf
Getting tools for paper: dataset/values.pdf
Getting tools for paper: dataset/finetune_fair_diffusion.pdf
Getting tools for paper: dataset/knowledge_card.pdf
Getting tools for paper: dataset/metra.pdf
Getting tools for paper: dataset/vr_mcl.pdf
all_tools = [t for paper in papers for t in paper_to_tools_dict[paper]]
# define an "object" index and retriever over these tools
from llama_index.core import VectorStoreIndex
from llama_index.core.objects import ObjectIndex
obj_index = ObjectIndex.from_objects(
all_tools,
index_cls=VectorStoreIndex,
)
obj_retriever = obj_index.as_retriever(similarity_top_k=3)
tools = obj_retriever.retrieve(
"MetaGPT 및 SWE-Bench에 사용된 평가 데이터 세트를 알려줄래?"
)
tools[2].metadata
ToolMetadata(description='Useful for summarization questions related to swebench', name='summary_tool_swebench', fn_schema=<class 'llama_index.core.tools.types.DefaultToolFnSchema'>, return_direct=False)
from llama_index.core.agent import FunctionCallingAgentWorker
from llama_index.core.agent import AgentRunner
agent_worker = FunctionCallingAgentWorker.from_tools(
tool_retriever=obj_retriever,
llm=llm,
system_prompt=""" \
You are an agent designed to answer queries over a set of given papers.
Please always use the tools provided to answer a question. Do not rely on prior knowledge.\
""",
verbose=True
)
agent = AgentRunner(agent_worker)
response = agent.query(
"사용된 평가 데이터 세트에 대해 알려줄래?"
"MetaGPT에 사용된 평가 데이터에 대해 알려주고, SWE-Bench와 비교해줘."
)
print(str(response))
Added user message to memory: 사용된 평가 데이터 세트에 대해 알려줄래?MetaGPT에 사용된 평가 데이터에 대해 알려주고, SWE-Bench와 비교해줘.
=== Calling Function ===
Calling function: summary_tool_metagpt with args: {"input": "\ud3c9\uac00 \ub370\uc774\ud130 \uc138\ud2b8\uc5d0 \ub300\ud55c \uc815\ubcf4\ub97c \uc81c\uacf5\ud574\uc8fc\uc138\uc694."}
=== Function Output ===
평가 데이터 세트에는 HumanEval, MBPP, 그리고 자체 생성된 SoftwareDev 데이터 세트가 포함되어 있습니다. HumanEval은 164개의 손으로 쓴 프로그래밍 작업으로 구성되어 있고, MBPP는 427개의 Python 작업으로 이루어져 있습니다. SoftwareDev 데이터 세트에는 미니게임, 이미지 처리 알고리즘, 데이터 시각화 등 다양한 범위를 포함하는 70가지 대표적인 소프트웨어 개발 작업이 포함되어 있습니다. HumanEval과 MBPP의 평가 메트릭은 기능적 정확도에 대한 Pass @ k를 포함하고, SoftwareDev 평가는 실행 가능성, 비용 (실행 시간, 토큰 사용량, 비용), 코드 통계 (코드 파일, 파일당 코드 라인 수, 총 코드 라인), 생산성, 그리고 인간의 수정 비용과 같은 메트릭을 포함합니다.
=== Calling Function ===
Calling function: summary_tool_swebench with args: {"input": "SWE-Bench\uc5d0 \uc0ac\uc6a9\ub41c \ud3c9\uac00 \ub370\uc774\ud130 \uc138\ud2b8\uc5d0 \ub300\ud574 \uc54c\ub824\uc8fc\uc138\uc694."}
=== Function Output ===
The evaluation dataset used in SWE-Bench consists of task instances extracted from popular Python repositories, focusing on software engineering issues found in GitHub issues and corresponding pull request solutions. It includes 2,294 unique software engineering problems from 12 popular Python repositories, requiring complex edits such as modifying multiple files simultaneously or editing multiple functions and classes. The dataset is continuously updated to add new instances and is evaluated using an execution-based framework. Task instances are validated through an execution-based validation process, ensuring usability and fairness for model evaluation. The dataset is open-source, collected from public repositories with permissible licenses, and does not involve collecting information on GitHub users beyond what is available through public APIs and websites. The dataset is filtered based on popular GitHub repositories without arbitrary or biased heuristics. Additionally, the dataset includes task instances that cover various types of tasks beyond bug fixes, with an average of 19.9 F2P tests, 171.3 P2P tests, and a total of 191.2 tests per individual task instance.
=== LLM Response ===
MetaGPT에 사용된 평가 데이터 세트에는 HumanEval, MBPP, 그리고 소프트웨어 개발 데이터가 포함되어 있습니다. HumanEval은 164개의 문장을 생성하는 작업을 포함하고 있으며, MBPP는 427개의 Python 프로그램을 생성하는 작업을 포함하고 있습니다. 소프트웨어 개발 데이터 세트에는 다양한 소프트웨어 엔지니어링 문제, 코드 수정 및 실행 시간 등을 포함하는 70가지 다양한 소프트웨어 개발 작업이 포함되어 있습니다.
SWE-Bench에 사용된 평가 데이터 세트는 인기 있는 Python 저장소에서 추출된 작업 인스턴스로 구성되어 있습니다. GitHub 이슈에서 발견된 소프트웨어 엔지니어링 문제와 해당 풀 리퀘스트 솔루션에 중점을 두고 있습니다. 이 데이터 세트에는 12개의 인기 Python 저장소에서 추출된 2,294개의 고유한 소프트웨어 엔지니어링 문제가 포함되어 있으며, 여러 파일을 동시에 수정하거나 여러 함수와 클래스를 편집하는 등 복잡한 편집이 필요합니다. 데이터 세트는 지속적으로 업데이트되어 새로운 인스턴스가 추가되며 실행 기반 프레임워크를 사용하여 평가됩니다. 작업 인스턴스는 실행 기반 검증 프로세스를 통해 유효성이 검증되어 모델 평가를 위한 사용성과 공정성을 보장합니다. 데이터 세트는 오픈 소스이며 허용 가능한 라이센스로 공개 저장소에서 수집되었으며 GitHub 사용자에 대한 정보 수집을 포함하지 않습니다. 데이터 세트는 임의 또는 편향된 휴리스틱을 기반으로 필터링되지 않은 인기 GitHub 저장소를 기반으로합니다. 또한 버그 수정을 넘어 다양한 유형의 작업을 다루는 작업 인스턴스가 포함되어 있으며, 개별 작업 인스턴스 당 평균 19.9 F2P 테스트, 171.3 P2P 테스트 및 총 191.2 테스트가 포함되어 있습니다.
assistant: MetaGPT에 사용된 평가 데이터 세트에는 HumanEval, MBPP, 그리고 소프트웨어 개발 데이터가 포함되어 있습니다. HumanEval은 164개의 문장을 생성하는 작업을 포함하고 있으며, MBPP는 427개의 Python 프로그램을 생성하는 작업을 포함하고 있습니다. 소프트웨어 개발 데이터 세트에는 다양한 소프트웨어 엔지니어링 문제, 코드 수정 및 실행 시간 등을 포함하는 70가지 다양한 소프트웨어 개발 작업이 포함되어 있습니다.
SWE-Bench에 사용된 평가 데이터 세트는 인기 있는 Python 저장소에서 추출된 작업 인스턴스로 구성되어 있습니다. GitHub 이슈에서 발견된 소프트웨어 엔지니어링 문제와 해당 풀 리퀘스트 솔루션에 중점을 두고 있습니다. 이 데이터 세트에는 12개의 인기 Python 저장소에서 추출된 2,294개의 고유한 소프트웨어 엔지니어링 문제가 포함되어 있으며, 여러 파일을 동시에 수정하거나 여러 함수와 클래스를 편집하는 등 복잡한 편집이 필요합니다. 데이터 세트는 지속적으로 업데이트되어 새로운 인스턴스가 추가되며 실행 기반 프레임워크를 사용하여 평가됩니다. 작업 인스턴스는 실행 기반 검증 프로세스를 통해 유효성이 검증되어 모델 평가를 위한 사용성과 공정성을 보장합니다. 데이터 세트는 오픈 소스이며 허용 가능한 라이센스로 공개 저장소에서 수집되었으며 GitHub 사용자에 대한 정보 수집을 포함하지 않습니다. 데이터 세트는 임의 또는 편향된 휴리스틱을 기반으로 필터링되지 않은 인기 GitHub 저장소를 기반으로합니다. 또한 버그 수정을 넘어 다양한 유형의 작업을 다루는 작업 인스턴스가 포함되어 있으며, 개별 작업 인스턴스 당 평균 19.9 F2P 테스트, 171.3 P2P 테스트 및 총 191.2 테스트가 포함되어 있습니다.
response = agent.query(
"LoRA 논문(LongLoRA, LoftQ)을 비교하고 대조해줄래?"
"각 논문의 접근 방식을 먼저 분석해줘."
)
Added user message to memory: LoRA 논문(LongLoRA, LoftQ)을 비교하고 대조해줄래?각 논문의 접근 방식을 먼저 분석해줘.
=== Calling Function ===
Calling function: summary_tool_longlora with args: {"input": "Approach of LongLoRA"}
=== Function Output ===
The approach of LongLoRA involves efficiently extending the context sizes of pre-trained large language models (LLMs) by utilizing shifted sparse attention (S2-Attn) during fine-tuning. This method allows for the approximation of long context during training by splitting the context length into groups and conducting attention within each group individually. By shifting tokens between groups and ensuring information flow, S2-Attn enables the extension of context lengths with reduced computational costs. Additionally, LongLoRA combines this efficient attention mechanism with trainable embedding and normalization layers, which are crucial for successful fine-tuning of LLMs to longer contexts.
=== Calling Function ===
Calling function: summary_tool_loftq with args: {"input": "Approach of LoftQ"}
=== Function Output ===
The approach of LoftQ involves alternately applying quantization and singular value decomposition (SVD) to approximate the original high-precision pre-trained weights. This framework optimizes the initial values of the quantized backbone and low-rank adapters jointly, providing a beneficial initialization for LoRA fine-tuning. By integrating low-rank approximation with quantization, LoftQ aims to mitigate the quantization discrepancy observed in other methods and significantly enhance generalization in downstream tasks.
=== LLM Response ===
LongLoRA의 방법론은 사전 훈련된 대형 언어 모델(LLM)의 컨텍스트 크기를 효율적으로 확장하는 것을 중점으로 합니다. 이는 feine-tuning 중에 shifted sparse attention (S2-Attn)을 활용하여 장기 컨텍스트를 근사화하는 방식을 포함합니다. S2-Attn은 컨텍스트 길이를 그룹으로 분할하고 각 그룹 내에서 개별적으로 attention을 수행하여 훈련 중에 장기 컨텍스트를 근사화할 수 있도록 합니다. 토큰을 그룹 간에 이동시키고 정보 흐름을 보장함으로써, S2-Attn은 계산 비용을 줄이면서 컨텍스트 길이를 확장할 수 있게 합니다. 또한, LongLoRA는 훈련 가능한 임베딩 및 정규화 레이어와 함께 이 효율적인 attention 메커니즘을 결합하는데, 이는 LLM을 더 긴 컨텍스트에 성공적으로 fine-tuning하기 위해 중요합니다.
LoftQ의 방법론은 양자화와 특이값 분해(SVD)를 번갈아 적용하여 원래의 고정밀 사전 훈련 가중치를 근사하는 것을 중점으로 합니다. 이 프레임워크는 양자화 백본과 저랭크 어댑터의 초기값을 최적화하여 LoRA fine-tuning에 유용한 초기화를 제공합니다. 저랭크 근사와 양자화를 통합함으로써, LoftQ는 다른 방법에서 관찰된 양자화 불일치를 완화하고 하류 작업에서 일반화를 크게 향상시키려고 합니다.