
Work a hard problem with one strong model and many cheap ones
Source:R/superbrain.R
think_harder.RdA four-stage orchestration:
Usage
think_harder(
problem,
strong_config,
cheap_config,
n_approaches = 4L,
verify = TRUE,
quiet = FALSE,
...
)Arguments
- problem
The problem statement (character scalar). Be complete: workers see nothing but this and their assigned approach.
- strong_config
An
LLMR::llm_config()for the strong (planner / synthesizer / verifier) model.- cheap_config
An
LLMR::llm_config()for the cheap worker model.- n_approaches
Number of independent lines of attack (default 4).
- verify
If TRUE (default), run the verification stage and one revision round when the verifier finds a substantive flaw.
- quiet
FALSE prints stage progress.
- ...
Passed to
LLMR::call_llm_par()for the worker stage (e.g.tries,progress).
Value
A list of class super_brain:
answerThe final answer (character).
planTibble of approaches:
title,instructions.workersTibble:
approach,output,success, plus token diagnostics fromLLMR::call_llm_par().verificationThe verifier's structured critique (or NULL).
revisedTRUE when the revision pass ran.
Details
Plan (strong model, 1 call): decompose the problem into
n_approachesgenuinely different lines of attack.Work (cheap model,
n_approachesparallel calls): each line is pursued independently, blind to the others.Synthesize (strong model, 1 call): weigh the drafts against one another, resolve contradictions, and write the answer.
Verify (strong model, 1 call, optional): attack the synthesized answer; if a real flaw is found, one revision pass runs.
The economics: two to three strong-model calls regardless of how wide the fan-out is, with the bulk of tokens billed at the cheap model's rate. The returned object keeps every intermediate product, so you can audit what each worker contributed and what the verifier objected to.
Examples
if (FALSE) { # \dontrun{
strong <- LLMR::llm_config("deepseek", "deepseek-reasoner")
cheap <- LLMR::llm_config("groq", "openai/gpt-oss-20b", temperature = 0.8)
out <- think_harder(
"A city of 1M residents wants to halve traffic deaths in 5 years
with a budget of $40M. Propose the most cost-effective portfolio
of interventions, with rough numbers.",
strong_config = strong, cheap_config = cheap, n_approaches = 5
)
cat(out$answer)
out$workers[, c("approach", "success")]
} # }