Skip to main content

A Python library for inference-time scaling LLMs

Project description

its-hub: A Python library for inference-time scaling

Tests codecov PyPI version

its_hub is a Python library for inference-time scaling of LLMs, focusing on mathematical reasoning tasks.

📚 Documentation

For comprehensive documentation, including installation guides, tutorials, and API reference, visit:

https://ai-innovation.team/its_hub

Quick Start

from its_hub.utils import SAL_STEP_BY_STEP_SYSTEM_PROMPT
from its_hub.lms import OpenAICompatibleLanguageModel, StepGeneration
from its_hub.algorithms import ParticleFiltering
from its_hub.integration.reward_hub import LocalVllmProcessRewardModel

# Initialize language model (requires vLLM server)
lm = OpenAICompatibleLanguageModel(
    endpoint="http://localhost:8000/v1", 
    api_key="NO_API_KEY", 
    model_name="Qwen/Qwen2.5-Math-1.5B-Instruct", 
    system_prompt=SAL_STEP_BY_STEP_SYSTEM_PROMPT, 
)

# Set up inference-time scaling
sg = StepGeneration("\n\n", 32, r"\boxed")
prm = LocalVllmProcessRewardModel(
    model_name="Qwen/Qwen2.5-Math-PRM-7B", 
    device="cuda:0", 
    aggregation_method="prod"
)
scaling_alg = ParticleFiltering(sg, prm)

# Solve with inference-time scaling
result = scaling_alg.infer(lm, "Solve x^2 + 5x + 6 = 0", budget=8)

Installation

# Production
pip install its_hub

# Development
git clone https://github.com/Red-Hat-AI-Innovation-Team/its_hub.git
cd its_hub
pip install -e ".[dev]"

Key Features

  • 🔬 Multiple Algorithms: Particle Filtering, Best-of-N, Beam Search, Self-Consistency
  • 🚀 OpenAI-Compatible API: Easy integration with existing applications
  • 🧮 Math-Optimized: Built for mathematical reasoning with specialized prompts
  • 📊 Benchmarking Tools: Compare algorithms on MATH500 and AIME-2024 datasets
  • Async Support: Concurrent generation with limits and error handling

Development

git clone https://github.com/Red-Hat-AI-Innovation-Team/its_hub.git
cd its_hub
pip install -e ".[dev]"
pytest tests

For detailed documentation, visit: https://ai-innovation.team/its_hub

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

its_hub-0.2.1a2.tar.gz (63.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

its_hub-0.2.1a2-py3-none-any.whl (26.1 kB view details)

Uploaded Python 3

File details

Details for the file its_hub-0.2.1a2.tar.gz.

File metadata

  • Download URL: its_hub-0.2.1a2.tar.gz
  • Upload date:
  • Size: 63.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for its_hub-0.2.1a2.tar.gz
Algorithm Hash digest
SHA256 af45f9f030eee724acedaf6b7db06ecf781d1e9368fce9de32a33d35aeb5906f
MD5 997421e77153499c48f05d11a4ae37f6
BLAKE2b-256 4168b3958080744b658f6f5ad48ee939da3a1864a6eab77dc0cbf4a4d41f4ecb

See more details on using hashes here.

Provenance

The following attestation bundles were made for its_hub-0.2.1a2.tar.gz:

Publisher: release.yaml on Red-Hat-AI-Innovation-Team/its_hub

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file its_hub-0.2.1a2-py3-none-any.whl.

File metadata

  • Download URL: its_hub-0.2.1a2-py3-none-any.whl
  • Upload date:
  • Size: 26.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for its_hub-0.2.1a2-py3-none-any.whl
Algorithm Hash digest
SHA256 ce90d9883336f7450e4ca406baa50bf7f08bff3ad2a75fd491df5f5ac4ae507c
MD5 9d4c168bf9ad08db4f98367c73c41d72
BLAKE2b-256 d4689e2ef88200d1baa13f56b9f60fccdb85b9f386441fdeb881f7a2efdd0b37

See more details on using hashes here.

Provenance

The following attestation bundles were made for its_hub-0.2.1a2-py3-none-any.whl:

Publisher: release.yaml on Red-Hat-AI-Innovation-Team/its_hub

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page