Confident Solver enables you to solve problems confidently and efficiently by leveraging Large Language Models (LLMs) enhanced with robust statistical approaches, such as the SPRT
Project description
🎮 ConSol: Confident Solver
ConSol enables you to solve problems confidently and efficiently by leveraging Large Language Models (LLMs) enhanced with robust statistical approaches, such as the Sequential Probability Ratio Test (SPRT).
🚀 Quick Start
Installation
Install ConSol directly from PyPI:
pip install consol
Command Line Usage
Solve a problem using ConSol via the CLI:
$ consol --prompt "1 + 1 = ?"
2
SDK Usage
Integrate ConSol into your Python applications:
from consol import ConfidentSolver
# Initialize ConSol with custom parameters
consol = ConfidentSolver(
llm_model="gpt-4o-mini", # Supported models: "gpt-4o-mini", "o3-mini-low", etc.
confidence_model="pvalue", # Options: "msprt", "sprt", "pvalue", "bayesian_posterior", "vote40", "vote1"
output_schema="float" # Output formats: "abce", "float", etc.
)
# Invoke ConSol to solve a problem
answer = consol.invoke("1 + 1 = ?")
print(answer)
# Output: 2
🔍 About ConSol
ConSol is an innovative framework designed for precise and cost-effective problem-solving. It integrates statistical validation with LLMs to significantly enhance accuracy and efficiency, especially for mathematical computations and reasoning tasks.
Key Benefits
-
🚩 Higher Accuracy: ConSol improves OpenAI's o3-mini-low and o3-mini-medium performance on the AIME24 Benchmark by 10-17 percentage points—boosting accuracy from 60% to 70% (o3-mini-low) and 73% to 90% (o3-mini-medium).
-
💰 Cost Efficiency: ConSol reduces the number of output tokens generated by OpenAI's GPT-o3-mini models on the AIME24 Benchmark by 63.9%–84.8%, directly lowering computational and monetary costs.
For a comprehensive understanding and detailed methodology, please refer to our research publication.
Example
Accuracy
Without ConSol
$ consol --confidence_model vote1 --llm_model gpt-4o-mini --prompt "Jen enters a lottery by picking \$4\$ distinct numbers from \$S=\\{1,2,3,\\cdots,9,10\\}.\$ \$4\$ numbers are randomly chosen from \$S.\$ She wins a prize if at least two of her numbers were \$2\$ of the randomly chosen numbers, and wins the grand prize if all four of her numbers were the randomly chosen numbers. The probability of her winning the grand prize given that she won a prize is \$\\tfrac{m}{n}\$ where \$m\$ and \$n\$ are relatively prime positive integers. Find \$m+n\$."
# or simply consol --confidence_model vote1
# => 11.0
The result always changes whenever you re-run.
With ConSol
consol --confidence_model msprt --llm_model gpt-4o-mini --prompt "Jen enters a lottery by picking \$4\$ distinct numbers from \$S=\\{1,2,3,\\cdots,9,10\\}.\$ \$4\$ numbers are randomly chosen from \$S.\$ She wins a prize if at least two of her numbers were \$2\$ of the randomly chosen numbers, and wins the grand prize if all four of her numbers were the randomly chosen numbers. The probability of her winning the grand prize given that she won a prize is \$\\tfrac{m}{n}\$ where \$m\$ and \$n\$ are relatively prime positive integers. Find \$m+n\$."
# or simply consol
# => 116.0 (Always)
Typically it stops at 20-100 samples until finding consistency.
Efficiecny
With Prior Method (Ada-Cons)
$ consol --confidence_model bayesian_posterior --prompt "random integer between 0 to 20"
# => Random Number
Typically it stops at 40 trials, hitting the max trials
With Our Method (mixture SPRT)
consol --confidence_model msprt --prompt "random integer between 0 to 20"
# => Random Number
Typically it stops at 10 to 30 trials.
Verbose Output for Debugging
$ consol --debug
,answer,token_usage
0,116.0,484
1,47.0,81
2,11.0,69
3,116.0,483
4,37.0,337
5,7.0,221
6,3.0,168
7,37.0,116
8,116.0,585
9,21.0,114
10,9.0,156
11,49.0,67
12,19.0,165
13,20.0,81
14,22.0,222
15,116.0,514
16,145.0,117
17,49.0,97
18,15.0,135
19,116.0,427
The output shows the result as a table.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file consol-0.3.0.tar.gz.
File metadata
- Download URL: consol-0.3.0.tar.gz
- Upload date:
- Size: 9.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
36423d6063b19ae7f89ae95e119e3086f3131edb539587e8109bdc419f6ae53e
|
|
| MD5 |
bffa6347f25326f1ca832ebf55cf4907
|
|
| BLAKE2b-256 |
3b6e5b8006d47fc6ce0a99d10582b2891d3f5af9ab903d2dd1c495916f913a4d
|
File details
Details for the file consol-0.3.0-py3-none-any.whl.
File metadata
- Download URL: consol-0.3.0-py3-none-any.whl
- Upload date:
- Size: 8.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.11.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f8d8c5ec321624737e43502505b6943d04ab45c5eb9ad98c6186955a08c0b35c
|
|
| MD5 |
c9b7a2284f096d2c34ca25144ef04645
|
|
| BLAKE2b-256 |
7d1667584225a135ac023bf9db4117f87f1c2de8d74fd86ed6c0801a5e29a024
|