Finding rare but useful solutions in very large candidate spaces is a recurring practical challenge across language generation, planning, and reinforcement learning. We present a practical framework, Inverted Causality Focusing Algorithm (ICFA), that treats search as a target-conditioned reweighting process. ICFA reuses an available proposal sampler and a task-specific similarity function to form a focused sampling distribution, while adaptively controlling focusing strength to avoid degeneracy. We provide a clear recipe, a stability diagnostic based on effective sample size, a compact theoretical sketch explaining when ICFA can reduce sample needs, and two reproducible experiments: constrained language generation and sparse-reward navigation. We further show how structured prompts instantiate an approximate, language-level form of ICFA and describe a hybrid architecture combining prompted inference with algorithmic reweighting. Code and a singlefile reproducible demo are provided in the supplementary material.
Large candidate spaces are ubiquitous. Producing a sentence that satisfies many constraints, finding a molecular structure with several desired properties, or discovering a long action sequence that yields reward are all instances of the same core difficulty: good solutions are rare, and naive generation wastes computation. Common practical workarounds-sampling many candidates and selecting the best, beam search, or costly policy training-each carry clear limitations. Sampling scales poorly when targets are rare; beam and tree methods depend on brittle local heuristics; and training-based approaches like reinforcement learning can be prohibitively expensive and slow to adapt.
We propose a different angle: view search as conditioning on a target. If some numeric measure quantifies how well a candidate matches the target, one can use that measure to skew sampling toward promising areas. ICFA implements this idea by reweighting samples drawn from an available proposal distribution, using a Boltzmann-style transform of a similarity score, and by adaptively controlling the strength of the reweighting so that the process remains numerically stable and diverse.
ICFA is not a magic bullet: its benefit depends on the informativeness of the similarity function. Our contribution is practical: (1) a clear and reproducible algorithm for inferencetime focusing that avoids common failure modes; (2) a stability control mechanism that is simple to compute; (3) empirical demonstrations showing that focusing can significantly reduce effective sample needs in representative tasks; and (4) a conceptual bridge to prompting: structured prompts can be understood as a lightweight language-level approximation of ICFA, useful when algorithmic intervention is impractical.
The rest of the paper is organized as follows. Section 2 defines the framework and its diagnostics. Section 3 gives the algorithmic recipe. Section 4 sketches why and when focusing helps. Section 5 shows how prompting approximates focusing. Section 6 reports experiments. Section 7 discusses limitations and deployment guidance. We close with reproducibility notes.
Let S be a discrete candidate space and let ๐ 0 (๐ ) be a proposal sampler that we can draw from (for example, the distribution implicit in a pretrained language model or a baseline policy). Let ๐ฃ target denote a target specification and let ๐(๐ , ๐ฃ target ) be a computable similarity function that scores how well candidate ๐ matches ๐ฃ target . Our goal is to concentrate sampling effort on high-quality candidates without retraining ๐ 0 .
ICFA forms a target-conditioned distribution:
where ๐ฝ โฅ 0 controls focusing strength. When ๐ฝ = 0 we recover the proposal; as ๐ฝ โ โ the mass concentrates on the highest-scoring candidates. The resulting weighted set approximates sampling from ๐ ๐ฝ while avoiding extreme degeneracy. One may then either (a) select the highest-weight candidate, (b) resample according to w๐ to produce a handful of final outcomes, or (c) pass the weighted set to a downstream refinement step. with ๐พ โ (0, 1) before re-normalizing.
Informally, focusing helps when the similarity function provides a meaningful advantage: the expected reweighted mass of true solutions grows exponentially with ๐ฝ relative to alternatives. Under such an Exponential Advantage assumption, SNIS with adaptive focusing concentrates mass onto the solution set with far fewer batches than naive sampling.
Theorem 1 (Informal). Assume the proposal ๐ 0 and similarity ๐ are such that, for some ๐ฝ > 0, the expected weight of valid solutions exceeds the expected weight of non-solutions by a factor ๐ ๐
with ๐
โซ ln ๐. Then, with high probability, ICFA identifies a valid solution using
where ๐ is the effective space size and ๐ฟ the failure probability.
The bound should be read qualitatively: when signal strength ๐
is large, the required number of samples grows only logarithmically with problem size. This does not contradict formal no-free-lunch results: ICFA exploits problem structure encoded by ๐.
A concise intuition is that reweighting compresses the relative probability of bad regions exponentially with ๐ฝ, so relative mass is transferred to good regions more rapidly than uniform sampling would allow.
When algorithmic intervention is not available, structured prompts can approximate the ICFA workflow at the language level. A practical prompt protocol has four steps: (1) generate several distinct candidates, (2) state explicit evaluation criteria, (3) evaluate each candidate and assign scores, (4) refine or select according to the evaluations. We call this pattern Prompted ICFA.
Prompted ICFA lacks explicit probability control and ESSbased stability guarantees, but it often yields substantial practical gains because modern language models already house rich latent preference and evaluation capacities. In practice, merging algorithmic ICFA (where possible) with prompted ICFA yields a hybrid system: prompts produce candidates and coarse evaluations; algorithmic ICFA performs precise weighting and stabilization.
Our goals are reproduction and demonstration: we show that focusing produces the intended empirical effects in two representative domains and that Prompted ICFA is a useful lightweight alternative.
Setup. We consider a constrained generation task that requires producing short text containing a set of specified keywords. As baselines we use Beam Search (small beam), Best-of-N sampling, and an RL-finetuned policy (PPO) when applicable. For reproducibility we provide two implementations: (a) a toy, self-contained simulator that mimics a generator and scoring function; and (b) an implementation paired with a pretrained small language model. The similarity function counts keyword coverage.
Metrics. Constraint satisfaction rate (accuracy), latency in milliseconds, and hallucination rate (cases where the generator invents unsupported facts). ICFA achieves higher constraint satisfaction while using far fewer effective samples compared to Best-of-N and without expensive policy training. The toy implementation and the small-model run both exhibit the same qualitative pattern.
Setup. We consider a sparse-reward grid navigation task where an agent receives reward only upon reaching a distant goal. We compare standard on-policy PPO with a variant where collected trajectories are reweighted by ICFA using total return (or a distance-based proxy) as ๐ during updates. The environment and training loop are described in the supplementary code.
Metric. Time-to-solve: total environment steps until the policy reliably reaches the goal.
Results. In our replicated experiments, baseline PPO required approximately 5.6 ร 10 5 environment steps to reliably solve the task, while ICFA-PPO required roughly 4.0 ร 10 4 steps, corresponding to a โผ14ร speedup in time-to-solve under matched compute settings.
We compared ICFA-style prompts against direct prompting, chain-of-thought, and self-refinement across three task classes: multi-constraint logical composition, multi-step planning, and multi-step mathematical derivation. With identical model and token budgets, ICFA prompts consistently outperformed baselines (improvements in final-task accuracy ranged from 10 to 20 percentage points in our replications). These results match the view that prompt structure-specifically, deferring commitment and forcing explicit evaluation-produces practical dividends.
ICFA is most beneficial when:
โข A useful similarity/scorer ๐ is available or can be cheaply approximated.
โข The proposal ๐ 0 assigns non-negligible mass to the target region (support overlap).
โข Constraints at inference time are costly to satisfy by retraining.
If any of these conditions fails, ICFA may be ineffective or harmful.
Prompted ICFA provides a low-cost path to better outputs when model modification or external orchestration is not feasible. Algorithmic ICFA grants stronger guarantees and finer control when batch sampling and weighting are possible.
A hybrid system that uses prompts to generate candidates and ICFA to perform stabilized reweighting combines the best of both worlds.
ICFA amplifies whatever signal is present in ๐. If ๐ is biased, ICFA will magnify those biases. If ๐ 0 has zero support on the target region, reweighting cannot create solutions. Aggressive focusing reduces diversity, which may be undesirable for creative tasks. Practitioners must therefore place strong emphasis on scorer design, monitoring, and governance. We describe concrete mitigation strategies in the appendix.
All algorithmic descriptions above are deliberately simple to implement. The core ICFA routine requires only (1) a sampler for ๐ 0 , (2) a similarity function ๐, and (3) an ESSbased loop that adapts ๐ฝ. To support reproducibility we provide a single-file demonstration and the scripts used for the experiments in the supplementary material. The singlefile demo encapsulates both the toy text experiment and the grid navigation experiment and can be run with standard Python and PyTorch.
We presented ICFA, a practical framework for inferencetime focusing based on target-conditioned reweighting with adaptive stability control. ICFA bridges the conceptual gap between elegant but impractical energy-based methods and ad-hoc selection heuristics by offering a numerically stable, low-latency, and parallel-friendly mechanism to concentrate sampling effort where it matters most. Prompted ICFA provides a light-weight language-level approximation when algorithmic control is unavailable. We believe this set of ideas opens practical pathways to improve constrained generation, planning, and learning in settings where retraining is expensive or impossible.
๐ w2 ๐ , where w๐ are normalized weights. ESS is inexpensive to compute and directly reflects whether the current focusing strength preserves enough diversity. 1 arXiv:2512.19717v1 [cs.LG] 16 Dec 2025 1: Input: 3: Set ๐ฝ โ 0. 4: while ๐ฝ < ๐ฝ max do 5: 6: if ESS < ๐๐ then 7: Stop and use the previous w๐ . 8: else 9: Increase ๐ฝ (e.g., by a fixed step or by binary search to the next target ESS). 10: end if 11: end while 12: Output: Weighted candidates (๐ ๐ , w๐ ).
โข Numerical stability.
This content is AI-processed based on open access ArXiv data.