Giter Site home page Giter Site logo

kyegomez / algorithm-of-thoughts Goto Github PK

View Code? Open in Web Editor NEW
75.0 2.0 15.0 301 KB

My implementation of "Algorithm of Thoughts: Enhancing Exploration of Ideas in Large Language Models"

Home Page: https://apac.ai/agora

License: MIT License

Python 100.00%
artificial-intelligence gpt4 gpt4-api gpt4all prompt-engineering swarms transformer-architecture transformer-models ai-reasoning

algorithm-of-thoughts's Introduction

Multi-Modality

Algorithm-Of-Thoughts

Discord Twitter LinkedIn Facebook Reddit Hacker News Pinterest WhatsApp

AOT BANNER The open source implementation of "Algorithm of Thoughts: Enhancing Exploration of Ideas in Large Language Models" that increases model reasoning by nearly 80% or 10% more than Tree of thoughts!

Algorithm of Thoughts: Enhancing Exploration of Ideas in Large Language Models

Installation

pip install aot-x

Usage

from aot.main import AoT

task = """

Use numbers and basic arithmetic operations (+ - * /) to obtain 24. When
considering the next steps, do not choose operations that will result in a
negative or fractional number. In order to help with the calculations, the
numbers in the parenthesis represent the numbers that are left after the
operations and they are in descending order.
Another thing we do is when there are only two numbers left in the parenthesis, we
check whether we can arrive at 24 only by using basic arithmetic operations
(+ - * /). Some examples regarding this idea:
(21 2) no
since 21 + 2 = 23, 21 - 2 = 19, 21 * 2 = 42, 21 / 2 = 10.5, none of which is equal
to 24.
(30 6) 30 - 6 = 24 yes
(8 3) 8 * 3 = 24 yes
(12 8) no
(48 2) 48 / 2 = 24 yes
Most importantly, do not give up, all the numbers that will be given has indeed a
solution.

14 8 8 2

OBJECTIVE
#########
5 10 5 2
"""


dfs = AoT(
    num_thoughts=2,
    max_steps=10, 
    value_threshold=1,
    initial_prompt=task,
    openai_api_key="ENETER IN YOUR API KEY"
)

result = dfs.solve()
print(result)

Todo

  • All thoughts over 0.5 are added to cache or longterm vectorstore
  • DFS search similiar to Algorithm of thoughts
  • Propose solutions function
  • Backtrack to nearest successful states
  • Implement evaluation strategy similiar to tot with [0.0, 1.0]
  • Working demo: Conducts search then backtracks through states, provide visuals green text
  • Streamlit demo

Citation

@misc{2308.10379,
Author = {Bilgehan Sel and Ahmad Al-Tawaha and Vanshaj Khattar and Lu Wang and Ruoxi Jia and Ming Jin},
Title = {Algorithm of Thoughts: Enhancing Exploration of Ideas in Large Language Models},
Year = {2023},

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.