SwiftSage  by SwiftSage

Agent system for reasoning with LLMs via in-context reinforcement learning

created 2 years ago
311 stars

Top 86.3% on SourcePulse

GitHubView on GitHub
1 Expert Loves This Project
Project Summary

SwiftSage is a generative agent system designed for complex interactive reasoning tasks, mimicking human fast and slow thinking processes. It targets researchers and developers working with Large Language Models (LLMs) who need a flexible framework for enhancing LLM reasoning capabilities through in-context reinforcement learning. The system aims to improve LLM performance on tasks requiring planning, execution, and iterative refinement.

How It Works

SwiftSage v2 employs a "plan-ground-execute" paradigm, unifying task formats and using a Python executor for code-based solutions. It leverages in-context reinforcement learning, a tuning-free, prompting-based strategy, to adapt reasoning strategies. Feedback is generated by LLMs, acting as critics and reward signals to update the agent's approach. The system comprises a Swift Agent (smaller LM for intuitive reasoning), a Feedback Agent (larger LM for critique), and a Sage Agent (even larger LM for analytical thinking if the Swift Agent fails). The workflow involves the Swift Agent generating a plan and code, the executor running it, the Feedback Agent critiquing the output, and iterating or escalating to the Sage Agent if necessary.

Quick Start & Requirements

  • Install via pip: pip install git+https://github.com/SwiftSage/SwiftSage.git
  • Requires API keys for LLM providers (e.g., Together AI, Groq, SambaNova).
  • Environment variables for API keys and model IDs (e.g., TOGETHER_API_KEY, ENGINE, SWIFT_MODEL_ID, FEEDBACK_MODEL_ID, SAGE_MODEL_ID) must be set.
  • Example usage: swiftsage --problem "QUERY" --api_provider ${ENGINE} ...
  • Demo available: https://hf.co/spaces/swiftsage-ai/SwiftSage

Highlighted Details

  • Mimics human fast (intuitive) and slow (analytical) thinking.
  • Tuning-free, prompting-based in-context reinforcement learning.
  • Utilizes a Python executor for code-based problem-solving.
  • Iterative refinement loop with LLM-generated feedback.
  • Escalation path to a more powerful "Sage Agent" for complex tasks.

Maintenance & Community

  • Beta version (v2) is under active development; v1 code is available on the science_world branch.
  • Contact: Bill Yuchen Lin (email provided).
  • A retriever module is planned for future implementation.

Licensing & Compatibility

  • MIT License.
  • Compatible with commercial use and closed-source linking.

Limitations & Caveats

This is a beta version and may not be stable. The retriever module is not yet implemented, which is expected to further improve reasoning.

Health Check
Last commit

9 months ago

Responsiveness

Inactive

Pull Requests (30d)
0
Issues (30d)
0
Star History
0 stars in the last 30 days

Explore Similar Projects

Feedback? Help us improve.