Exploring Knowledge Filtering for Retrieval-Augmented Discriminative Tasks
Authors: Minjie Qiang, Zhongqing Wang, Xiaoyi Bao, HaoYuan Ma, Shoushan Li, Guodong Zhou
Accepted at: acl25

Exploring Knowledge Filtering for Retrieval-Augmented Discriminative Tasks

Minjie Qiang1, Zhongqing Wang1*, Xiaoyi Bao2, Haoyuan Ma1
Shoushan Li1, Guodong Zhou1
1Natural Language Processing Lab, Soochow University, Suzhou, China
2The Hong Kong Polytechnic University, Hong Kong, China
qiangminjie27@gmail.com
{wangzq,lishoushan,gdzhou}@suda.edu.cn
p2213545413@outlook.com, 20244027009@stu.suda.edu.cn

Abstract

Retrieval-augmented methods have achieved remarkable advancements in alleviating the hallucination of large language models. Nevertheless, the introduction of external knowledge does not always lead to the expected improvement in model performance, as irrelevant or harmful information present in the retrieved knowledge can compromise the prediction process. To address these challenges, we propose a novel framework aimed at improving model performance by incorporating knowledge filtering and prediction fusion mechanisms. In particular, our approach first employs a perplexity-based annotation method to collect training data. Then, we design four distinct strategies to filter out harmful retrieved knowledge. Finally, we integrate the filtered knowledge to generate the final result via batch-wise predictions. We conduct extensive experiments across multiple discriminative task datasets to evaluate the proposed framework. The results demonstrate that our framework can significantly enhance the performance of models on discriminative tasks.

1 Introduction

Recently, large language models have demonstrated remarkable potential across various natural language processing (NLP) tasks (Wang et al., 2023a; Boshar et al., 2024; Hasan et al., 2024). However, they also exhibit several critical limitations, including the propensity to generate hallucinated content (Zhou et al., 2021) and the inability to update their internal knowledge dynamically (Kandpal et al., 2023). To mitigate these problems, Retrieval-Augmented Generation (RAG) has been introduced as a promising approach. RAG enhances LLMs by retrieving relevant information from external sources, such as Wikipedia, and integrating it into the input context, thereby improving response accuracy and reliability (Fan et al., 2024).

![The illustration of RAG in discriminative tasks.](page_682_370_377_246.png)

Figure 1: The illustration of RAG in discriminative tasks.

Most research on RAG typically follows the Retrieve-then-Read paradigm and has achieved significant success across multiple tasks, such as dialogue generation (Wu et al., 2019) and question answering (Izacard and Grave, 2020). Nevertheless, most recent studies have primarily focused on generative tasks, while its potential in discriminative tasks remains largely unexplored. Notably, RAG holds considerable promise for discriminative tasks such as sentiment analysis, as retrieving relevant knowledge can provide implicit meanings, cultural context, and domain-specific concepts, thereby facilitating more accurate classification. The investigation of discriminative tasks not only broadens the application scope of RAG but also offers valuable insights into how retrieved knowledge contributes to enhanced discrimination performance. As illustrated in Figure 1, our study explores the application of RAG across a range of discriminative tasks, including linguistic acceptability (Warstadt, 2019), question classification (Li and Roth, 2002), and sentiment analysis (Socher et al., 2013).

However, applying RAG to discriminative tasks presents two significant challenges: On the one hand, retrieval-augmented methods are constrained by the quality of retrieved knowledge (Cheng et al., 2023). The presence of noise in external knowledge bases, coupled with the performance limitations of retrievers, may result in retrieved knowledge con-
taining irrelevant or even contradictory information. For instance, in question classification tasks, irrelevant knowledge may introduce spurious correlations, causing the model to overlook essential classification features. On the other hand, retrieval-augmented methods are constrained by their prediction strategy (Shi et al., 2023b). Incorporating all retrieved knowledge indiscriminately may confuse the model. For example, in sentiment classification tasks, the presence of knowledge with opposing sentiments is inevitable. This can lead the model to make incorrect judgments as it becomes uncertain which knowledge to trust.

To address these challenges, we propose a novel framework as illustrated in Figure 2. Our framework enhances performance through knowledge filtering and prediction fusion, comprising three core steps: 1) Label Collection, annotating harmfulness labels of knowledge for training. 2) Knowledge Filtering, implementing four distinct strategies for knowledge filtering. 3) Prediction Fusion, mitigating the potential bias introduced by knowledge. Specifically, we first annotate query-knowledge pairs by analyzing variations in the model perplexity with and without knowledge to collect training data. Then, leveraging the annotated training data, we design four filtering strategies to eliminate harmful knowledge. Finally, we conduct batch-wise predictions using the filtered knowledge and employ a weighted fusion mechanism to generate the final output. Extensive experiments across multiple discriminative tasks demonstrate the generality and effectiveness of our framework.

2 Task Formulation & Framework

In this study, we explore the application of RAG across multiple discriminative tasks: 1) Linguistic Acceptability (Warstadt, 2019), which evaluates whether the given sentence follows grammar standards. 2) Question Classification (Li and Roth, 2002), which aims to categorize questions into predefined topics (e.g., location). 3) Sentiment Analysis (Socher et al., 2013), which determines the specific sentence as positive, negative, or neutral. Formally, these tasks can be defined as discriminative problems. A unified definition is as follows: Given a text input \( x \), the objective is to predict an output \( \hat{y} \) from a pre-defined label set \( Y \).

Figure 2 provides an overview of our proposed framework. Specifically, given a text input \( x \) as a query, we first employ a retriever \( R(\cdot) \) to retrieve a relevant subset of knowledge from an external database \( K \), where Wikipedia serves as our knowledge source. Then, we employ four filtering strategies, leveraging annotated training data, to eliminate harmful knowledge. Finally, the filtered knowledge is concatenated with the original query and fed into a large language model \( \mathcal{M}(\cdot) \) to generate the output.

In the following section, we introduce the two fundamental components of the RAG pipeline:

Retriever We utilize the dense encoder BGE (Xiao et al., 2023) as our retriever. To optimize retrieval costs, we establish a pre-built static index for the external database by encoding knowledge. Then, the queries are embedded into the same latent vector space. The similarity score \( \operatorname{sim}(q, k_i) \) between the query vector \( E(q) \) and each knowledge vector \( E(k_i) \) is computed using dot product, followed by efficient similarity retrieval within the static index through FAISS (Johnson et al., 2019):

\[
\operatorname{sim}(q, k_i) = E(q)^T E(k_i), k_i \in K
\]

Finally, based on these similarity scores, we select the top-k most relevant knowledge for the next process stage.

Generator We adopt LLaMA3-8B (Dubey et al., 2024) as the backbone of our framework. Following the retrieval phase, we concatenate the query with the retrieved knowledge \( K_{ret} \) to construct a prompt, which is then fed into a large language model to generate the final output \( \hat{y}(q, K_{ret}) \):

\[
\hat{y}(q, K_{ret}) = \mathcal{M}(\text{Prompt}(q, K_{ret}))
\]

Note that the generator’s performance remains sub-optimal without task-specific fine-tuning, as evidenced by our experimental results in Appendix C.

3 Methodology

As illustrated in Figure 3, our framework comprises three primary steps: Label Collection, Knowledge Filtering, and Prediction Fusion. Specifically, we
first propose a perplexity-based approach to annotate query-knowledge pairs, collecting training data for subsequent filtering procedures. We then design four distinct strategies to filter out harmful knowledge. Finally, we integrate the filtered knowledge through the batch-wise prediction to achieve more accurate classification. The following sections provide a detailed description of each step.

3.1 Label Collection

Since subsequent filtering strategies require labeled training samples, we propose an annotation approach that evaluates the harmfulness of knowledge by analyzing the perplexity variation of the model with and without external knowledge.

Specifically, given a subset \( \mathcal{D} = \{(q_i, y_i)\}_{i=1}^{|D|} \) from training samples, we first employ the fine-tuned LLM to generate the output for each query:

\[
\hat{y}(q_i) = \mathcal{M}(\text{Prompt}(q_i))
\]

The generated output \( \hat{y}(q_i) \) reflects the model’s intrinsic knowledge level for the given query (Varshney et al., 2022).

Subsequently, we utilize the retriever to obtain the top-k most relevant knowledge from the external database \( K \) and incorporate each retrieved knowledge into the prompt. Then we employ LLM to generate output \( \hat{y}(q_i, k_j) \) with retrieved knowledge. To annotate harmfulness for query-knowledge pairs, we set a threshold \( \theta \) and compare the model perplexity PPL(\( \cdot \)) variation between the two generation settings:

\[
(q_i, k_i) = \begin{cases}
\text{Harmful}, & \text{if } \frac{\text{PPL}(\hat{y}(q_i, k_i))}{\text{PPL}(\hat{y}(q_i))} > \theta; \\
\text{Harmless}, & \text{otherwise}.
\end{cases}
\]

Through this process, we ultimately construct a training dataset \( \mathcal{D}_{kf} \) comprising query-knowledge pairs annotated for harmfulness.

3.2 Knowledge Filtering

As illustrated in Figure 4, we propose four distinct strategies to filter retrieved knowledge: *Direct Prediction*, *In-Context Prediction*, *Proxy Model*, and *Ensemble Prediction*. A detailed description of each strategy is provided below.

**Direct Prediction** Given a query and a piece of knowledge, the objective is to evaluate the harmfulness of retrieved knowledge. A straightforward approach is to construct a prompt template, en-

![The illustration of each step in our framework.](page_186_120_1077_495.png)

Figure 3: The illustration of each step in our framework.

![The illustration of four filtering strategies.](page_1012_120_388_495.png)

Figure 4: The illustration of four filtering strategies.
abling the LLM itself to directly assess the harmfulness of the provided knowledge. Here, we adopt the Multiple-Choice Question (MCQ) prompt template (Wang et al., 2023b), as LLMs generally exhibit greater familiarity with the MCQ format compared to the conventional prompts. The set of prompt templates can be found in Appendix E.

In the MCQ format, each predefined label is mapped to a corresponding option, which is then presented to the LLM for selection. This strategy is both simple and intuitive and adapts well across various tasks. Nevertheless, due to the absence of explicit task-specific demonstrations, the model’s performance may be inherently constrained.

In-Context Prediction Recent studies have demonstrated that incorporating task-specific demonstrations into prompts can significantly enhance the performance of LLMs without fine-tuning (Zhang et al., 2022). Therefore, we randomly sample several query-knowledge pairs from \( \mathcal{D}_{kf} \) and integrate them into the prompt as task-specific demonstrations. Subsequently, we leverage the LLM itself to assess the harmfulness of the provided knowledge.

Both of the aforementioned strategies that utilize the LLM itself for filtering exhibit several limitations: 1) Context-based methods are inherently susceptible to the quality of provided demonstrations (Fan et al., 2024), frequently resulting in sub-optimal performance. 2) These methods are constrained by the LLM’s context length limitations, making it struggle to utilize more training samples.

Proxy Model To overcome these limitations, we propose a proxy model strategy, which is implemented by fine-tuning a lightweight LLaMA3-1B (Dubey et al., 2024) on the dataset \( \mathcal{D}_{kf} \). Specifically, we formulate the harmfulness evaluation as a text generation task, where given a query \( q \) and a piece of knowledge \( k_i \), the proxy model PM(\( \cdot \)) generates discriminative predictions. The prediction process is formally defined as:

\[
\hat{a}(q, k_i) = \mathrm{PM}(\mathrm{Prompt}(q, k_i))
\]

where \( \hat{a}(q, k_i) \in \{\mathrm{Harmful}, \mathrm{Harmless}\} \) indicates the harmfulness of knowledge. By leveraging a lightweight proxy model, our strategy enhances the efficiency and accuracy of harmfulness evaluation.

Ensemble Prediction Existing research (Ma et al., 2023) has demonstrated that LLMs exhibit superior performance in handling difficult samples, while small language models (i.e., our proxy model) tend to perform more effectively on simpler samples. Motivated by this, we suppose that our proposed filtering strategies are not mutually exclusive but complementary. To leverage the strengths of distinct strategies, we propose an ensemble prediction strategy. Specifically, we first employ the proxy model for initial sample predictions:

\[
\mathrm{conf}(k_i) = \max_{a \in A} \mathrm{Prob}_{PM}(a|q, k_i)
\]

where \( \mathrm{conf}(k_i) \) denotes the confidence level of the given sample, \( A \) is the set of candidate labels and \( \mathrm{Prob}_{PM}(a|q, k_i) \) represents the conditional probability distribution generated by the proxy model. We set a threshold \( \theta \) to distinguish the difficulty of samples. For high-confidence samples (\( \mathrm{conf}(k_i) \geq \theta \)), we directly adopt the proxy model’s predictions. In contrast, for low-confidence samples, we further apply In-Context Prediction strategy, thereby integrating both strategies in a complementary manner.

\[
\hat{a}(q, k_i) = \mathrm{PM}(\mathrm{Prompt}(q, k_i))
\]

where \( \hat{a}(q, k_i) \in \{\mathrm{Harmful}, \mathrm{Harmless}\} \) indicates the harmfulness of knowledge. By leveraging a lightweight proxy model, our strategy enhances the efficiency and accuracy of harmfulness evaluation.

Ensemble Prediction Existing research (Ma et al., 2023) has demonstrated that LLMs exhibit superior performance in handling difficult samples, while small language models (i.e., our proxy

![The illustration of prediction fusion.](page_1016_186_377_246.png)

Figure 5: The illustration of prediction fusion.

To mitigate the problem that the LLMs are susceptible to being misled by certain pieces of knowledge, we propose the Prediction Fusion mechanism, as illustrated in Figure 5. Specifically, we first integrate the query with each filtered knowledge separately to construct prompts and then perform batch-wise predictions. Subsequently, we apply a weighted fusion strategy to aggregate the probability distributions \( p(y|q, k_i) \) generated by the LLM, yielding the final prediction:

\[
p(y|q, K'_{ret}) = \sum_{k_i \in K'_{ret}} \lambda(q, k_i) \cdot p(y|q, k_i)
\]

where \( K'_{ret} \) denotes the filtered knowledge set. Note that when \( K'_{ret} = \varnothing \), our method degenerates into the standard non-retrieval generation. Furthermore, \( \lambda(q, k_i) \) represents the weight assigned to each
<table>
  <tr>
    <th>Methods</th>
    <th>SST-2</th>
    <th>SST-5</th>
    <th>CR</th>
    <th>MR</th>
    <th>MPQA</th>
    <th>CoLA</th>
    <th>TREC</th>
    <th>Average</th>
  </tr>
  <tr>
    <th colspan="9">w/o Retrieval</th>
  </tr>
  <tr>
    <td>T5-Large</td>
    <td>92.43</td>
    <td>48.39</td>
    <td>90.75</td>
    <td>78.35</td>
    <td>84.10</td>
    <td>64.60</td>
    <td>76.20</td>
    <td>76.40</td>
  </tr>
  <tr>
    <td>Roberta-Large</td>
    <td>74.74</td>
    <td>40.60</td>
    <td>89.40</td>
    <td>81.15</td>
    <td>57.85</td>
    <td>67.21</td>
    <td>73.00</td>
    <td>69.14</td>
  </tr>
  <tr>
    <td>ICL*</td>
    <td>91.17</td>
    <td>46.00</td>
    <td>73.20</td>
    <td>61.70</td>
    <td>71.60</td>
    <td>72.29</td>
    <td>74.80</td>
    <td>70.11</td>
  </tr>
  <tr>
    <td>LM-BFF*</td>
    <td>90.80</td>
    <td>49.00</td>
    <td>89.05</td>
    <td>83.50</td>
    <td>86.40</td>
    <td>53.69</td>
    <td>70.60</td>
    <td>74.72</td>
  </tr>
  <tr>
    <th colspan="9">w/ Retrieval</th>
  </tr>
  <tr>
    <td>GPT-4o</td>
    <td>91.63</td>
    <td>52.01</td>
    <td>90.50</td>
    <td>88.65</td>
    <td>87.20</td>
    <td>78.62</td>
    <td>73.20</td>
    <td>80.26</td>
  </tr>
  <tr>
    <td>Direct RAG</td>
    <td>91.74</td>
    <td>52.56</td>
    <td>89.35</td>
    <td>87.05</td>
    <td>86.30</td>
    <td>77.47</td>
    <td>90.80</td>
    <td>82.18</td>
  </tr>
  <tr>
    <td>FiD</td>
    <td>91.05</td>
    <td>52.46</td>
    <td>90.20</td>
    <td>78.35</td>
    <td>84.10</td>
    <td>64.62</td>
    <td>76.20</td>
    <td>76.71</td>
  </tr>
  <tr>
    <td>PGRA</td>
    <td>92.43</td>
    <td>53.82</td>
    <td>90.30</td>
    <td>78.00</td>
    <td>82.95</td>
    <td>70.80</td>
    <td>76.00</td>
    <td>77.76</td>
  </tr>
  <tr>
    <td>RECOMP</td>
    <td>92.31</td>
    <td>53.64</td>
    <td>90.65</td>
    <td>87.75</td>
    <td>87.85</td>
    <td>76.99</td>
    <td>89.20</td>
    <td>82.63</td>
  </tr>
  <tr>
    <td>SKR</td>
    <td>93.34</td>
    <td>54.09</td>
    <td>91.50</td>
    <td>88.45</td>
    <td>86.95</td>
    <td>78.04</td>
    <td>88.60</td>
    <td>83.00</td>
  </tr>
  <tr>
    <th>Ours</th>
    <th><b>94.50</b></th>
    <th><b>55.68</b></th>
    <th><b>92.85</b></th>
    <th><b>90.20</b></th>
    <th><b>89.45</b></th>
    <th><b>81.78</b></th>
    <th><b>93.40</b></th>
    <th><b>85.41</b></th>
  </tr>
</table>

Table 1: Comparison with baselines. * denoted we partially refer to the results from other papers (Guo et al., 2023) .

\[
\lambda(q, k_i) = \alpha \operatorname{sim}(q, k_i) + (1 - \alpha) P_x(a|q, k_i)
\] (8)

where \( P_x(a|q, k_i) \) corresponds to the probability of harmlessness estimated by the LLM or the proxy model, and \( \alpha \) controls the balance of two factors.

4 Experiment

4.1 Datasets & Metric

This study evaluates our proposed framework using datasets from three distinct text classification tasks: (1) Linguistic Acceptability: CoLA (Warstadt, 2019), assessing the grammatical acceptability of English sentences. (2) Question Classification: TREC (Li and Roth, 2002), classifying questions into six predefined categories. (3) Sentiment Analysis: SST-2 and SST-5 (Socher et al., 2013) for determining the sentiment polarity of sentences into two or five categories; MR (Pang and Lee, 2004) from the movie review domain; MPQA (Wiebe et al., 2005) from the news opinion domain; and CR (Ding et al., 2008) from the product review domain. We adopt accuracy as the evaluation metric for all datasets and follow the data splits from LM-BFF (Gao et al., 2020). The statistics of the datasets are presented in Table 2, while a detailed description of each dataset is provided in Table 6 in the appendix. The implementation details of our approach are discussed in Appendix A.

<table>
  <tr>
    <th>Datasets</th>
    <th>Train</th>
    <th>Dev</th>
    <th>Test</th>
    <th>Label</th>
    <th>Len</th>
  </tr>
  <tr>
    <td>CoLA</td>
    <td>32</td>
    <td>32</td>
    <td>1,043</td>
    <td>2</td>
    <td>8</td>
  </tr>
  <tr>
    <td>TREC</td>
    <td>96</td>
    <td>96</td>
    <td>500</td>
    <td>6</td>
    <td>10</td>
  </tr>
  <tr>
    <td>SST-2</td>
    <td>32</td>
    <td>32</td>
    <td>872</td>
    <td>2</td>
    <td>19</td>
  </tr>
  <tr>
    <td>SST-5</td>
    <td>79</td>
    <td>79</td>
    <td>2,209</td>
    <td>5</td>
    <td>18</td>
  </tr>
  <tr>
    <td>MR</td>
    <td>32</td>
    <td>32</td>
    <td>2,000</td>
    <td>2</td>
    <td>20</td>
  </tr>
  <tr>
    <td>MPQA</td>
    <td>32</td>
    <td>32</td>
    <td>2,000</td>
    <td>2</td>
    <td>3</td>
  </tr>
  <tr>
    <td>CR</td>
    <td>32</td>
    <td>32</td>
    <td>2,000</td>
    <td>2</td>
    <td>19</td>
  </tr>
</table>

Table 2: Statistics of datasets. Label denotes the number of candidate labels. Len represents the length of the input content.

employs prompt-based fine-tuning to enhance few-shot performance; ICL utilizes OPT-13B (Zhang et al., 2023) with eight task-specific demonstrations without fine-tuning; For methods with retrieval, Direct RAG incorporates retrieved knowledge directly into the LLaMA3-8B model’s prompt for generation; GPT-4o (OpenAI, 2024) is the state-of-the-art large language model released by OpenAI; FiD (Izacard and Grave, 2021) adopts a generative approach by aggregating information from multiple documents; PGRA (Guo et al., 2023) employs a two-stage framework for re-ranking retrieved knowledge; SKR (Wang et al., 2023c) retrieves external knowledge based on problem’s complexity adaptively; RECOMP (Xu et al., 2023) enhances performance by compressing retrieved knowledge.

As demonstrated in Table 1, large language models relying exclusively on ICL show significant limitations in achieving competitive performance, even underperforming small models (e.g., T5-Large). This can be attributed to ICL’s sensitivity to demonstration quality, which often results in suboptimal performance. Our analysis reveals that retrieval-augmented methods consistently outperform those without retrieval, confirming the necessity of external knowledge for discriminative tasks. Notably, while advanced retrieval-augmented methods such
<table>
  <tr>
    <th>Methods</th>
    <th>SST-2</th>
    <th>SST-5</th>
    <th>CR</th>
    <th>MR</th>
    <th>MPQA</th>
    <th>CoLA</th>
    <th>TREC</th>
    <th>Average</th>
  </tr>
  <tr>
    <td>Direct RAG</td>
    <td>91.74</td>
    <td>52.56</td>
    <td>89.35</td>
    <td>87.05</td>
    <td>86.30</td>
    <td>77.47</td>
    <td>90.80</td>
    <td>82.18</td>
  </tr>
  <tr>
    <td colspan="9">w/ Knowledge Filtering</td>
  </tr>
  <tr>
    <td>Direct Prediction</td>
    <td>92.07</td>
    <td>51.65</td>
    <td>91.10</td>
    <td>87.15</td>
    <td>87.95</td>
    <td>77.95</td>
    <td>90.20</td>
    <td>82.58</td>
  </tr>
  <tr>
    <td>In-Context Prediction</td>
    <td>93.12</td>
    <td>52.92</td>
    <td>91.50</td>
    <td>88.25</td>
    <td>87.50</td>
    <td>76.51</td>
    <td>90.80</td>
    <td>82.94</td>
  </tr>
  <tr>
    <td>Proxy Model</td>
    <td>92.20</td>
    <td>53.28</td>
    <td>91.45</td>
    <td>87.80</td>
    <td>88.50</td>
    <td>79.58</td>
    <td>89.60</td>
    <td>83.20</td>
  </tr>
  <tr>
    <td>Ensemble Prediction</td>
    <td>93.00</td>
    <td>54.14</td>
    <td>91.90</td>
    <td>87.60</td>
    <td>88.40</td>
    <td>80.15</td>
    <td>92.00</td>
    <td>83.88</td>
  </tr>
  <tr>
    <td colspan="9">w/ Prediction Fusion</td>
  </tr>
  <tr>
    <td>Ours</td>
    <td><b>94.50</b></td>
    <td><b>55.68</b></td>
    <td><b>92.85</b></td>
    <td><b>90.20</b></td>
    <td><b>89.45</b></td>
    <td><b>81.78</b></td>
    <td><b>93.40</b></td>
    <td><b>85.41</b></td>
  </tr>
</table>

Table 3: The effects of knowledge filtering and prediction fusion.

<table>
  <tr>
    <th rowspan="2">Methods</th>
    <th colspan="3">CR</th>
    <th colspan="3">MPQA</th>
    <th colspan="3">MR</th>
    <th colspan="3">SST-5</th>
  </tr>
  <tr>
    <th>P</th>
    <th>R</th>
    <th>F</th>
    <th>P</th>
    <th>R</th>
    <th>F</th>
    <th>P</th>
    <th>R</th>
    <th>F</th>
    <th>P</th>
    <th>R</th>
    <th>F</th>
  </tr>
  <tr>
    <td>Direct</td>
    <td>41.7</td>
    <td>11.6</td>
    <td>18.2</td>
    <td>39.3</td>
    <td>23.9</td>
    <td>29.7</td>
    <td>49.4</td>
    <td>30.3</td>
    <td>37.6</td>
    <td>48.5</td>
    <td>40.4</td>
    <td>44.1</td>
  </tr>
  <tr>
    <td>In-Context</td>
    <td>59.4</td>
    <td>95.3</td>
    <td>73.2</td>
    <td>51.7</td>
    <td>100.0</td>
    <td>68.1</td>
    <td>58.3</td>
    <td>94.4</td>
    <td>72.0</td>
    <td>54.0</td>
    <td>66.9</td>
    <td>59.8</td>
  </tr>
  <tr>
    <td>Proxy</td>
    <td>86.0</td>
    <td>100.0</td>
    <td>92.5</td>
    <td>83.7</td>
    <td>89.1</td>
    <td>86.3</td>
    <td>86.5</td>
    <td>94.4</td>
    <td>90.2</td>
    <td>84.9</td>
    <td>88.8</td>
    <td>86.8</td>
  </tr>
  <tr>
    <td>Ensemble</td>
    <td>89.5</td>
    <td>100.0</td>
    <td>94.5</td>
    <td>82.1</td>
    <td>100.0</td>
    <td>90.2</td>
    <td>87.7</td>
    <td>95.8</td>
    <td>90.9</td>
    <td>88.1</td>
    <td>92.9</td>
    <td>90.4</td>
  </tr>
</table>

Table 4: The performance of strategies on knowledge filtering.

as SKR and RECOMP incorporate sophisticated mechanisms like problem filtering and knowledge compression, their performance improvements over Direct RAG remain marginal. This suggests that these advanced strategies still struggle to eliminate the influence of harmful knowledge.

In comparison, our framework achieves significant performance improvements over baseline models across all tasks, demonstrating its superior effectiveness and robust generalization capabilities.

4.3 Impact of Filtering Strategies and Prediction Fusion

This section conducts an ablation study to evaluate two critical components of our framework. We take Direct RAG as the baseline and investigate the effectiveness of four distinct filtering strategies alongside prediction fusion.

As illustrated in Table 3, the performance of Direct Prediction barely surpasses the baseline, suggesting that LLMs struggle to assess the harmfulness of knowledge by themselves. When supplemented with task demonstrations for harmful knowledge identification, the performance of In-Context Prediction achieves improvement across most datasets. However, the decline in performance observed in certain datasets can be attributed to the suboptimal quality of task demonstrations. Proxy Model demonstrates superior performance compared to both LLM-based approaches, indicating that fine-tuning a smaller model can achieve higher accuracy without manually providing demonstrations. Ensemble Prediction outperforms all other strategies, demonstrating the complementary nature of our proposed methods. Dynamic adjustment of strategies based on sample difficulty enables full exploitation of their respective advantages.

While knowledge filtering has achieved considerable performance improvement, the integration of prediction fusion yields optimal results. This indicates that weighted consideration of each piece of knowledge can indeed mitigate the risk of model misguidance by a single piece of knowledge.

5 Analysis and Discussion

5.1 Performance of Strategies on Knowledge Filtering

Although we have demonstrated the effectiveness of the filtering strategies, it remains unclear whether the improvement stems from the removal of harmful knowledge. To address this gap, we conduct a comprehensive analysis across four representative datasets and evaluate the performance of four strategies in filtering harmful knowledge using F1 scores. Given that the objective of filtering is to prevent the introduction of harmful knowledge, we provide the performance of strategies on "Harmful" label rather than the overall.

As shown in Table 4, Direct exhibits consistently inferior performance across evaluation metrics, indicating that LLMs struggle to accurately assess the harmfulness of knowledge without demonstrations. In-Context achieves a substantial improvement in Recall (even reaching 100%) by incorporating task demonstrations. However, this comes at the expense of Precision, indicating excessive false positives in classification. Proxy further improves Precision while maintaining Recall. Ensemble achieves the optimal filtering performance by integrating
the strengths of these strategies, demonstrating that the proposed strategies are complementary and can jointly enhance filtering performance. Furthermore, we observe a positive correlation between filtering effectiveness and overall model performance, suggesting that the model improvements are indeed driven by the elimination of harmful knowledge.

5.2 Effects of Different Retrievers
While our framework demonstrates effectiveness within dense retrievers (e.g., BGE), such retrievers are constrained by computational cost and storage requirements. This leads to a critical question: Can our framework maintain its effectiveness when implemented with lightweight sparse retrievers such as BM25? To address this gap, we conduct evaluations across multiple datasets using BM25 as the retriever, comparing two scenarios: (1) Direct incorporates the retrieved knowledge directly, and (2) Ours employs the proposed framework to filter the retrieved knowledge. For comparison, we adopt the BGE-based method as the baseline.

As illustrated in Figure 6, the overall performance of BM25 is significantly lower compared to the baseline, primarily due to its limited semantic matching capabilities. This limitation results in the retrieval of irrelevant or even harmful knowledge that may compromise model performance. Nevertheless, when our proposed framework is employed, we observe significant performance improvements, indicating its ability to eliminate harmful knowledge from different retrievers. These results confirm our framework’s capability of knowledge filtering and cross-retriever adaptability.

![A radar chart showing the performance of different retrievers on various datasets](page_184_120_579_377.png)
Figure 6: The performance of different retrievers.

![A bar chart showing the influence of strategies on perplexity](page_728_120_579_377.png)
Figure 7: The influence of strategies on perplexity.

5.3 Impact of Filtering Strategies on PPL
Our annotation strategy leverages changes in perplexity (PPL) to assess whether a given piece of knowledge is harmful. However, the effectiveness of this annotation strategy in optimizing the final model PPL remains uncertain. We therefore conduct experiments to investigate the changes in the final model PPL across three datasets using proposed filtering strategies. We employ the model without filtering as a baseline for comparison.

As illustrated in Figure 7, Direct exhibits limited ability to assess knowledge harmfulness when lacking task-specific guidances. While incorporating task demonstrations further reduces model PPL, the effectiveness of In-Context is highly dependent on the quality of the provided demonstrations. This limitation is particularly evident in the CoLA dataset, where the suboptimal quality of demonstrations resulted in a substantial PPL increase. Proxy achieves significant model PPL reduction but its performance isn’t stable. Ensemble demonstrates the lowest PPL while maintaining consistent performance across all datasets, validating the robustness and effectiveness of our ensemble mechanism.

5.4 Effects of Different Knowledge for Prediction Fusion
To investigate whether the effectiveness of prediction fusion stems exclusively from its mechanism design, we conduct experiments to analyze the influence of knowledge quality on model performance. Specifically, we compare the performance variations before and after applying prediction fusion using random knowledge, with filtered knowledge serving as the baseline for comparison.

As shown in Figure 8, the introduction of random knowledge results in a substantial performance degradation of the model compared to the
Figure 8: The performance of prediction fusion under different quality of knowledge.

baseline. We suppose that this decline is primarily caused by the introduction of irrelevant and harmful information present in random knowledge. When applying batch-wise prediction fusion to random knowledge, we observe a general performance decline rather than improvement across most datasets. This phenomenon suggests that considerable irrelevant information in random knowledge will compromise the fusion process. Furthermore, this also validates that the performance improvements achieved by prediction fusion are not only derived from its mechanism design but also depend on high-quality filtered knowledge. In general, the components within our framework are complementary, collectively contributing to significant improvements in model performance.

6 Related Works

6.1 Retrieval-Augmented Generation
Retrieval-Augmented methods have been widely applied since the era of pre-trained models (Liu, 2019), achieving significant progress in many NLP tasks such as dialogue generation (Wu et al., 2019) and question answering (Izacard and Grave, 2020; Wang et al., 2024). With the emergence of large language models, RAG has been further utilized to alleviate problems such as hallucinations in LLMs (Shao et al., 2023). The mainstream approach to solving generative tasks follows Retrieve-then-Read paradigm (Yoran et al., 2023). Recent research has primarily focused on improving important components in RAG systems: query augmenter (Tan et al., 2024), paragraph retriever (Shi et al., 2023b), and generator (Jin et al., 2024).

Since retrieved knowledge is not always helpful, especially when the internal knowledge of LLMs is sufficient to answer the question (Shi et al., 2023a). To mitigate this problem, mainstream approaches can be divided into two categories: 1) Pre-retrieval methods, which aim to determine whether retrieval is necessary for a given query: Wang et al. (2023c) proposes using a small classification model or the LLM itself to analyze queries in order to determine whether the LLM can rely on its own knowledge to provide an answer. Tan et al. (2024) proposes using a proxy model to first generate a pseudo-answer, which is then used to determine whether the LLM needs to retrieve external knowledge. 2) Post-retrieval methods, which focus on optimizing the retrieved knowledge in various ways: Since the generator is a black-box model, Yang et al. (2023) proposes training an adapter through reinforcement learning to compress the retrieved knowledge. Zhu et al. (2024) introduces the information bottleneck theory to optimize the noise filter from a comprehensive perspective, aiming to optimize the retrieved passages by simultaneously maximizing useful information and minimizing noise.

6.2 Discriminative Tasks
The current mainstream methods for discriminative tasks can be divided into the following categories: Tree-based (Khandagale et al., 2020; Wang et al., 2022; Bao et al., 2023), Graph-based (Ye et al., 2021; Xu et al., 2021), Embedding-based (Chen et al., 2020; Gweon and Schonlau, 2024) and Ensemble-based approaches (Zhao et al., 2022; Liu et al., 2022). Bao et al. (2023) proposes a novel opinion tree parsing model to extract all sentiment elements from opinion trees. Zhao et al. (2025) proposes an instruction augmentation approach to enhance the performance of emotion classification, which does not rely on labeled instances. Although significant progress has been made in these tasks, few studies have attempted to leverage external knowledge for completion.

Existing RAG methods struggle to accurately identify retrieval requirements, while compression techniques cannot completely discard harmful knowledge. Furthermore, the integration of external knowledge is often overlooked in discriminative task research. To address this gap, our framework aims to apply RAG to discriminative tasks and enhance performance from the perspective of knowledge filtering. Notably, our approach prevents the missing of potentially helpful information due to the misidentification of retrieval requirements. Furthermore, in scenarios where all retrieved knowledge is harmful, our filtering strategies can discard all knowledge and degenerate to standard non-retrieval generation.
7 Conclusion

In this study, we propose a novel framework to enhance the performance of RAG in discriminative tasks by introducing knowledge filtering and prediction fusion mechanisms. Specifically, our method first employs a perplexity-based annotation method to collect training data for subsequent procedures. Then, we propose four strategies to effectively filter out harmful knowledge. Finally, we integrate the filtered knowledge via batch-wise predictions to generate the final results. We conduct extensive experiments across multiple datasets, and the experimental results demonstrate that our framework significantly enhances model performance.

Limitations

The limitations of our work lie in below: The integration of additional filtering processes for the retrieved knowledge within our framework inevitably heightens the overall time complexity. While these processes are designed to enhance the quality and relevance of the knowledge used, the trade-off is a less efficient retrieval pipeline compared to simpler methodologies.

Acknowledgments

We would like to thank Prof. Zhongqing Wang for his helpful advice and discussion during this work. Also, we would like to express our gratitude to the five anonymous reviewers for their insightful comments on this paper. This research was supported by the National Natural Science Foundation of China (No. 62376178), and Project Funded by the Priority Academic Program Development of Jiangsu Higher Education Institutions.

References

Xiaoyi Bao, Xiaotong Jiang, Zhongqing Wang, Yue Zhang, and Guodong Zhou. 2023. Opinion tree parsing for aspect-based sentiment analysis. In Findings of the Association for Computational Linguistics: ACL 2023, pages 7971–7984.

Sam Boshar, Evan Trop, Bernardo P de Almeida, Liviu Copoiu, and Thomas Pierrot. 2024. Are genomic language models all you need? exploring genomic language models on protein downstream tasks. Bioinformatics, 40(9):btae529.

Boli Chen, Xin Huang, Lin Xiao, Zixin Cai, and Liping Jing. 2020. Hyperbolic interaction model for hierarchical multi-label classification. In Proceedings of the AAAI conference on artificial intelligence, volume 34, pages 7496–7503.

Daixuan Cheng, Shaohan Huang, Junyu Bi, Yuefeng Zhan, Jianfeng Liu, Yujing Wang, Hao Sun, Furu Wei, Denvy Deng, and Qi Zhang. 2023. Uprise: Universal prompt retrieval for improving zero-shot evaluation. arXiv preprint arXiv:2303.08518.

Xiaowen Ding, Bing Liu, and Philip S Yu. 2008. A holistic lexicon-based approach to opinion mining. In Proceedings of the 2008 international conference on web search and data mining, pages 231–240.

Abhimanyu Dubey, Abhinav Jauhari, Abhinav Pandey, Abhishek Kadian, Ahmad Al-Dahle, Aiesha Letman, Akhil Mathur, Alan Schelten, Amy Yang, Angela Fan, et al. 2024. The llama 3 herd of models. arXiv preprint arXiv:2407.21783.

Wenqi Fan, Yujuan Ding, Liangbo Ning, Shijie Wang, Hengyun Li, Dawei Yin, Tat-Seng Chua, and Qing Li. 2024. A survey on rag meeting llms: Towards retrieval-augmented large language models. In Proceedings of the 30th ACM SIGKDD Conference on Knowledge Discovery and Data Mining, pages 6491–6501.

Tianyu Gao, Adam Fisch, and Danqi Chen. 2020. Making pre-trained language models better few-shot learners. arXiv preprint arXiv:2012.15723.

Tianyu Gao, Xingcheng Yao, and Danqi Chen. 2021. Simcse: Simple contrastive learning of sentence embeddings. arXiv preprint arXiv:2104.08821.

Zhicheng Guo, Sijie Cheng, Yile Wang, Peng Li, and Yang Liu. 2023. Prompt-guided retrieval augmentation for non-knowledge-intensive tasks. arXiv preprint arXiv:2305.17653.

Hyukjun Gweon and Matthias Schonlau. 2024. Automated classification for open-ended questions with bert. Journal of Survey Statistics and Methodology, 12(2):493–504.

Md Arid Hasan, Shudipta Das, Afiyat Anjum, Firoj Alam, Anika Anjum, Avijit Sarker, and Sheak Rashed Haider Noori. 2024. Zero-and few-shot prompting with llms: A comparative study with fine-tuned models for bangla sentiment analysis. In Proceedings of the 2024 Joint International Conference on Computational Linguistics, Language Resources and Evaluation (LREC-COLING 2024), pages 17808–17818.

Gautier Izacard and Edouard Grave. 2020. Leveraging passage retrieval with generative models for open domain question answering. arXiv preprint arXiv:2007.01282.

Gautier Izacard and Édouard Grave. 2021. Leveraging passage retrieval with generative models for open domain question answering. In Proceedings of the 16th Conference of the European Chapter of the Association for Computational Linguistics: Main Volume, pages 874–880.
Jiajie Jin, Yutao Zhu, Yujia Zhou, and Zhicheng Dou. 2024. Bider: Bridging knowledge inconsistency for efficient retrieval-augmented llms via key supporting evidence. arXiv preprint arXiv:2402.12174.

Jeff Johnson, Matthijs Douze, and Hervé Jégou. 2019. Billion-scale similarity search with gpus. IEEE Transactions on Big Data, 7(3):535–547.

Nikhil Kandpal, Haikang Deng, Adam Roberts, Eric Wallace, and Colin Raffel. 2023. Large language models struggle to learn long-tail knowledge. In International Conference on Machine Learning, pages 15696–15707. PMLR.

Sujay Khandagale, Han Xiao, and Rohit Babbar. 2020. Bonsai: diverse and shallow trees for extreme multi-label classification. Machine Learning, 109(11):2099–2119.

Xin Li and Dan Roth. 2002. Learning question classifiers. In COLING 2002: The 19th International Conference on Computational Linguistics.

Ming Liu, He Zhang, Yangjie Tian, Tianrui Zong, Borui Cai, Ruohua Xu, and Yunfeng Li. 2022. Overview of nlpc2022 shared task 5 track 1: Multi-label classification for scientific literature. In CCF International Conference on Natural Language Processing and Chinese Computing, pages 320–327. Springer.

Yinhan Liu. 2019. Roberta: A robustly optimized bert pretraining approach. arXiv preprint arXiv:1907.11692, 364.

Yubo Ma, Yixin Cao, YongChing Hong, and Aixin Sun. 2023. Large language model is not a good few-shot information extractor, but a good reranker for hard samples! arXiv preprint arXiv:2303.08559.

OpenAI. 2024. Hello, gpt-40.

Bo Pang and Lillian Lee. 2004. A sentimental education: Sentiment analysis using subjectivity summarization based on minimum cuts. arXiv preprint cs/0409058.

Colin Raffel, Noam Shazeer, Adam Roberts, Katherine Lee, Sharan Narang, Michael Matena, Yanqi Zhou, Wei Li, and Peter J Liu. 2020. Exploring the limits of transfer learning with a unified text-to-text transformer. Journal of machine learning research, 21(140):1–67.

Zhihong Shao, Yeyun Gong, Yelong Shen, Minlie Huang, Nan Duan, and Weizhu Chen. 2023. Enhancing retrieval-augmented large language models with iterative retrieval-generation synergy. arXiv preprint arXiv:2305.15294.

Freda Shi, Xinyun Chen, Kanishka Misra, Nathan Scales, David Dohan, Ed H Chi, Nathanael Schäftl, and Denny Zhou. 2023a. Large language models can be easily distracted by irrelevant context. In International Conference on Machine Learning, pages 31210–31227. PMLR.

Weijia Shi, Sewon Min, Michihiro Yasunaga, Minjoon Seo, Rich James, Mike Lewis, Luke Zettlemoyer, and Wen-tau Yih. 2023b. Replug: Retrieval-augmented black-box language models. arXiv preprint arXiv:2301.12652.

Richard Socher, Alex Perelygin, Jean Wu, Jason Chuang, Christopher D Manning, Andrew Y Ng, and Christopher Potts. 2013. Recursive deep models for semantic compositionality over a sentiment treebank. In Proceedings of the 2013 conference on empirical methods in natural language processing, pages 1631–1642.

Jiejun Tan, Zhicheng Dou, Yutao Zhu, Peidong Guo, Kun Fang, and Ji-Rong Wen. 2024. Small models, big insights: Leveraging slim proxy models to decide when and what to retrieve for llms. arXiv preprint arXiv:2402.12052.

Neeraj Varshney, Man Luo, and Chitta Baral. 2022. Can open-domain qa reader utilize external knowledge efficiently like humans? arXiv preprint arXiv:2211.12707.

Haoyu Wang, Ruirui Li, Haoming Jiang, Jinjin Tian, Zhengyang Wang, Chen Luo, Xianfeng Tang, Monica Cheng, Tuo Zhao, and Jing Gao. 2024. Blendfilter: Advancing retrieval-augmented large language models via query generation blending and knowledge filtering. arXiv preprint arXiv:2402.11129.

Jiaan Wang, Yunlong Liang, Fandong Meng, Beiqi Zou, Zhixu Li, Jianfeng Qu, and Jie Zhou. 2023a. Zero-shot cross-lingual summarization via large language models. arXiv preprint arXiv:2302.14229.

Xiao Wang, Weikang Zhou, Can Zu, Han Xia, Tianze Chen, Yuansen Zhang, Rui Zheng, Junjie Ye, Qi Zhang, Tao Gui, et al. 2023b. Instructue: Multi-task instruction tuning for unified information extraction. arXiv preprint arXiv:2304.08085.

Yile Wang, Peng Li, Maosong Sun, and Yang Liu. 2023c. Self-knowledge guided retrieval augmentation for large language models. arXiv preprint arXiv:2310.05002.

Zihan Wang, Peiyi Wang, Tianyu Liu, Binghuai Lin, Yunbo Cao, Zhifang Sui, and Houfeng Wang. 2022. Hpt: Hierarchy-aware prompt tuning for hierarchical text classification. arXiv preprint arXiv:2204.13413.

A Warstadt. 2019. Neural network acceptability judgments. arXiv preprint arXiv:1805.12471.

Janyce Wiebe, Theresa Wilson, and Claire Cardie. 2005. Annotating expressions of opinions and emotions in language. Language resources and evaluation, 39:165–210.

Yu Wu, Furu Wei, Shaohan Huang, Yunli Wang, Zhoujun Li, and Ming Zhou. 2019. Response generation by context-aware prototype editing. In Proceedings of the AAAI Conference on Artificial Intelligence, volume 33, pages 7281–7288.
Shitao Xiao, Zheng Liu, Peitian Zhang, and Niklas Muennighoff. 2023. C-pack: Packaged resources to advance general chinese embedding. Preprint, arXiv:2309.07597.

Fangyuan Xu, Weijia Shi, and Eunsol Choi. 2023. Recomp: Improving retrieval-augmented lms with compression and selective augmentation. arXiv preprint arXiv:2310.04408.

Linli Xu, Sijie Teng, Ruoyu Zhao, Junliang Guo, Chi Xiao, Deqiang Jiang, and Bo Ren. 2021. Hierarchical multi-label text classification with horizontal and vertical category correlations. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pages 2459–2468.

Haoyan Yang, Zhitao Li, Yong Zhang, Jianzong Wang, Ning Cheng, Ming Li, and Jing Xiao. 2023. Prca: Fitting black-box large language models for retrieval question answering via pluggable reward-driven contextual adapter. arXiv preprint arXiv:2310.18347.

Chenchen Ye, Linhai Zhang, Yulan He, Deyu Zhou, and Jie Wu. 2021. Beyond text: Incorporating metadata and label structure for multi-label document classification using heterogeneous graphs. In Proceedings of the 2021 Conference on Empirical Methods in Natural Language Processing, pages 3162–3171.

Ori Yoran, Tomer Wolfson, Ori Ram, and Jonathan Berant. 2023. Making retrieval-augmented language models robust to irrelevant context. arXiv preprint arXiv:2310.01558.

Susan Zhang, Stephen Roller, Naman Goyal, Mikel Artetxe, Moya Chen, Shuhui Chen, Christopher Dewan, Mona Diab, Xian Li, Xi Victoria Lin, et al. 2023. Opt: Open pre-trained transformer language models, 2022. URL https://arxiv.org/abs/2205.01068, 3:19–0.

Zhuosheng Zhang, Aston Zhang, Mu Li, and Alex Smola. 2022. Automatic chain of thought prompting in large language models. arXiv preprint arXiv:2210.03493.

Xiuhao Zhao, Zhao Li, Xianming Zhang, Jibin Wang, Tong Chen, Zhengyu Ju, Canjun Wang, Chao Zhang, and Yiming Zhan. 2022. An interactive fusion model for hierarchical multi-label text classification. In CCF International Conference on Natural Language Processing and Chinese Computing, pages 168–178. Springer.

Yang Zhao, Masayasu Muraoka, Issei Yoshida, Bishwaranjan Bhattacharjee, and Hiroshi Kanayama. 2025. A simple-yet-efficient instruction augmentation method for zero-shot sentiment classification. In Proceedings of the 31st International Conference on Computational Linguistics, pages 1585–1599.

Chunting Zhou, Graham Neubig, Jiatao Gu, Mona Diab, Francisco Guzmán, Luke Zettlemoyer, and Marjan Ghazvininejad. 2021. Detecting hallucinated content in conditional neural sequence generation. In Findings of the Association for Computational Linguistics: ACL-IJCNLP 2021, pages 1393–1404.

Kun Zhu, Xiaocheng Feng, Xiyuan Du, Yuxuan Gu, Weijiang Yu, Haotian Wang, Qianglong Chen, Zheng Chu, Jingchang Chen, and Bing Qin. 2024. An information bottleneck perspective for effective noise filtering on retrieval-augmented generation. arXiv preprint arXiv:2406.01549.

<table>
  <tr>
    <th>Datasets</th>
    <th>LR</th>
    <th>Lora_alpha</th>
    <th>Lora_rank</th>
  </tr>
  <tr>
    <td>CoLA</td>
    <td>3e-4</td>
    <td>16</td>
    <td>8</td>
  </tr>
  <tr>
    <td>TREC</td>
    <td>3e-4</td>
    <td>16</td>
    <td>8</td>
  </tr>
  <tr>
    <td>SST-2</td>
    <td>5e-5</td>
    <td>16</td>
    <td>8</td>
  </tr>
  <tr>
    <td>SST-5</td>
    <td>5e-5</td>
    <td>16</td>
    <td>8</td>
  </tr>
  <tr>
    <td>MR</td>
    <td>5e-5</td>
    <td>16</td>
    <td>8</td>
  </tr>
  <tr>
    <td>MPQA</td>
    <td>3e-4</td>
    <td>16</td>
    <td>8</td>
  </tr>
  <tr>
    <td>CR</td>
    <td>5e-5</td>
    <td>16</td>
    <td>8</td>
  </tr>
</table>

Table 5: The training parameter of different datasets.

A Implementation

For the external knowledge base, we employ the Wiki-1M (Gao et al., 2021) where each piece of knowledge is presented as individual sentences rather than paragraph-level chunks. For the retrieval stage, we utilize the BGE model1 as our dense retriever and retain the top-30 most relevant knowledge. During the stage of knowledge filtering, we constrain the amount of knowledge utilized for subsequent augmentation to a maximum of eight. It is noteworthy that the quantity of filtered knowledge may potentially be zero (indicating all retrieved knowledge is harmful), in which case our approach degenerates into a non-retrieval generation.

Our approach adopts LLaMA3-8B 2 as the backbone of our framework. We employ parameter-efficient adaptation through Low-Rank Adaptation (LoRA) to fine-tune the model for each dataset and the detailed training hyperparameters are documented in Table 5. During inference, we employ greedy decoding for the reasons described in Appendix D. All experiments are conducted on an NVIDIA Tesla A100 64G GPU.

For our experiments with GPT-4o, we evaluate the model on our dataset using the OpenAI Fine-tuning API3. The prompt "Read knowledge and the

1https://huggingface.co/BAAL/bge-large-en-v1.5
2https://huggingface.co/meta-llama/Llama-3.1-8B-Instruct
3https://platform.openai.com/finetune
<table>
  <tr>
    <th>Datasets</th>
    <th>Category</th>
    <th>Input</th>
    <th>Candidate Labels</th>
  </tr>
  <tr>
    <td>CoLA</td>
    <td>Linguistic Acceptability</td>
    <td>Sentence</td>
    <td>Incorrect; Correct</td>
  </tr>
  <tr>
    <td>TREC</td>
    <td>Question Classification</td>
    <td>Sentence</td>
    <td>Desc.; Entity; Abbr.; Person; Location; Quantity</td>
  </tr>
  <tr>
    <td>SST-2</td>
    <td>Sentiment Analysis</td>
    <td>Sentence</td>
    <td>Negative; Positive</td>
  </tr>
  <tr>
    <td>SST-5</td>
    <td>Sentiment Analysis</td>
    <td>Sentence</td>
    <td>Terrible; Bad; Neutral; Good; Excellent</td>
  </tr>
  <tr>
    <td>MR</td>
    <td>Sentiment Analysis</td>
    <td>Sentence</td>
    <td>Negative; Positive</td>
  </tr>
  <tr>
    <td>MPQA</td>
    <td>Sentiment Analysis</td>
    <td>Sentence</td>
    <td>Negative; Positive</td>
  </tr>
  <tr>
    <td>CR</td>
    <td>Sentiment Analysis</td>
    <td>Sentence</td>
    <td>Negative; Positive</td>
  </tr>
</table>

Table 6: The description of datasets. Desc is short for Description and Abbr is short for Abbreviation.

![Line chart showing the performance of different amounts of knowledge across CR, MPQA, CoLA, and TREC datasets.](page_184_370_495_246.png)

Figure 9: The performance of different amounts of knowledge.

sentence, predict the sentiment of the sentence as < Candidate Labels > " is chosen empirically for its strong performance. During the generation stage, the temperature is set to 0.0, ensuring consistency with our approach.

B Impact of Different Amounts of Knowledge

The incorporation of external knowledge has proven beneficial for discriminative tasks. However, an important question arises: Does increasing the amounts of knowledge consistently enhance model performance? To address this gap, we investigate the effect of varying the amounts of knowledge on model performance across four datasets.

As illustrated in Figure 9, the performance of the model exhibits the expected upward trend as more retrieved knowledge is gradually incorporated. Nevertheless, when the knowledge quantity surpasses an optimal threshold, further increases in knowledge result not in continued improvement but rather in performance degradation. We hypothesize that this decline may stem from the excessive amounts of knowledge imposing a cognitive burden on the model. This heightened burden could render the model more vulnerable to the misleading influence of certain pieces of knowledge, thereby adversely impacting its overall performance.

<table>
  <tr>
    <th>Methods</th>
    <th>CR</th>
    <th>MPQA</th>
    <th>CoLA</th>
    <th>TREC</th>
    <th>Avg.</th>
  </tr>
  <tr>
    <td>ICL</td>
    <td>86.7</td>
    <td>79.7</td>
    <td>78.1</td>
    <td>71.2</td>
    <td>78.9</td>
  </tr>
  <tr>
    <td>SFT</td>
    <td>89.7</td>
    <td>87.7</td>
    <td>77.9</td>
    <td>90.0</td>
    <td>86.3</td>
  </tr>
</table>

Table 7: The performance of different optimization strategies.

C Impact of Different Optimization Strategies

We investigate the effectiveness of different optimization strategies for addressing the discriminative task. Since the proposed framework is based on LLMs, we focus on evaluating two widely adopted methods across four datasets: In-Context Learning (ICL) and Supervised Fine-Tuning (SFT). For the ICL method, we provide three task demonstrations for each category, while the detailed information of the training data for SFT is provided in Table 2.

As shown in Figure 7, the experimental results reveal that SFT consistently outperforms ICL in overall performance, with particularly notable improvements observed on the TREC dataset, which contains a larger number of categories. This can be attributed to two primary factors: First, the effectiveness of ICL is highly contingent on the quality of task demonstrations, which often results in sub-optimal performance. Second, SFT benefits from removing the limitation of context length, enabling it to utilize richer training data. Consequently, SFT demonstrates superior performance.

D Impact of Different Decoding Strategies

While temperature-based sampling methods are widely employed in generative tasks to enhance output diversity, their applicability to discriminative tasks (e.g., text classification) remains underexplored. To investigate this, we conduct experiments
<table>
  <tr>
    <th>Methods</th>
    <th>CR</th>
    <th>MPQA</th>
    <th>CoLA</th>
    <th>TREC</th>
    <th>Avg.</th>
  </tr>
  <tr>
    <td>Greedy</td>
    <td>86.7</td>
    <td>79.7</td>
    <td>78.1</td>
    <td>71.2</td>
    <td>78.9</td>
  </tr>
  <tr>
    <td>T=0.5</td>
    <td>86.0</td>
    <td>78.6</td>
    <td>78.4</td>
    <td>70.6</td>
    <td>78.4</td>
  </tr>
  <tr>
    <td>T=0.7</td>
    <td>85.4</td>
    <td>78.3</td>
    <td>76.2</td>
    <td>70.8</td>
    <td>77.7</td>
  </tr>
  <tr>
    <td>T=1.0</td>
    <td>81.7</td>
    <td>77.2</td>
    <td>75.8</td>
    <td>68.4</td>
    <td>75.8</td>
  </tr>
  <tr>
    <td>T=1.5</td>
    <td>74.1</td>
    <td>72.6</td>
    <td>67.9</td>
    <td>62.0</td>
    <td>69.1</td>
  </tr>
</table>

Table 8: The performance of the model under different temperatures.

across four datasets using five distinct decoding configurations. Greedy sampling, which selects the token with the highest probability, serves as a baseline and corresponds to a temperature value of 0.0. In addition, we evaluate the model’s performance under four different temperature settings \( T \in \{0.5, 0.7, 1.0, 1.5\} \) to analyze its sensitivity to temperature adjustments.

As evidenced by Table 8, model performance demonstrates consistent deterioration with rising temperature values. Through manual analysis of token-level output probabilities across selected samples, we observe that higher temperatures result in the model generating non-candidate labels, which substantially degrades performance. Accordingly, for discriminative tasks, we recommend adopting the greedy sampling strategy to ensure the accuracy and consistency of the model’s outputs.

E  Prompts for Different Datasets

Here we present the MCQ templates (Figure 10, 11, 12) employed in the LLMs-based knowledge filtering strategies described in Section 3.2.
Multi-Choice Question Prompt

(Demonstrations if available)
Instruction: Given the knowledge and sentence, choose if the knowledge is harmful for predicting the sentiment polarity of the sentence as A or B.
Knowledge: {Retrieved Knowledge}
Sentence: {Query}
Candidate Choices: (A) Harmful (B) Harmless
Answer: {Correct Answer}
...
(Test Sample)
Instruction: Given the knowledge and sentence, choose if the knowledge is harmful for predicting the sentiment polarity of the sentence as A or B.
Knowledge: {Retrieved Knowledge}
Sentence: {Query}
Candidate Choices: (A) Harmful (B) Harmless
Answer:

Figure 10: Multi-Choice Question (MCQ) template for MR, CR, MPQA, SST-2, SST-5.

Multi-Choice Question Prompt

(Demonstrations if available)
Instruction: Given the knowledge and question, choose if the knowledge is harmful for predicting the question category as A or B.
Knowledge: {Retrieved Knowledge}
Sentence: {Query}
Candidate Choices: (A) Harmful (B) Harmless
Answer: {Correct Answer}
...
(Test Sample)
Instruction: Given the knowledge and question, choose if the knowledge is harmful for predicting the question category as A or B.
Knowledge: {Retrieved Knowledge}
Sentence: {Query}
Candidate Choices: (A) Harmful (B) Harmless
Answer:

Figure 11: Multi-Choice Question (MCQ) template for TREC.

Multi-Choice Question Prompt

(Demonstrations if available)
Instruction: Given the knowledge and sentence, choose if the knowledge is harmful for predicting the grammatical correctness of the sentence as A or B.
Knowledge: {Retrieved Knowledge}
Sentence: {Query}
Candidate Choices: (A) Harmful (B) Harmless
Answer: {Correct Answer}
...
(Test Sample)
Instruction: Given the knowledge and sentence, choose if the knowledge is harmful for predicting the grammatical correctness of the sentence as A or B.
Knowledge: {Retrieved Knowledge}
Sentence: {Query}
Candidate Choices: (A) Harmful (B) Harmless
Answer:

Figure 12: Multi-Choice Question (MCQ) template for CoLA.

Reviewer paper summaries: This paper presents a knowledge filtering and prediction fusion mechanism to improve the performance of RAG in discriminative tasks. The experimental results have demonstrated the effect of the proposed models.

The paper presents a novel approach to filtering harmful knowledge retrieved for Retrieval-Augmented Generation (RAG) and introduces a Prediction Fusion technique that leverages the filtering process to enhance model reliability. The proposed method is evaluated on discriminative tasks such as Sentiment Analysis and Question Classification, demonstrating its effectiveness in improving prediction quality.

This paper proposes a pipeline to filter out information retrieved from the database during RAG. They have used multiple stages of filtering, including a trained model, ensembling, ICL, and direct prompting.

This paper investigates RAG methods specifically tailored for NLP tasks, aiming to address the issue that retrieved external knowledge may sometimes introduce irrelevant or harmful information. To tackle this problem, the authors propose a framework comprising a perplexity-based knowledge filtering strategy and a weighted prediction fusion mechanism. Experimental results on selected benchmarks demonstrate the effectiveness of the proposed strategies. Further analysis indicates that the relevant issues are significantly alleviated.
Summary of strengths: 1. This paper introduces an innovative framework incorporating knowledge filtering and prediction fusion to enhance retrieval-augmented models. While most existing RAG research focuses on generative tasks, this study targets discriminative tasks, which is novel and expands the application of RAG in NLP.
2. The effectiveness of the proposed approach is rigorously validated through extensive experiments and ablation studies across multiple discriminative task datasets, demonstrating the contribution of each component.
3. The paper provides a detailed explanation of the three main steps of the framework (label collection, knowledge filtering, and prediction fusion), offering researchers a clear implementation path. Additionally, each step employs innovative techniques, such as a perplexity-based annotation method and four filtering strategies.

The paper's primary strength is the introduction of Prediction Fusion, a novel technique that utilizes the model’s assigned label probabilities for each <query, knowledge> pair, effectively weighting predictions to enhance reliability. Additionally, the authors explore multiple strategies for filtering retrieved knowledge before it is fed into the LLM, including ensemble-based filtering and training a Small Language Model on automatically generated data using a perplexity-based method. These contributions collectively improve the robustness of the model in discriminative tasks.

1. This paper has provided a strong, successful methodology for filtering out retrieved information using the already present models.
2. This paper has identified a very big problem in current RAG system and a probable solution which will help the future research on this domain.

1. This paper explains the challenges, motivations, methods and results, and makes an orderly comparison with the existing literature.
2. This paper introduces a knowledge filtering and prediction fusion framework to solve the key problem of harmful knowledge inclusion.
Summary of weaknesses: 1. The lack of publicly available code makes verifying or reproducing the findings challenging for other researchers.
2. It is recommended that using the same backbone, i.e., LLAMA-8B the proposed method used, to investigate the differences between your method and the baselines (e.g., FiD, PGRA, and SKR) that also utilize RAG mechanisms.
3. It is recommended that further investigation be conducted into the performance of knowledge filtering strategies on all datasets in Table 4.
4. The paper mentioned “four distinct knowledge filtering strategies” that seem they work independently. In addition, is the final model in Table 3 implemented by the strategy of Ensemble Prediction which combines with other strategies?

Several concerns arise in **Section 3 (Methodology)** and **Section 4 (Experiments)**. Below, I outline the key weaknesses to facilitate the authors’ response.  

### **W1: Criteria for Harmful vs. Harmless Knowledge (Lines 187, Section 3.1)**  
The authors define a threshold-based criterion to classify knowledge as harmful or harmless during label collection. However, what is the motivation for setting a fixed threshold instead of simply **retaining knowledge that reduces perplexity**, i.e., where $PPL(\hat{y}(q_i ,k_i)) \leq PPL(\hat{y}(q_i)) $ ? A justification for this design choice is necessary.  

### **W2: Degeneration into Non-Retrieval Generation (Lines 281-283)**  
The paper states that when $K'_{ret} = \emptyset$,  the method reduces to standard non-retrieval generation. However, the **frequency of this phenomenon is not reported**. What percentage of cases does Prediction Fusion receive an empty list of knowledge due to prior filtering? Providing this statistic is crucial for understanding the real benefits of the approach.  

### **W3: Baseline Comparisons and Model Selection (Section 4, Appendix A, Table 1)**  
The experimental setup raises concerns about the reliability of the reported results. While the proposed methodology outperforms the baselines, the **comparisons are inconsistent**, particularly regarding model choices:  

- **ICL Baseline Discrepancy**: The ICL baseline is based on **OPT-13B**, a model with **more parameters** than Llama-3.1-8B-Instruct. However, Llama-3.1-8B-Instruct is **fine-tuned for the task**, whereas OPT-13B is not. A more rigorous comparison would involve:  
  - Using **the same base model** across all conditions with the same fine-tuning approach.  
  - Repeating experiments **without fine-tuning Llama-3.1-8B-Instruct** to evaluate the approach’s impact compared to standard baselines (e.g., Zero-Shot, Few-Shot, Chain-of-Thought).  

- **Missing Retrieval-Augmented Variants of Baselines**:  
  - The T5-Large and RoBERTa-Large baselines **lack retrieval-augmented counterparts**, despite this being straightforward to implement (e.g., fine-tuning RoBERTa-Large with an input format like: `[CLS] Question [SEP] Knowledge1 [SEP] ... [SEP] KnowledgeN`).
  - This omission makes it unclear **whether these models benefit from RAG** for discriminative tasks.  
  - Given the strength of the fine-tuned Llama-3.1-8B-Instruct model, stronger encoder-based baselines, such as **DeBERTa-V3-Base** and **DeBERTa-V3-Large**, should be included for a more comprehensive evaluation.  

- **Unspecified Models for LM-BFF, FiD, PGRA, RECOMP, and SKR Baselines**:  
  - The **underlying models for these baselines are not specified**.  
  - Without this information, it is impossible to determine whether the **performance gains** are due to the strength of Llama-3.1-8B-Instruct (which was fine-tuned) rather than the proposed method.  
  - Clarifying this is **critical for ensuring a rigorous comparison**.  

- **Missing Comparison with Other Base Models**:  
  - The study evaluates the proposed approach using only **Llama-3.1-8B-Instruct** as the base model. However, assessing its effectiveness across **different model families and parameter scales** (even with smaller models) is crucial to understanding its generalizability.  

### **W4: Explanation of Performance Drops (Lines 366-372, Section 4.3)**  
The authors attribute performance declines in certain datasets for the ICL knowledge-filtering baseline to **"suboptimal quality of task demonstrations."** However, no substantive analysis is provided to support this claim. A detailed investigation is necessary to assess whether this explanation is valid.

1. I am confused why Eqn. 4 gives a good signal for what is harmful and what is not. We can't say $y(q_i)$ is the ground truth, but this eqn is effectively using $y(q_i)$ as ground truth, and if one of the generation's perplexity is more than $PPL(y(q_i))$, then it is considered harmful. There is no good analysis or proof behind the Eqn. 4.

1. The approach in paper is similar to the following existing work [1].
[1] Baek J, Jeong S, Kang M, et al. Knowledge-Augmented Language Model Verification[C]//The 2023 Conference on Empirical Methods in Natural Language Processing. Association for Computational Linguistics (ACL), 2023.

2. More datasets should be used in the experiments, e.g.,  those commonly used in RAG, such as (NQ, TQA). 

3. Lacking a theoretical analysis of the model, including prediction fusion, etc.
Comments, suggestions and typos: 1. The capitalization issue of subtitle 5.1.

- **Figure 1** does not effectively illustrate the necessity of RAG techniques for discriminative tasks. I recommend redesigning the figure to **better highlight the problem statement and the impact of retrieval** in such settings.  
- **Figure 3** is **too large**, which may cause formatting issues, especially when printing the paper. Reducing its size would improve readability and allow for **more space to expand the Conclusion section**, which currently feels somewhat limited.  
- **The Limitations section is underdeveloped** and contains some typographical errors. Expanding on the limitations—particularly regarding **model generalizability**—would strengthen the discussion.

1. What is the $\alpha$ value of the Eqn. 8

1. Please explain in detail the difference between this paper and [1]
2. Experiments on more datasets
3. Provide a theoretical analysis and justification of the model
Overall assessment scores: 3

3

3

1.5