HyperAIHyperAI

Command Palette

Search for a command to run...

5 days ago
LLM

Trie-based Experiment Plans for Efficient IR Pipeline Experiments

Irene Anu Craig Macdonald

Abstract

Search engines are often formulated as cascading pipelines, where successive stages combine the results of different retrievers, and iteratively refine the ranking of candidate documents to obtain a final ranking, which can be presented to a user, or provided as context to an LLM. Such pipelines can be complex to evaluate in an end-to-end manner, necessitating measurement of Recall of early stages, and Precision of later stages, which are often interchangeable. PyTerrier is ideal for building and evaluating cascading retrieval pipelines, due to its declarative nature for pipeline construction and wide ecosystem of retrievers and rerankers. However, comparative evaluation of pipelines can be expensive due to repeated components. In this work, we describe the use of a trie data structure to formulate an experiment plan for comparative pipeline experiments that enhances experiment efficiency compared to a sequential "linear" plan. Empirically, on a demonstration experiment involving BM25, MonoT5 and DuoT5 on MSMARCO v2, we observe a 26% reduction in experiment duration. Finally, we report on a user study of undergraduate and postgraduate research students' use of the experiment plans.

One-sentence Summary

Researchers at the University of Glasgow introduce a trie-based experiment plan that replaces sequential linear plans for efficient comparative evaluation of cascading IR pipelines, achieving a 26%26\%26% reduction in experiment duration on a BM25, MonoT5, and DuoT5 pipeline over MSMARCO v2.

Key Contributions

  • The paper proposes a trie (radix tree) based experiment plan that identifies shared prefix overlaps across retrieval pipelines, enabling a single execution of common stages and reducing redundant computation in comparative IR experiments.
  • Experiments on MSMARCO v2 with BM25, MonoT5, and DuoT5 demonstrate a 26% reduction in total experiment duration compared to a sequential execution plan.
  • A user study with undergraduate and postgraduate students shows that the trie-based visualization improves understanding of pipeline structure, complementing the efficiency gains.

Introduction

Modern information retrieval pipelines often chain a fast first-stage retriever with progressively more expensive neural rerankers, and PyTerrier enables declarative composition of these cascades. A practical pain point is that experimenters evaluating many related pipeline variants waste significant computation re-running identical early stages, because PyTerrier’s existing optimisation only reuses the longest common prefix shared by every pipeline in an experiment. The authors introduce an experiment-planning approach that uses a radix tree (trie) to identify and reuse all shared prefixes across any subset of pipelines, transforming the set of pipelines into a minimal tree execution plan. This method reduces redundant work, yielding up to a 26% decrease in overall experiment duration on MSMARCO and improving clarity through the resulting pipeline visualisation.

Method

PyTerrier represents indexingand retrieval components, such as rankers, rerankers, and feature extractors, as transformers. Each transformer takes a dataframe as input and produces a transformed dataframe as output. These transformations typically act upon standard dataframe types, including documents, queries, retrieved documents RD×Q\mathcal{R} \subset \mathcal{D} \times \mathcal{Q}RD×Q, and question answers. A retrieval transformer ttt can be executed upon a set of queries QQQ \subset \mathcal{Q}QQ using the notation [t](Q)[t](Q)[t](Q).

To combine different transformers, the framework implements a set of operators that allow for declarative expression. The >> operator, known as compose, enables multi-stage pipelines through transformer function composition, defined as [[t1t2]](Q):=[[t2]]([[t1]](Q))[[t_1 \gg t_2]](Q) := [[t_2]]([[t_1]](Q))[[t1t2]](Q):=[[t2]]([[t1]](Q)). Other operators include rank cutoffs and linear combination, which can be applied to transformers within the pipeline. This notation allows researchers to express complex retrieval pipelines concisely.

Refer to the framework diagram:

The schematic above illustrates a multi-stage retrieval pipeline. The initial stage retrieves the top 100 candidate documents using BM25, applies MonoT5 to re-rank this candidate set, and finally applies DuoT5 pairwise re-ranking to the top 20 results to compute refined relevance scores and produce the final ranking.

PyTerrier extends this flexible pipeline construction model with a declarative API for evaluating and comparing retrieval pipelines. The pt.Experiment function provides an abstraction for comparative evaluation, accepting a list of retrieval pipelines, a set of queries, corresponding relevance assessments, and evaluation measures. It outputs a dataframe containing the computed measures for each system.

A key challenge with a declarative approach is the duplication of execution. For instance, in an experiment comparing multiple pipelines that share an initial BM25 retrieval stage, that stage would be executed multiple times. To address this, the authors propose experiment plans to decompose a set of pipeline comparisons involving shared components into a minimal set of executions. While earlier work utilized the longest common prefix algorithm to detect and reuse shared initial stages, this approach fails to optimize shared components that are not prefixes. To overcome this limitation, the authors formulate a tree experiment plan that identifies and reuses all possible shared prefixes by instantiating a trie data structure to detect overlapping pipeline prefixes, thereby avoiding redundant recomputation across the entire pipeline structure.

Experiment

The empirical evaluation compared linear, longest common prefix, and tree-based radix trie experiment plans on multi-stage pipelines using BM25, MonoT5, and DuoT5 over MSMARCO v1 and v2 corpora with TREC Deep Learning Track queries. The tree-based plan consistently reduced total execution time while preserving identical nDCG@10 scores, with larger savings when redundant retrieval on a bigger index was avoided. A user study with both undergraduate and postgraduate students confirmed that switching to the tree plan felt intuitive and that its live visualization helped participants understand how shared prefixes eliminate recomputation.

The tree-based experiment plan substantially reduces execution time compared to linear plans, cutting runtime by roughly a fifth on MSMARCO v1 and over a quarter on MSMARCO v2 while producing identical effectiveness scores. Linear plans with prefix precomputation offer minimal efficiency gains over the naive linear approach, with improvements under 6%. Relative to the linear baseline without precomputation, the tree plan executes roughly 19% faster on MSMARCO v1 and 26% faster on MSMARCO v2. Adding LCP precomputation to a linear plan yields only marginal speedups, reducing execution time by 1% on the smaller corpus and 6% on the larger one.

The evaluation compares tree-based and linear experiment plans on MSMARCO v1 and v2, with and without LCP precomputation. The tree plan cuts execution time by about 19% on v1 and 26% on v2 versus a naive linear baseline while producing identical effectiveness scores. Adding prefix precomputation to a linear plan yields only minimal speedups (up to 6%), indicating that the plan structure itself accounts for most of the observed gains.


Build AI with AI

From idea to launch — accelerate your AI development with free AI co-coding, out-of-the-box environment and best price of GPUs.

AI Co-coding
Ready-to-use GPUs
Best Pricing

HyperAI Newsletters

Subscribe to our latest updates
We will deliver the latest updates of the week to your inbox at nine o'clock every Monday morning
Powered by MailChimp