SwiftSage  by SwiftSage

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

Created 2 years ago
315 stars

Top 85.6% 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

11 months ago

Responsiveness

Inactive

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

Explore Similar Projects

Starred by Jason Knight Jason Knight(Director AI Compilers at NVIDIA; Cofounder of OctoML), Tim J. Baek Tim J. Baek(Founder of Open WebUI), and
6 more.

awesome-o1 by srush

0.1%
1k
Bibliography for OpenAI's o1 project
Created 1 year ago
Updated 11 months ago
Starred by Eric Zhu Eric Zhu(Coauthor of AutoGen; Research Scientist at Microsoft Research) and Chip Huyen Chip Huyen(Author of "AI Engineering", "Designing Machine Learning Systems").

PromptWizard by microsoft

0.3%
4k
Agent-driven framework for task-aware prompt optimization
Created 1 year ago
Updated 2 weeks ago
Feedback? Help us improve.