External reasoning framework for LLMs. Cognitive drift + fieldmap knowledge injection. Qwen 7B +10% on HumanEval, zero training.
Project description
codeboost
External reasoning framework for LLMs. Zero training, zero fine-tuning. pip install and go.
Injects structured coding knowledge into any LLM prompt. Weak models gain the most — up to +19.5% on HumanEval.
Install
pip install codeboost
Quick Start
from codeboost import query
result = query("Find all pairs in sorted array that sum to target")
print(result.context) # inject this into your LLM prompt
Inject into any LLM
from openai import OpenAI
from codeboost import get_context
client = OpenAI()
context = get_context("binary search on rotated array")
response = client.chat.completions.create(
model="gpt-4o-mini",
messages=[
{"role": "system", "content": f"Use this knowledge:\n{context}"},
{"role": "user", "content": "Implement binary search on rotated sorted array"},
],
)
Works with any LLM: OpenAI, Anthropic, Ollama, Groq, DeepSeek, Gemini, Mistral...
How It Works
Five-stage pipeline:
- Gates — classify task into IPOD phase (Input/Process/Output/Data), detect constraints and edge cases
- Drift — 6-field cognitive analysis (Logic, Spatial, Pattern, Transform, Compose, Metaphor)
- Fieldmap — query 5,766-node knowledge graph with boosted keywords
- Describer — generate natural-language approach description (small models understand text > labels)
- Compact — optional 89% compression for tiny context windows
Task → Gates → Drift → Fieldmap → Describer → Context string → LLM
Benchmark Results (HumanEval, pass@1)
All models: Qwen 2.5 Coder family. Full 164 problems. Tests executed, not string-matched.
| Model | Raw | + Codeboost | Delta | Wins / Losses |
|---|---|---|---|---|
| 1.5B | 29.9% | 49.4% | +19.5% | 42W / 10L |
| 3B | 72.6% | 76.8% | +4.3% | 14W / 7L |
| 7B | 64.6% | 73.2% | +8.5% | 19W / 5L |
| 14B | 62.2% | 73.8% | +11.6% | 22W / 3L |
7B + codeboost ≈ 14B raw — same accuracy, half the VRAM.
Hardness Analysis
Codeboost helps most on hard problems and rarely hurts easy ones.
| Model | Hard (raw fail) | Boost rescues | Easy (raw pass) | Boost damages |
|---|---|---|---|---|
| 7B | 58 problems | 19 solved (32.8%) | 106 problems | 5 broken (4.7%) |
| 14B | 62 problems | 22 solved (35.5%) | 102 problems | 3 broken (2.9%) |
On 14B: 12:1 rescue-to-damage ratio — codeboost rescues 35.5% of hard problems while only breaking 2.9% of easy ones.
Ablation (7B)
| Condition | pass@1 | Delta |
|---|---|---|
| Raw (no codeboost) | 64.6% | — |
| Fieldmap only (no drift) | 70.7% | +6.1% |
| Full (fieldmap + drift + describer) | 73.2% | +8.5% |
| Compact mode | 68.3% | +3.7% |
Feedback Loop
Track what works, avoid what doesn't:
from codeboost import query, feedback
result = query("two sum problem")
# ... use result.context with your LLM ...
feedback("two sum problem", "positive") # next query reuses good patterns
feedback("two sum problem", "negative") # next query avoids bad keywords
CLI
pip install codeboost[cli]
codeboost query "sliding window maximum"
codeboost stats
codeboost serve --port 8000
API Server
pip install codeboost[server]
codeboost serve
# POST http://localhost:8000/v1/query
# GET http://localhost:8000/v1/stats
# GET http://localhost:8000/health
Who Is This For
- Developers running local models (Ollama, vLLM) who want better results without upgrading hardware
- Startups self-hosting inference — cut model size in half, keep accuracy
- Offline / air-gapped environments — no API calls, no internet needed
- Batch processing — 10K solutions with a small model + codeboost costs 10x less than API
License
MIT
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 codeboost-0.2.0.tar.gz.
File metadata
- Download URL: codeboost-0.2.0.tar.gz
- Upload date:
- Size: 6.1 MB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
144407b09847044ae81590bc349fda2cbcc3bfeaf7c9e60c313ee037bd25e721
|
|
| MD5 |
a74b545bd5c7c0f9e63a0d461552923c
|
|
| BLAKE2b-256 |
450534898918d325ca8e5b9d074ab1593607b428f70160674508f00288e19ec5
|
File details
Details for the file codeboost-0.2.0-py3-none-any.whl.
File metadata
- Download URL: codeboost-0.2.0-py3-none-any.whl
- Upload date:
- Size: 6.2 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c161a0719eb4fcbea1aae9581208a3e5a2ac3635b116a4f41ee10b0a2434df88
|
|
| MD5 |
2081c5c89ca8e3820625c95d90b0caaf
|
|
| BLAKE2b-256 |
3bcb880c5eaa36f61e83cc94b2e5ae15547c10c782b64e56e77ceaed97654d2d
|