Enterprise knowledge · Research feature

CWM: Controllable White-Box Meta-Prompting for Adaptive Retrieval-Augmented Generation and Reasoning Ability

A study introduces CWM, a white-box method that enhances retrieval and reasoning in large language models by controlling retrieval decisions through internal model signals.

Adapted from research by Keuntae Kim, Eunhye Jeong, Yong Suk Choi.

arXiv preprint revision · 2026-09-14 · Attribution & reuse
In this article
Editorial illustration of linked workflow.

Editor’s introduction

The researchers developed CWM, a controllable white-box meta-prompting framework, to improve adaptive retrieval-augmented generation and reasoning in large language models. They compared methods that use single queries—like Self-Discover and CWM—with those relying on multi-sampling or partial rationale generation, such as Rowen-CL and SEAKR. Results show that single-query methods achieve higher RAG O ratios, particularly on StrategyQA, while multi-sampling methods sometimes produce overconfident results and underperform relative to baseline models. CWM demonstrates strong performance across multiple benchmarks and enables retrieval control via input-derived model signals. The study evaluates only one retrieval prompt added to a library of 39 existing atomic reasoning modules, which were adopted without modification from prior work.

Introduction

Since the emergence of Large Language Models (LLMs), research has largely focused on improving their performance and expanding their applicability along two major directions. The first direction emphasizes reasoning-intensive capabilities, exemplified by tasks such as mathematical problem solving and code generation. The second focuses on knowledge augmentation, most notably through Retrieval-Augmented Generation (RAG). LLMs have demonstrated substantial performance gains in both domains, and as models optimized for each domain have been released, they have achieved accuracy levels sufficient for deployment in real-world applications. For instance, several models released in 2025—including GPT-5.2, Gemini 3, GLM-4.7, Grok 4.1, and Qwen3 —surpass 90% accuracy on the AIME benchmark, a task that remains highly challenging even for human experts.

Despite these advances in task-specific model performance, determining how to optimally process input prompts remains a largely unresolved problem. For example, GPT-5 introduced a routing mechanism that automatically selects an appropriate model based on the input prompt. However, this approach led to degraded generation quality, prompting a subsequent policy change that reintroduced user-controlled model selection. Such cases highlight the continued need for research on determining optimal processing strategies conditioned on input characteristics.

A representative line of work addressing input-dependent processing is adaptive RAG, which aims to determine whether retrieval should be employed for a given input. While recent studies have actively explored this direction, existing approaches suffer from three major limitations. First, most adaptive RAG methods rely on pre-trained classifiers or external databases, making them highly dependent on specific tasks or datasets. Second, they often require multiple inference calls to exploit model responses, resulting in increased computational cost. Third, performance evaluations are typically limited to tasks requiring external knowledge, leaving the impact of adaptive RAG on non-knowledge-intensive tasks underexplored. Consequently, the overall effect of adaptive RAG on general prompt processing remains insufficiently analyzed. Addressing these limitations constitutes the primary motivation of our work.

We attribute these issues primarily to an over-reliance on black-box approaches. As black-box methods do not exploit a model’s internal states, they often rely on external classifiers or repeated inference to guide decision-making, resulting in substantial computational cost. Meanwhile, recent studies have shown that LLMs can exhibit overconfidence or bias in their own generations. Motivated by these observations, we propose existing black-box adaptive RAG approaches with a white-box perspective that leverages internal model signals to improve decision-making.

To this end, we build upon Self-Discover, an existing meta-prompting framework in which LLMs compose reasoning structures by selecting from atomic reasoning modules, and extend it with a white-box control mechanism based on the model’s internal signals. Specifically, we introduce an atomic module for deciding whether external knowledge is required and use the model’s Self-Perplexity on the input query as a pre-generation decision signal to guide its selection. This enables retrieval decisions to be made within the meta-prompting process itself, without relying on external modules or repeated inference. Our approach (1) does not require external decision modules, (2) relies on single-sample inference, and (3) applies to both RAG and reasoning tasks.

Adaptive RAG

Adaptive Retrieval-Augmented Generation (Adaptive RAG) is a task that determines whether document retrieval should be performed based on the complexity of a given query, and thus plays a crucial role in deciding whether a model should rely on external knowledge. Prior work has explored this problem from several perspectives. Previous study proposed a method that decides whether to apply RAG based on query complexity. Adaptive-RAG introduced an approach that pre-trains a classifier to categorize queries into straightforward, simple, and complex types, and applies retrieval selectively based on this classification. Rowen proposed a consistency-based detection module that constructs cross-lingual, perturbed, and cross-model questions, and determines the necessity of retrieval by analyzing multiple generated responses. Finally, SEAKR generated a brief rationale for each query and used the uncertainty of the generated rationale to decide whether external knowledge retrieval is required.

Prompting for Reasoning Task

Prompting strategies for reasoning tasks have been extensively studied, largely motivated by the remarkable success of Chain-of-Thought prompting. In particular, a growing body of work has focused on designing meta-prompts that aim to maximize the reasoning capabilities of LLMs. Among these approaches, Plan-and-Solve Prompting demonstrated that explicitly constructing a plan for step-by-step processing within the prompt leads to improved reasoning performance. Subsequently, Self-Discover proposed a black-box meta-prompting approach in which LLMs autonomously compose task-specific meta-prompts by selecting from a set of atomic reasoning modules. By dynamically constructing different reasoning structures for different tasks, this method achieved substantial performance improvements. However, these meta-prompting techniques have been primarily limited to reasoning tasks. Whether LLM-based meta-prompting is effective for adaptive RAG tasks has not yet been systematically explored.

Method

We extend the atomic reasoning prompt modules of Self-Discover by introducing a Retrieval decision prompt, enabling its application to adaptive RAG. To this end, we compute the Self-Perplexity (Self-PPL) of the input query and incorporate it into the Retrieval prompt during meta-prompt generation. Self-PPL serves as a pre-generation control signal for retrieval decisions and is injected into the embedding of the Retrieval prompt, where higher values encourage retrieval and lower values suppress it. Unlike prior approaches that estimate uncertainty from hidden states or logits during generation, which often require multi-sampling or iterative refinement, our method leverages input-level uncertainty to determine retrieval necessity before generation. This enables efficient retrieval routing with a single forward pass and significantly reduces inference cost.

Benchmarks & Models

We evaluate adaptive RAG performance on HotpotQA, MuSiQue, and StrategyQA, which align with the primary objective of this work. For reasoning tasks, we benchmark against the Self-Discover framework using selected BBH subtasks (Penguins in a Table, Formal Fallacies, and Web of Lies), as well as T4D and MATH500. Using 100 randomly sampled instances per dataset, we conduct all experiments on GPT-oss-20b, Qwen3-14b, and Llama3.1-8b, which collectively represent diverse LLM architectures and model scales suitable for white-box analysis.

Baselines

To assess adaptive RAG task capabilities, we benchmark against representative adaptive RAG methods, namely Adaptive-RAG, Rowen-CL, and SEAKR. We additionally construct a Self-Discover -based baseline by extending its reasoning prompt modules with an explicit retrieval-decision component. To contextualize performance, we include oracle baselines with Gold Context (w/ GC) and without Gold Context (w/o GC), which provide empirical upper and lower bounds. Finally, we evaluate all methods on the three reasoning benchmarks used in Self-Discover to isolate the impact of incorporating white-box signals beyond black-box prompting.

Implementation Details

All outputs were generated using greedy decoding with a maximum output length of 1024 tokens (temperature = 0). For GPT-oss-20b, we set the reasoning_level to low, while for Qwen3-14b, we disabled the thinking mode by setting enable_thinking=False. In the adaptive RAG task setting, when retrieval was required, both the baselines and CWM were provided with the same gold context for answer generation. All experiments were conducted using four NVIDIA RTX A5000 GPUs.

Results for Adaptive RAG task

When analyzing method-specific behaviors, Rowen-CL and SEAKR, which determine retrieval necessity through partial rationale generation or multi-sampling, exhibit relatively low RAG O ratios on StrategyQA, a comparatively easier benchmark. This suggests that these methods may attain high confidence from self-generated responses. In contrast, methods that rely on a single query, including Self-Discover and CWM, as well as Adaptive-RAG, show substantially higher RAG O ratios. Notably, Rowen-CL and SEAKR occasionally perform worse than the lower bound (w/o GC) on StrategyQA, indicating that multi-sampling can induce overconfidence and fail to identify queries that truly require retrieval.

In contrast, CWM effectively leverages atomic reasoning modules and consistently achieves performance above the lower bound across all cases. Moreover, in certain model and benchmark combinations, specifically HotpotQA with Qwen3-14b and MuSiQue with Llama-3.1-8b, CWM even surpasses the gold-context baseline (w/ GC). CWM also exhibits the highest RAG O ratios across all models on MuSiQue, which is the most challenging benchmark among the three. Given that all models show very low performance under the w/o GC setting on MuSiQue, this behavior can be considered both desirable and meaningful.

Analysis for Efficiency

For comparison with Self-Discover, it is worth noting that Self-Discover and CWM share the same structural framework. Given an input query, the model performs one inference call to select prompts from atomic reasoning modules, one inference call to generate a meta-prompt, and one inference call to produce the final answer, resulting in a total of three inference calls (additional inference calls may be introduced to further improve the quality of the generated meta-prompt). The overall inference time may vary depending on the number of atomic reasoning modules selected for a given instance.

As both CWM and SEAKR are white-box methods, we compare them directly. CWM computes only the perplexity of the input query, incurring minimal overhead, whereas SEAKR performs K-step sampling over hidden states, resulting in substantially higher inference time. Although SEAKR can mitigate this overhead through parallelized execution with vLLM, such optimizations are not considered in our setup. Overall, CWM achieves efficient performance without increasing cost compared to black-box methods such as Self-Discover.

Conclusion

Our study aims to develop a unified approach for both reasoning and adaptive RAG tasks using recent open-source LLMs. CWM performs strongly across both settings while reducing computational cost compared to prior methods that rely on external classifiers, auxiliary databases, additional models, or multi-sampling. Moreover, we show that retrieval decisions can be controlled using internal model signals derived from the input query itself, rather than from signals obtained during generation. Beyond retrieval, the atomic reasoning prompts also enable more general prompt selection. These findings open up promising directions for future research, particularly in light of the growing availability of high-performing open-source language models.

Limitations

One limitation of this work concerns the scope of the atomic reasoning module library. We conduct our experiments by adding a single Retrieval prompt to the existing library of 39 atomic reasoning modules. The original atomic reasoning modules are adopted directly from prior work without modification, as their design reflects accumulated insights from multiple research communities. Modifying these modules would require broader consensus across different domains, which is beyond the scope of this study. In this work, we do not investigate whether Self-Perplexity can be effectively used to modulate the other 39 atomic reasoning prompts. Exploring new atomic reasoning module libraries tailored for LLMs and controlling individual modules using internal model signals would be an interesting direction for future work.

Another limitation concerns the applicability of CWM to closed-source LLMs. As a white-box approach, CWM requires access to token-level likelihoods and embedding-level representations, limiting its direct applicability to API-only models and making equivalent method-level comparisons challenging. Nevertheless, CWM remains applicable to self-hosted open-weight LLMs where internal signals are accessible, particularly in enterprise or security-sensitive settings. Extending white-box control methods to broader model settings remains an important direction for future work.

Finally, Self-PPL may not always accurately reflect retrieval necessity. Queries involving recent information beyond the model’s training data may exhibit low Self-PPL despite requiring retrieval, while ambiguous or unusual phrasing may yield high Self-PPL even when retrieval is unnecessary. Incorporating complementary signals, such as temporal recency or lexical characteristics, could further improve retrieval decisions in future work.

Reasoning verbosity control

GPT-oss provides a system-level control over reasoning verbosity. We fix this setting to a low level (e.g., Reasoning: low) to encourage concise outputs and to ensure that changes in the meta-prompt are primarily driven by the CWM control signal rather than stylistic variability.

Protocol-aware termination and decoding

GPT-oss follows a structured output protocol in which the assistant’s final response is emitted within a dedicated final channel. Accordingly, generation uses a protocol-specific set of stop tokens, and decoded text is post-processed to extract only the final-channel content, ensuring consistent evaluation.

Adaptive-RAG

Adaptive-RAG employs a classifier-based routing mechanism to determine the complexity of an input query and select an appropriate retrieval strategy. Following the original Adaptive-RAG design, a T5-Large model is used as the query complexity classifier. The classifier is trained on a subset of the training data with automatically generated silver and binary labels, where queries are categorized into three classes: Straightforward, Simple, and Complex. These labels are obtained by observing model behaviors under different retrieval settings rather than through manual annotation. The classifier is trained once prior to evaluation and remains fixed during inference. At test time, Straightforward queries are answered without retrieval, Simple queries trigger a single retrieval-generation step, and Complex queries allow multiple retrieval-generation iterations. All classifier-related hyperparameters, including training procedure and routing thresholds, follow the default settings described in the original Adaptive-RAG paper. The retriever used in Adaptive-RAG is a sparse BM25-based retriever over a Wikipedia corpus.

Retrieval Gain by Self-PPL Groups

To further examine whether Self-PPL identifies queries that benefit from retrieval, we partition the evaluation queries within each dataset into two equally sized groups using the median Self-PPL value. Queries below the median are assigned to the Low Self-PPL group, and queries above the median are assigned to the High Self-PPL group. For each group, we compute the average retrieval gain, defined in Section B as the performance difference between generation with and without external context.

Comparison with Entropy

We next compare Self-PPL with token-level entropy as an alternative uncertainty signal. Token-level entropy is defined as the average predictive entropy over the input sequence, where the entropy at each position is computed from the model’s next-token distribution and then averaged across all input tokens. For each model, we report three statistics over all evaluation queries: (1) the correlation between the signal and retrieval gain, (2) the mean value of the signal, and (3) the variance of the signal across inputs.