Giter VIP home page Giter VIP logo

scm4llms's Introduction

Unleashing Infinite-Length Input Capacity for Large-scale Language Models with Self-Controlled Memory System

This is the official repository for the paper "Unleashing Infinite-Length Input Capacity for Large-scale Language Models with Self-Controlled Memory System". In this paper, we introduce the Self-Controlled Memory (SCM) system to unleash infinite-length input capacity for large-scale language models. Our SCM system is composed of three key modules: the language model agent, the memory stream, and the memory controller.

๐Ÿ”ฅ Updates

  • [2023-12-14] Newest version of the paper is released. Check it out in SCM_Paper_Draft.pdf!
  • [2023-4-26] We released our first version paper, codes. Check it out!

๐ŸŒŸ Overview

Our SCM system can be integrated with any LLMs to enable them to process ultra-long texts without any modification or fine-tuning.

Supported Tasks

Tasks Status
Long-Term Dialogue โœ… Supported
Ultra-long Book Summarization โœ… Supported
Ultra-long Meeting Summarization โœ… Supported

โšก๏ธ Usage

config

In config directory, copy apikey.txt.template to apikey.txt, put your openai apikey in it, support multiple keys. This file is ignored to protect privacy.

Note: If the ChatGPT service is unavailable in your area, please utilize proxy settings. Copy config\api_config.template.json to config\api_config.json and config http_proxy as you like.

Requirements

The key requirements are as below:

  • python 3.8+
  • openai 0.27.0+
  • gradio 3.27.0+

Use conda to create environment.

conda create -n scm python=3.8 -y
conda activate scm

You can install the requirements by running:

pip install -r requirements.txt

Run

Default agent model use text-davinci-003.

You can specify model by --model_name, current support model list:

  • text-davinci-003
  • gpt-3.5-turbo

๐Ÿ‘ปLong-Term Dialogue

Run this command, chat with model. Chat logs are recorded in logs\log.txt.

python dialogue_demo.py

Functional command during dialogue, these operations will be silently done, you can see them in the log output:

  • reset or ๆธ…็ฉบ: clear dialogue history.
  • export or ๅฏผๅ‡บ: save the dialogue history to files.
  • roll back or ๅ›žๆปš: pop previous turn dialogue.

๐Ÿ“šUltra-long Book Summarization

Take the shortest book The Old Man and the Sea, whose content cost 34k tokens, as a demo example:

python book_summary.py   --book_files data/book/EnglishBook/The_Old_Man_and_the_Sea.txt

๐Ÿ“Ultra-long Meeting Summarization

Take the blockchain meeting as example, whose content cost 37k tokens, as a demo example:

python meeting_summary.py --meeting_ids 26231372_ๅŒบๅ—้“พๆŠ€ๆœฏ็š„ๅบ”็”จๅ‰ๆ™ฏ

๐Ÿ“ Evaluation Dataset

Data files are in data folder.

Dialogue Book Meeting
#Instances 18 10 20
Max tokens 34k 2M 50k
Total tokens 420k 8M 632k
Max turn 200 - 80
Language En+Zh En+Zh Zh

Evaluation dataset statistics. 2M means 2 miillion token count.

๐Ÿ“Š Evaluation Results

More running records and summary details are zipped to history.zip. You can download it from Google Drive Link and Baidu Netdisk. call_embedding_history.json and call_func_history.json store the openai cache log and are zipped in logs.zip. You can download it from Google Drive Link and Baidu Netdisk.

โš ๏ธ Limitations & Risks

we will assess the efficacy of our system on more open-source models that possess single-turn instruction comprehension capability.

Our system has the capability to attach to any LLMs, which may be prone to factual errors, delusions, toxic language, and malicious responses. Consequently, we restrict the usage of our system to academic research purposes for now.

๐Ÿ’ฌ Citation

If you find our work is helpful, please cite as:

@article{liang2023unleashing,
      title={Unleashing Infinite-Length Input Capacity for Large-scale Language Models with Self-Controlled Memory System}, 
      author={Xinnian Liang and Bing Wang and Hui Huang and Shuangzhi Wu and Peihao Wu and Lu Lu and Zejun Ma and Zhoujun Li},
      year={2023},
      eprint={2304.13343}
}

๐Ÿ‘ Contributing

We welcome contributions and suggestions!

scm4llms's People

Contributors

wbbeyourself avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.