Coder Social home page Coder Social logo

lmql-tree-of-thoughts's Introduction

Tree of thoughts

A LMQL implementation of something like tree of thoughts. Applies a natural selection process to steer reasoning and constrain the results.

Many many improvements to be made.

Features

I meant this to be as "engineerable" as possible. Each tree instance is configured to solve a specific problem, and be used as a function. It can apply a callback function to the result so it doesn't necessarily have to return text.

Some of the main features:

  • Asynchronous
  • Configurable
  • Prompt-based and programmatic result validation

Some planned features:

  • Multiple arguments and argument types
  • Feature weighting: option to assign relative importance to selection criteria
  • Dynamic width: method for determining how many branches should stem from each thought

How it works

Each iteration consists of a review phase, a generation phase, an evaluation phase.

  • Selection: The top-k scoring lines of thought are selected
  • Review: Selected lines of thought are checked to see if they contain an answer.
  • Generation: A fixed number of branching thoughts are generate from selected leaf thoughts. If a selected leaf contains an answer, a conclusion is generated instead.
  • Evaluation: New thoughts are scored against defined criteria to determine the relative strength of the threads. If any conclusions were generated, they are validated and returned if they pass.

Usage

For now see the examples folder to get a sense of it. In a nutshell there's three configurations: one for the initial prompt, one that governs the reasoning dynamics (evaluation, answer recognition), and one that describes how answer attempts are handled (conclusion generation, callbacks, validation).

lmql-tree-of-thoughts's People

Contributors

gitjournalapp avatar lachlangray 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.