SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2604.22661 · 2026

Can QPP Choose the Right Query variant? Evaluating Query Variant Selection for RAG Pipelines

Matei Zaharia, Negar Arabzadeh, Michael Bendersky, Andrew Drozdov

arXiv · PDF

Code that ran

16 of 19 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 2 honoured the contract we drafted, 0 violated it and 0 have no contract verdict; 14 failures of our instrument; 3 no recorded run), measured 2026-11-23; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2604.22661.json · badge: /api/ran/2604.22661.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
Narabzad/QPP-4-RAG canonical (classifier label)
classifier basis: census
16 ran · 3 no recorded run
FunctionStatusWhere it lives
RM1_from_text Ran
ran; our contract draft was wrong, not the code
Narabzad/QPP-4-RAG/querygym/qpp/run_clarity_from_text.py
code served (permissive licence) · get_code("65c2bbc2b1ae6508")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned ndarray, ndim 1, dtype family float, shape (8,) as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np
from collections import Counter

class MockDocument:
    def __init__(self, text):
        self.text = text
    
    def raw(self):
        return self.text

class MockIndexReader:
    def __init__(self):
        self.docs = {
            'pid_0': MockDocument('hello world hello document'),
            'pid_1': MockDocument('world information retrieval system'),
            'pid_2': MockDocument('hello test example hello')
        }
    
    def doc(self, pid):
        return self.docs.get(pid)
    
    def analyze(self, text):
        return text.lower().split()

qtokens = ['hello', 'world']
pid_list = ['pid_0', 'pid_1', 'pid_2', 'pid_4']
score_list = [0.9, 0.7, 0.5, 0.3]
index_reader = MockIndexReader()
k = 3
mu = 1000

ARGS = {
    'qtokens': qtokens,
    'pid_list': pid_list,
    'score_list': score_list,
    'index_reader': index_reader,
    'k': k,
    'mu': mu
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type ndarray, ndim 1, dtype family float, shape (8,) — shape (8,) as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
calculate_correlations Ran
ran; our contract draft was wrong, not the code
Narabzad/QPP-4-RAG/querygym/analyze_nugget_qpp_correlations.py
code served (permissive licence) · get_code("7c838f84a3939965")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned DataFrame. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import pandas as pd
import numpy as np

# Create a simple dataframe with nugget and qpp columns
np.random.seed(0)
n_rows = 10

df = pd.DataFrame({
    'nugget_metric_1': np.random.randn(n_rows),
    'nugget_metric_2': np.random.randn(n_rows),
    'qpp_metric_1': np.random.randn(n_rows),
    'qpp_metric_2': np.random.randn(n_rows),
})

# Add some NaN values to test the masking logic
df.loc[0, 'nugget_metric_1'] = np.nan
df.loc[1, 'qpp_metric_2'] = np.nan

nugget_cols = ['nugget_metric_1', 'nugget_metric_2']
qpp_cols = ['qpp_metric_1', 'qpp_metric_2']
method_name = 'test_method'

ARGS = {
    'df': df,
    'nugget_cols': nugget_cols,
    'qpp_cols': qpp_cols,
    'method_name': method_name,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, pandas, scipy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type DataFrame — a DataFrame output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a DataFrame output the recorded ndim 2 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
evaluation Ran
ran; our contract draft was wrong, not the code
Narabzad/QPP-4-RAG/QPP4CS/evaluation_QPP.py
code served (permissive licence) · get_code("0b535ecda28038b9")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import json
import tempfile
import os

# Create temporary files for ap_path and pp_path
temp_dir = tempfile.mkdtemp()

# Create ap.json file with sample data
ap_data = {
    "q1": {"ndcg@3": "0.8"},
    "q2": {"ndcg@3": "0.6"},
    "q3": {"ndcg@3": "0.7"},
    "q4": {"ndcg@3": "0.9"},
    "q5": {"ndcg@3": "0.5"},
}
ap_path = os.path.join(temp_dir, "ap.json")
with open(ap_path, 'w') as f:
    json.dump(ap_data, f)

# Create pp.txt file with sample data
pp_path = os.path.join(temp_dir, "pp.txt")
with open(pp_path, 'w') as f:
    f.write("q1 0.75\n")
    f.write("q2 0.65\n")
    f.write("q3 0.72\n")
    f.write("q4 0.88\n")
    f.write("q5 0.55\n")

ARGS = {
    'ap_path': ap_path,
    'pp_path': pp_path,
    'target_metric': 'ndcg@3'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, scipy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
extract_data_for_correlation Ran
ran; our contract draft was wrong, not the code
Narabzad/QPP-4-RAG/querygym/analyze_nugget_qpp_correlations.py
code served (permissive licence) · get_code("da1bdb0fd0fac0ac")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple, ndim 3, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import pandas as pd

ARGS = {
    'data': {
        'query_1': {
            'reformulations': [
                {
                    'method': 'method_a',
                    'trial': 1,
                    'nugget_scores': {
                        'retrieval': {
                            'nugget_count': 5,
                            'nugget_precision': 0.8
                        },
                        'retrieval_cohere': {
                            'nugget_count': 4,
                            'nugget_precision': 0.75
                        }
                    },
                    'qpp_metrics': {
                        'pyserini': {
                            'clarity': 2.5,
                            'nqc': 1.2
                        },
                        'cohere': {
                            'clarity': 2.3,
                            'nqc': 1.1
                        }
                    }
                },
                {
                    'method': 'method_b',
                    'trial': 2,
                    'nugget_scores': {
                        'retrieval': {
                            'nugget_count': 6,
                            'nugget_precision': 0.85
                        },
                        'retrieval_cohere': {
                            'nugget_count': 5,
                            'nugget_precision': 0.80
                        }
                    },
                    'qpp_metrics': {
                        'pyserini': {
                            'clarity': 2.7,
                            'nqc': 1.3
                        },
                        'cohere': {
                            'clarity': 2.5,
                            'nqc': 1.2
                        }
                    }
                }
            ]
        },
        'query_2': {
            'reformulations': [
                {
                    'method': 'method_a',
                    'trial': 1,
                    'nugget_scores': {
                        'retrieval': {
                            'nugget_count': 7,
                            'nugget_precision': 0.9
                        },
                        'retrieval_cohere': {
                            'nugget_count': 6,
                            'nugget_precision': 0.88
                        }
                    },
                    'qpp_metrics': {
                        'pyserini': {
                            'clarity': 2.9,
                            'nqc': 1.4
                        },
                        'cohere': {
                            'clarity': 2.7,
                            'nqc': 1.3
                        }
                    }
                }
            ]
        }
    }
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
pandas — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 3, dtype family float — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
extract_top_qpp_reformulations Ran
ran; our contract draft was wrong, not the code
Narabzad/QPP-4-RAG/querygym/get_top_qpp_reformulations.py
code served (permissive licence) · get_code("9020a6c44731fef1")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import math

# Construct a minimal valid data structure for extract_top_qpp_reformulations
data = {
    "query_1": {
        "reformulations": [
            {
                "method": "method_a",
                "trial": 1,
                "reformulated_query": "reformulated text 1",
                "pre_retrieval_qpp_metrics": {
                    "clarity": 0.85,
                    "wig": 0.72,
                },
                "qpp_metrics": {
                    "pyserini": {
                        "nqc": 0.65,
                        "max_idf": 0.58,
                    },
                    "cohere": {
                        "sem_score": 0.71,
                    },
                },
            },
            {
                "method": "method_b",
                "trial": 2,
                "reformulated_query": "reformulated text 2",
                "pre_retrieval_qpp_metrics": {
                    "clarity": 0.91,
                    "wig": 0.68,
                },
                "qpp_metrics": {
                    "pyserini": {
                        "nqc": 0.72,
                        "max_idf": 0.63,
                    },
                    "cohere": {
                        "sem_score": 0.78,
                    },
                },
            },
            {
                "method": "method_a",
                "trial": 3,
                "reformulated_query": "reformulated text 3",
                "pre_retrieval_qpp_metrics": {
                    "clarity": 0.76,
                    "wig": 0.81,
                },
                "qpp_metrics": {
                    "pyserini": {
                        "nqc": 0.59,
                        "max_idf": 0.52,
                    },
                    "cohere": {
                        "sem_score": 0.64,
                    },
                },
            },
        ]
    },
    "query_2": {
        "reformulations": [
            {
                "method": "method_c",
                "trial": 1,
                "reformulated_query": "another reformulation 1",
                "pre_retrieval_qpp_metrics": {
                    "clarity": 0.88,
                },
                "qpp_metrics": {
                    "pyserini": {
                        "nqc": 0.74,
                    },
                },
            },
            {
                "method": "method_d",
                "trial": 2,
                "reformulated_query": "another reformulation 2",
                "pre_retrieval_qpp_metrics": {
                    "wig": 0.79,
                },
                "qpp_metrics": {
                    "cohere": {
                        "sem_score": 0.83,
                    },
                },
            },
        ]
    },
}

ARGS = {
    "data": data,
    "top_k": 5,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_all_qpp_methods Ran
ran; our contract draft was wrong, not the code
Narabzad/QPP-4-RAG/querygym/get_top_qpp_reformulations.py
code served (permissive licence) · get_code("b014346a20727cb7")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

ARGS = {
    'data': {
        'query_1': {
            'reformulations': [
                {
                    'pre_retrieval_qpp_metrics': {
                        'clarity': 0.75,
                        'ictf': 0.82
                    },
                    'qpp_metrics': {
                        'pyserini': {
                            'corr_ndcg': 0.68,
                            'corr_map': 0.71
                        },
                        'cohere': {
                            'corr_ndcg': 0.72,
                            'corr_map': 0.75
                        }
                    }
                },
                {
                    'pre_retrieval_qpp_metrics': {
                        'clarity': 0.80
                    },
                    'qpp_metrics': {
                        'pyserini': {
                            'corr_ndcg': 0.65
                        }
                    }
                }
            ]
        },
        'query_2': {
            'reformulations': [
                {
                    'pre_retrieval_qpp_metrics': {
                        'ictf': 0.85,
                        'nqc': 0.70
                    },
                    'qpp_metrics': {
                        'pyserini': {
                            'corr_map': 0.73
                        },
                        'cohere': {
                            'corr_ndcg': 0.76,
                            'avg_idf': 0.68
                        }
                    }
                }
            ]
        }
    }
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_all_qpp_metrics Ran
ran; our contract draft was wrong, not the code
Narabzad/QPP-4-RAG/querygym/analyze_qpp_correlations.py
code served (permissive licence) · get_code("f203650ab4b737a0")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 2, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

# Construct valid arguments for get_all_qpp_metrics

ARGS = {
    'data': {
        'query_1': {
            'reformulations': [
                {
                    'qpp_metrics': {
                        'pyserini': {
                            'metric1': 0.5,
                            'metric2': 0.7,
                        },
                        'cohere': {
                            'metric3': 0.6,
                        }
                    },
                    'pre_retrieval_qpp_metrics': {
                        'metric4': 0.4,
                        'metric5': 0.8,
                    }
                },
                {
                    'qpp_metrics': {
                        'pyserini': {
                            'metric1': 0.55,
                        },
                        'cohere': {}
                    },
                    'pre_retrieval_qpp_metrics': {
                        'metric6': 0.9,
                    }
                }
            ]
        },
        'query_2': {
            'reformulations': [
                {
                    'qpp_metrics': {
                        'pyserini': {
                            'metric2': 0.65,
                        },
                        'cohere': {
                            'metric3': 0.62,
                            'metric7': 0.75,
                        }
                    },
                    'pre_retrieval_qpp_metrics': {
                        'metric4': 0.45,
                    }
                }
            ]
        }
    }
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 2, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_all_qpp_metrics Ran
ran; our contract draft was wrong, not the code
Narabzad/QPP-4-RAG/querygym/analyze_qpp_oracle_performance.py
code served (permissive licence) · get_code("713b9b714a8f6bcc")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned list, ndim 1, dtype family float; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import numpy as np

# Construct valid arguments for get_all_qpp_metrics
data = {
    "query_1": {
        "reformulations": [
            {
                "qpp_metrics": {
                    "pyserini": {
                        "clarity": 0.85,
                        "ictf": 0.72
                    },
                    "cohere": {
                        "perplexity": 0.65
                    }
                },
                "pre_retrieval_qpp_metrics": {
                    "query_length": 3,
                    "term_idf_sum": 12.5
                }
            },
            {
                "qpp_metrics": {
                    "pyserini": {
                        "clarity": 0.90
                    },
                    "cohere": {}
                },
                "pre_retrieval_qpp_metrics": {
                    "query_length": 4
                }
            }
        ]
    },
    "query_2": {
        "reformulations": [
            {
                "qpp_metrics": {
                    "pyserini": {
                        "ictf": 0.68,
                        "scs": 0.55
                    },
                    "cohere": {
                        "perplexity": 0.70,
                        "token_count": 5
                    }
                },
                "pre_retrieval_qpp_metrics": {
                    "term_idf_sum": 14.2
                }
            }
        ]
    }
}

ARGS = {
    "data": data
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy, torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type list, ndim 1, dtype family float — a list output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_cross_encoder_model Ran
ran; our contract draft was wrong, not the code
Narabzad/QPP-4-RAG/querygym/run_bert_qpp.py
code served (permissive licence) · get_code("fa3ad2aea7a350a9")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned MockCrossEncoder. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn


class MockCrossEncoder:
    """Stand-in for CrossEncoder that mimics the expected interface."""
    def __init__(self, model_path, num_labels=1, device='cpu'):
        self.model_path = model_path
        self.num_labels = num_labels
        self.device = device
        self.model = nn.Linear(768, num_labels)
    
    def predict(self, sentences, batch_size=32):
        """Mock prediction method."""
        if isinstance(sentences, list):
            return [0.5] * len(sentences)
        return 0.5


# Monkey-patch CrossEncoder for this test
import sys
current_module = sys.modules[__name__]
current_module.CrossEncoder = MockCrossEncoder


ARGS = {
    'model_path': 'cross-encoder/ms-marco-MiniLM-L-6-v2'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type MockCrossEncoder — a MockCrossEncoder output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a MockCrossEncoder output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_doc_term_freqs Ran
ran; our contract draft was wrong, not the code
Narabzad/QPP-4-RAG/querygym/qpp/run_clarity_from_text.py
code served (permissive licence) · get_code("03c65479d21484de")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

from collections import Counter

class MockDocument:
    def __init__(self, text):
        self._text = text
    
    def raw(self):
        return self._text

class MockIndexReader:
    def __init__(self):
        self.documents = {
            "doc1": MockDocument("hello world hello python"),
            "doc2": MockDocument("python programming is fun"),
        }
    
    def doc(self, pid):
        return self.documents.get(pid)
    
    def analyze(self, raw_text):
        # Simple tokenization: split on whitespace and lowercase
        return raw_text.lower().split()

pid = "doc1"
index_reader = MockIndexReader()

ARGS = {
    "pid": pid,
    "index_reader": index_reader,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
get_qpp_score Ran
ran, honoured the contract we drafted
Narabzad/QPP-4-RAG/querygym/get_top_qpp_reformulations.py
code served (permissive licence) · get_code("026ed0d5c10b5c62")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned float, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch

# Construct a reformulation dict with QPP metrics for post-retrieval case
reformulation_with_post_retrieval = {
    'qpp_metrics': {
        'bm25': {
            'clarity': 0.85,
            'nqc': 0.72
        },
        'bert': {
            'clarity': 0.90,
            'nqc': 0.78
        }
    },
    'pre_retrieval_qpp_metrics': {
        'ictf': 0.65,
        'scs': 0.55
    }
}

# Test with post-retrieval method (contains underscore)
qpp_method_post = 'bm25_clarity'

ARGS = {
    'reformulation': reformulation_with_post_retrieval,
    'qpp_method': qpp_method_post
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
load_consolidated_data Ran
ran; our contract draft was wrong, not the code
Narabzad/QPP-4-RAG/querygym/analyze_nugget_qpp_correlations.py
code served (permissive licence) · get_code("bc1b076ebd35d7cc")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import json
import tempfile
import os

# Create a temporary JSON file with sample consolidated query data
temp_dir = tempfile.mkdtemp()
json_file_path = os.path.join(temp_dir, "consolidated_data.json")

# Create sample consolidated data
sample_data = {
    "queries": [
        {
            "id": 1,
            "question": "What is machine learning?",
            "answers": ["Machine learning is a subset of AI"],
            "metadata": {"source": "wiki"}
        },
        {
            "id": 2,
            "question": "How does neural networks work?",
            "answers": ["Neural networks are inspired by biological neurons"],
            "metadata": {"source": "textbook"}
        }
    ],
    "statistics": {
        "total_queries": 2,
        "avg_answer_length": 45
    }
}

# Write the sample data to the temporary JSON file
with open(json_file_path, 'w', encoding='utf-8') as f:
    json.dump(sample_data, f)

ARGS = {
    "json_file": json_file_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
load_queries Ran
ran; our contract draft was wrong, not the code
Narabzad/QPP-4-RAG/querygym/run_bert_qpp.py
code served (permissive licence) · get_code("02e3825c62997adf")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import tempfile
import os

# Create a temporary queries file with sample data
temp_file = tempfile.NamedTemporaryFile(mode='w', delete=False, suffix='.txt', encoding='utf-8')
temp_file.write("q1\tWhat is machine learning?\n")
temp_file.write("q2\tHow does neural networks work?\n")
temp_file.write("\n")  # empty line to test stripping
temp_file.write("q3\tExplain deep learning\n")
temp_file.close()

ARGS = {
    'queries_file': temp_file.name
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
load_retrieval_run_file Ran
ran; our contract draft was wrong, not the code
Narabzad/QPP-4-RAG/querygym/run_bert_qpp.py
code served (permissive licence) · get_code("1144f1e29cc4fa45")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned dict. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import tempfile
import os

# Create a temporary TREC format run file
temp_dir = tempfile.mkdtemp()
run_file_path = os.path.join(temp_dir, "run.txt")

# Write a sample TREC format run file
# Format: qid Q0 docid rank score tag
with open(run_file_path, 'w') as f:
    f.write("q1 Q0 doc1 1 10.5 run1\n")
    f.write("q1 Q0 doc2 2 9.3 run1\n")
    f.write("q2 Q0 doc3 1 8.7 run1\n")
    f.write("q2 Q0 doc4 2 7.2 run1\n")
    f.write("q3 Q0 doc5 1 6.1 run1\n")
    f.write("\n")  # empty line to test stripping
    f.write("q3 Q0 doc6 2 5.0 run1\n")

ARGS = {
    "run_file_path": run_file_path
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type dict — a dict output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a dict output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
run_scoring Ran
ran, honoured the contract we drafted
Narabzad/QPP-4-RAG/querygym/run_rag_nuggetizer.py
code served (permissive licence) · get_code("befdda679e933e1e")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned tuple, ndim 1, dtype family int; no output shape is stated. The image it ran in was not recorded. If your copy returns the same type and ndim on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import tempfile
from pathlib import Path
import json

# Create temporary directories for the test
with tempfile.TemporaryDirectory() as tmpdir:
    tmpdir = Path(tmpdir)
    
    # Create assignments directory with sample assignment files
    assignments_dir = tmpdir / "assignments"
    assignments_dir.mkdir(parents=True, exist_ok=True)
    
    # Create a couple of dummy assignment files
    assignment_file_1 = assignments_dir / "task_001_assignments.jsonl"
    assignment_file_1.write_text('{"id": 1, "assignment": "test1"}\n')
    
    assignment_file_2 = assignments_dir / "task_002_assignments.jsonl"
    assignment_file_2.write_text('{"id": 2, "assignment": "test2"}\n')
    
    # Create scores directory
    scores_dir = tmpdir / "scores"
    scores_dir.mkdir(parents=True, exist_ok=True)
    
    # Create a dummy scoring script that does nothing but succeed
    script_path = tmpdir / "dummy_scorer.py"
    script_path.write_text("""
import sys
import argparse

parser = argparse.ArgumentParser()
parser.add_argument('--input_file', required=True)
parser.add_argument('--output_file', required=True)
args = parser.parse_args()

# Just write an empty scores file
with open(args.output_file, 'w') as f:
    f.write('{"scores": []}\n')

sys.exit(0)
""")
    
    # Create log file
    log_file = tmpdir / "progress.log"
    
    ARGS = {
        "assignments_dir": str(assignments_dir),
        "scores_dir": str(scores_dir),
        "script_path": str(script_path),
        "log_file": str(log_file),
    }
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
tqdm — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type tuple, ndim 1, dtype family int — a tuple output has no array shape of its own; none is stated
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
setup_openai_api_key Ran
ran; our contract draft was wrong, not the code
Narabzad/QPP-4-RAG/querygym/run_rag_generation_only.py
code served (permissive licence) · get_code("88d82053714e947e")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned str. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import os

def setup_openai_api_key(api_key=None):
    """Get OpenAI API key."""
    if api_key:
        os.environ['OPENAI_API_KEY'] = api_key
        return api_key
    api_key = os.getenv('OPENAI_API_KEY')
    if not api_key:
        raise ValueError('OpenAI API key not provided and OPENAI_API_KEY not set')
    return api_key

ARGS = {
    'api_key': 'sk-test-1234567890abcdefghijklmnop'
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
none outside the standard library — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type str — a str output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a str output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
CLARITY Not yet run
unverified (harvested, no recorded run)
Narabzad/QPP-4-RAG/querygym/qpp/run_clarity_from_text.py
code served (permissive licence) · get_code("fc1d3c8f3c10c928")
How it ran

no invocation recorded.

analyze_qpp_oracle_performance Not yet run
unverified (harvested, no recorded run)
Narabzad/QPP-4-RAG/querygym/analyze_qpp_oracle_performance.py
code served (permissive licence) · get_code("d75693278e80c095")
How it ran

no invocation recorded.

calculate_correlations Not yet run
unverified (harvested, no recorded run)
Narabzad/QPP-4-RAG/querygym/analyze_qpp_correlations.py
code served (permissive licence) · get_code("2eabbea57b3c0bda")
How it ran

no invocation recorded.

Also present in other papers' code

Of 19 samples lifted from this paper's linked repositories, 19 carry a function identity and 0 do not. Of the 19 distinct functions with an identity, 0 are also present in other papers whose code we hold (0 with at least one paper dated earlier, 0 the same month, 0 later) and 19 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-23.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

Large Language Models (LLMs) have made query reformulation ubiquitous in modern retrieval and Retrieval-Augmented Generation (RAG) pipelines, enabling the generation of multiple semantically equivalent query variants. However, executing the full pipeline for every reformulation is computationally expensive, motivating selective execution: can we identify the best query variant before incurring downstream retrieval and generation costs? We investigate Query Performance Prediction (QPP) as a mechanism for variant selection across ad-hoc retrieval, and end-to-end RAG. Unlike traditional QPP, which estimates query difficulty across topics, we study intra-topic discrimination-selecting the optimal reformulation among competing variants of the same information need. Through large-scale experiments on TREC-RAG using both sparse and dense retrievers, we evaluate pre-and post-retrieval predictors under correlation-and decision-based metrics. Our results reveal a systematic divergence between retrieval and generation objectives: variants that maximize ranking metrics such as nDCG often fail to produce the best generated answers, exposing a "utility gap" between retrieval relevance and generation fidelity. Nevertheless, QPP can reliably identify variants that improve end-to-end quality over the original query. Notably, lightweight pre-retrieval predictors frequently match or outperform more expensive post-retrieval methods, offering a latency-efficient approach to robust RAG. • Information systems → Information retrieval.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2604.22661")
get_code_for_paper("2604.22661")
have("2604.22661")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2604.22661.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2604.22661.svg)](https://syntology.ai/paper/2604.22661)

Connect an agent — have() is free.