liveBook · Manning

OptiLLM

As explained in Domain-Specific Small Language Models

An open source inference proxy that applies reasoning and answer-refinement techniques to improve model outputs via an OpenAI API–compatible interface.

OptiLLM is an open-source inference proxy that adds test-time reasoning and answer refinement to OpenAI API–compatible model services. It targets accuracy and performance improvements for coding, logical, and mathematical queries without requiring a new client interface. section 15.2 section 15.5

OptiLLM operates as a refinement layer:

  • Clients send requests through the OpenAI SDK, optionally selecting a reasoning algorithm. section 15.2
  • The proxy forwards requests to an OpenAI API–compatible service, including OpenAI, Azure OpenAI, Cerebras, or LiteLLM. section 15.2
  • The proxy makes multiple inference calls, applies the selected refinement method, and returns the final response after the cycle completes. section 15.2
  • Available approaches include Chain-of-Thought with Reflection, PlanSearch, ReRead, Self-Consistency, the Z3 Solver, and R*. section 15.2

The proxy also supports local inference: it can load Hugging Face models and LoRA weights directly or connect to servers such as llama.cpp and Ollama. This extends test-time compute to open-source large and small language models, although external local servers currently lack multiple-response sampling. section 15.2 section 15.5

Refining a small model's mathematical answer

A Qwen/Qwen2.5-0.5B-Instruct model can receive a word problem through a messages list, then use OptiLLM's ThinkDeeper or CoT decoding functions. CoT decoding can aggregate reasoning paths and return a confidence value alongside the answer. section 15.2

Figure 15.1 The flow of requests and responses through the OptiLLM proxy

Trace the client, OptiLLM proxy, downstream inference service, iterative refinement, and final response. section 15.2

How Domain-Specific Small Language Models covers it

How deep it goes
Explains the proxy flow, local deployment, and named refinement methods, but does not detail their underlying algorithms.
Examples
Uses Qwen2.5-0.5B-Instruct, mathematical word problems, ThinkDeeper decoding, and confidence-producing CoT decoding.
What it assumes
Assumes an OpenAI API–compatible client or service and introduces the proxy's routing and refinement role.
What you can do after
Apply it via the OpenAI SDK to refine responses from commercial APIs, local models, or compatible inference servers.
How it connects
Connects test-time compute with static inference, Chain-of-Thought, Self-Consistency, PlanSearch, local inference, and LoRA.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Domain-Specific Small Language Models. The section links point to the parts of the book it draws on.