AutoGPT 알아보기

AutoGPT

Introduction

AutoGPT(Autonomous GPT)는 이름에서 알 수 있듯이 ChatGPT를 자동으로 사용할 수 도와주는 파이썬 어플리케이션입니다. 기존 ChatGPT는 인간이 prompt를 계속 작성하면서 결과물을 만들어냈습니다. 하지만 AutoGPT는 이런 prompt도 스스로 작성해서 처음에 작성한 목적을 향해 계속 달려가면서 돌아가게 되어있습니다. 인간의 개입을 거의 최소화하고 스스로 자율적으로 결과를 뽑아내게 도와준다고 보시면 됩니다. “제주도 여행책자 만들기”를 목표로 차이점을 볼까요?

  • ChatGPT
    1. 제주도를 여행하고 싶다는 내용의 prompt 입력
    2. Output을 기반으로 필요한 정보를 사람이 추가 입력
    3. 다시 새로운 결과물을 직접 보고 수정… 반복
    4. 결과물 완성
  • AutoGPT
    1. “제주도 여행책자 만들기” 목표 설정
    2. 각 단계마다 thought, reasoning, plan, criticism 네 가지 항목을 작성하고 다음 process 진행 및 해당 과정 반복
    3. 결과물 완성

어떻게 이런 일이 가능할까요? 일단 AutoGPT 에서는 여러 개의 에이전트를 구분해 놓고 각자 다른 명령어를 내리는 구조로 되어 있습니다. 하나의 에이전트에는 검색 결과를 작성하고, 다른 에이전트는 타 에이전트가 수행한 일을 평가하고, 다른 에이전트는 또 다른 업무를 수행하고.. 이런식으로 조금씩 목적을 향해 작동하는 구조로 되어 있습니다. 벡터DB를 사용하여 방대한 데이터를 효과적으로 long-term, short-term 메모리에 저장도 가능합니다. 또한 구글 검색 API, 트위터 API 등 다양한 API key를 입력해두면 모델이 스스로 해당 api를 사용하여 최적화된 결과물을 뽑아냅니다. 심지어 이미지와 관련된 stable diffusion 등과 같은 모델도 활용이 가능합니다.

현재 AutoGPT는 개발자들 사이에서 엄청난 관심을 끌고 있습니다. Github 역사상(?) 최단 시간 내에 최다 star 수를 달성했으며 지금도 계속 실시간으로 오르고 있습니다. 실제로 사용해보면 엄청난 사용성에 왜 이렇게 인기를 끄는지 알 수 있게 되실 겁니다.

AutoGPT 살펴보기

사용법

사용법은 매우 간단합니다. 기존 파이썬 코드에서 ‘import’해오는 것과는 다르게 AutoGPT는 하나의 어플리케이션입니다. 따라서 github에서 stable 버전을 clone 해오면 쉽게 가져올 수 있습니다.

https://github.com/Significant-Gravitas

트위터, 구글 API 키 등을 설정하는 방법은 공식 문서를 참고하면 됩니다!

처음 AutoGPT를 설정하면 아래와 같이 무엇을 해야할지 목적을 정해주면 됩니다. 저 같은 경우는 유튜브에서 가장 조회수가 높을 수 있는 영상을 만들어 달라고 명령어를 입력했습니다.

I want Auto-GPT to: make a video with the most views on YouTube
VOGPT  has been created with the following details:
Name:  VOGPT
Role:  an AI video optimizer that helps content creators maximize their video's potential by providing expert guidance on video creation, optimization, and promotion.
Goals:
-  Analyze the latest trends and algorithms to provide data-driven insights on video content creation and optimization to increase views and engagement.
-  Optimize video titles, descriptions, tags, and thumbnails to improve searchability and click-through rates.
-  Provide guidance on video length, format, and content to ensure maximum engagement and retention.
-  Identify and prioritize promotion strategies, including social media, influencer marketing, and paid advertising, to increase video visibility and reach.
-  Continuously monitor and analyze video performance to provide ongoing recommendations for improvement and optimization.
Using memory of type:  LocalCache
Using Browser:  chrome
 THOUGHTS:  I think the first step should be to analyze the latest trends and algorithms to provide data-driven insights on video content creation and optimization. This will help us understand what works and what doesn't in the current landscape.
REASONING:  By analyzing the latest trends and algorithms, we can gain insights into what types of videos are currently popular and what optimization strategies are working well. This will help us create and optimize our own videos to maximize views and engagement.
PLAN:
-  Use the 'browse_website' command to research the latest trends and algorithms in video content creation and optimization.
-  Analyze the data gathered to identify patterns and insights.
-  Use the insights to guide our video creation and optimization strategies.
CRITICISM:  I need to make sure that I am analyzing a wide range of sources to get a comprehensive understanding of the current landscape. I also need to be careful not to rely too heavily on any one source of information.
NEXT ACTION:  COMMAND = browse_website ARGUMENTS = {'url': 'https://www.tubics.com/blog/youtube-algorithm/', 'question': 'What are the latest trends and algorithms in video content creation and optimization?'}
  Enter 'y' to authorise command, 'y -N' to run N continuous commands, 's' to run self-feedback commands or 'n' to exit program, or enter feedback for ...
  Asking user via keyboard...
Input:y

구성 요소는 매우 간단합니다. 에이전트가 먼저 본인의 이름(?)을 짓고 해야 할 일과 목표에 대한 설정을 자동으로 설정합니다. 그리고 단계가 진행 될때마다 THOUGHTS, REASONING, PLAN, CRITICISM를 자동으로 계속 구성하게 됩니다. 위 실행 화면을 보면 유튜브에서 가장 조회수를 많게 하기 위해서 웹사이트를 검색해서 영상 컨텐츠 만들기에 대해 알아보겠다고 계획을 짜고 있습니다. Input 입력 부분에서 y를 입력하면 다음 단계로 넘어가게 됩니다. 만약 사용자가 어떤 피드백을 주고싶다면 y 대신 다른 명령어를 입력해도 됩니다. 예를 들어 “웹사이트를 검색하지 말고 다른 방법을 찾아”라고 입력하게 되면 AutoGPT는 이전에 계획했던 방식을 폐기하고 다른 방법을 찾게 됩니다.

-=-=-=-=-=-=-= COMMAND AUTHORISED BY USER -=-=-=-=-=-=-=
  Text length: 2486 characters
  Adding chunk 1 / 1 to memory
  Summarizing chunk 1 / 1 of length 2488 characters, or 2525 tokens
  Added chunk 1 summary to memory, of length 252 characters
  Summarized 1 chunks.
SYSTEM:  Command browse_website returned: Answer gathered from website: The text does not provide information on the latest video content trends. It discusses the use of Google Trends by various organizations and individuals and provides resources for understanding and utilizing Google Trends. Links: ['Trends (https://trends.google.com/home)', 'Trends (https://trends.google.com/home)', ' (https://www.google.co.kr/intl/ko/about/products)', '로그인 (https://accounts.google.com/ServiceLogin?passive=1209600&continue=https://trends.google.com/home&followup=https://trends.google.com/home&ec=GAZAgAU)', 'home홈 (https://trends.google.com/trends/home?geo=KR)']
 THOUGHTS:  Since the website did not provide the information we were looking for, I suggest we use GPT-3.5 powered agents to gather insights on the latest video content trends. We can also use these agents to analyze the data and provide recommendations for optimizing video content.
REASONING:  GPT-3.5 powered agents can be used to gather insights on the latest video content trends. These agents can analyze large amounts of data and provide recommendations for optimizing video content based on the latest trends and algorithms.
PLAN:
-  Use GPT-3.5 powered agents to gather insights on the latest video content trends
-  Analyze the data and provide recommendations for optimizing video content based on the latest trends and algorithms
-  Optimize video titles, descriptions, tags, and thumbnails to improve searchability and click-through rates
-  Provide guidance on video length, format, and content to ensure maximum engagement and retention
-  Identify and prioritize promotion strategies, including social media, influencer marketing, and paid advertising, to increase video visibility and reach
-  Continuously monitor and analyze video performance to provide ongoing recommendations for improvement and optimization
CRITICISM:  I need to make sure that I am using the most accurate and up-to-date data when analyzing trends and providing recommendations.
NEXT ACTION:  COMMAND = start_agent ARGUMENTS = {'name': 'VideoTrendAgent', 'task': 'Gather insights on the latest video content trends', 'prompt': 'What are the latest video content trends?'}
  Enter 'y' to authorise command, 'y -N' to run N continuous commands, 's' to run self-feedback commands or 'n' to exit program, or enter feedback for ...
  Asking user via keyboard...
Input:y

이런식으로 꼬리에 꼬리를 물고 계속 이어가게 되며 사용자가 만족한 결과가 나올 때가지 계속 진행할 수 있습니다. 긴 내용의 데이터가 들어가게 되면 벡터 DB를 사용해서 저장을 할 수도 있습니다. 기본적으로는 로컬 저장소에 json 캐시파일을 저장하며, 원한다면 설정에서 pinecone, redis, milvus, weaviate 중 하나를 사용하도록 변경하면 됩니다.

장점과 단점?

장점은 명확합니다.

  • 완전 자동화
    • 위에서도 언급한 가장 큰 장점 중 하나입니다. 하나의 목적만 입력하면 스스로 완전 자동화로 만족하는 결과물이 나올 때까지 작동이 가능합니다. 혼자로 생각하고 추론해서 사용자가 해야 할 일을 90% 이상 줄여줍니다.
  • 확장 가능성
    • 코드 작성, 디버깅, 시장 조사 등 정말 다양한 분야로 확장이 가능합니다. 사용자가 ChatGPT를 통해서 작성하는 것보다 모든 프로세스가 어느 정도 정형화 되어있는 AutoGPT를 사용했을 때 더 만족할만한 결과가 나올 수 있습니다.
  • 메모리
    • Long-term, Short-term 메모리를 효율적으로 활용해서 프로세스가 길어지더라도 효율적으로 정보를 잘 관리하고 저장할 수 있습니다. 추론 단계가 길어진다는건 prompt가 길다는 뜻이고 점점 모델이 정보를 잃는다는 뜻과 같습니다. 이를 벡터 DB등을 활용해서 보완이 가능합니다.

단점들은 이정도로 정리해볼 수 있겠습니다.

  • 비용 문제
    • 토큰 수에 따라 차이가 클 수 있지만 GPT-3.5 기준으로 한 시간에 약 1달러(?) 정도 발생합니다. 혹시나 오래 걸리는 작업이라면 상당히 많은 비용이 발생할 수도 있습니다. 만약 GPT-4를 사용하게 된다면 비용은 거의 10배 가까이 뛴다고 보면 되겠네요. (–gpt3only 명령어로 비용 절약이 가능합니다.)
  • 성능 문제
    • 일단 AutoGPT 자체가 출시한지 얼마 안된 어플리케이션인 만큼 복잡한 문제에선 성능 이슈가 생길 수 있습니다. 프로젝트가 멈추거나, 혼자 이상한 무한루프에 들어가서 제자리 걸음을 하고 있을 수도 있습니다.
  • 정확도 문제
    • 사실 ChatGPT도 같은 문제가 있긴 하지만, 생성 모델의 단점 중 하나라고 보면 됩니다. 특정 분야에서는 편향된 정보를 줄 수도 있으며 윤리적인 관점에서 잘못된 정보를 내줄 수도 있습니다.

정리하며

Langchain을 살펴봤을 때만 해도 이걸로 자동화된 툴을 만들 수 있지 않을까? 하는 생각을 어렴풋이 했었습니다. 근데 실제로 누군가가 이미 만들었고 세상에서 가장 핫한 github repo일줄은 생각도 못했네요.

사용하면 사용할수록 정말 기술의 발전이 너무 빠르다는 생각이 드는 툴이었습니다. 현재는 API Key를 따로 설정해야 하는 등 개발자가 아닌 일반인들이 사용하기에는 조금 어려움이 있기는 합니다만, 만약 OpenAI에서 자체적으로 AutoGPT를 ChatGPT처럼 쉽게 사용할 수 있는 UI로 제공한다면 누구나 사용할 수 있을 것으로 보입니다.

5년만 지난다면 널리 상용화된 툴을 가지고 내가 작성한 코드를 생성 AI만 가지고 완전히 디버깅이 가능하지 않을까 싶습니다. 지금 제가 작성하고 있는 블로그 글도 조만간 생성 AI로 글의 대부분을 작성할 수 있지 않을까요?

Reference