--- title: Associate a Passage Retrieval (CPR) model with a query pipeline slug: oaie6403 canonical_url: https://docs.coveo.com/en/oaie6403/ collection: leverage-machine-learning source_format: adoc --- # Associate a Passage Retrieval (CPR) model with a query pipeline When a [Coveo Machine Learning (Coveo ML)](https://docs.coveo.com/en/188/) [model](https://docs.coveo.com/en/1012/) has been created, it must be associated with a [query pipeline](https://docs.coveo.com/en/180/) to be effective in a [search interface](https://docs.coveo.com/en/2741/). [organization](https://docs.coveo.com/en/185/) [members](https://docs.coveo.com/en/2869/) with the [required privileges](#required-privileges) can access the **Machine learning** tab of a query pipeline configuration page to manage Coveo ML model associations for that query pipeline. When a [Passage Retrieval (CPR)](https://docs.coveo.com/en/oaie9196/) [model](https://docs.coveo.com/en/1012/) is associated with a [query pipeline](https://docs.coveo.com/en/180/), the model retrieves the passages that a large language model (LLM) will use to generate an output for a [query](https://docs.coveo.com/en/231/) submitted in the associated application. > **Notes** > > * Coveo recommends that you associate only one [CPR](https://docs.coveo.com/en/oaie9196/) [model](https://docs.coveo.com/en/1012/) per query pipeline. > > * When using [Passage Retrieval (CPR)](https://docs.coveo.com/en/oaie5277/), the query pipeline must be configured to use both a [CPR](https://docs.coveo.com/en/oaie9196/) [model](https://docs.coveo.com/en/1012/) and a [Semantic Encoder (SE) model](https://docs.coveo.com/en/nb890247/). > > * Query pipeline [thesaurus](https://docs.coveo.com/en/3405/) and [stop word](https://docs.coveo.com/en/3406/) rules are not applied to the query that's used by the [CPR](https://docs.coveo.com/en/oaie9196/) [model](https://docs.coveo.com/en/1012/). > The [CPR](https://docs.coveo.com/en/oaie9196/) [model](https://docs.coveo.com/en/1012/) always uses the raw [basic query expression (`q`)](https://docs.coveo.com/en/178/) entered by the user without any transformations or modifications. ## Associate a CPR model > **Important** > > Follow the [model association leading practices](https://docs.coveo.com/en/oaie6403#leading-practices) when associating your model with your query pipeline. . On the [**Query Pipelines**](https://platform.cloud.coveo.com/admin/#/orgid/search/pipelines/) ([platform-ca](https://platform-ca.cloud.coveo.com/admin/#/orgid/search/pipelines/) | [platform-eu](https://platform-eu.cloud.coveo.com/admin/#/orgid/search/pipelines/) | [platform-au](https://platform-au.cloud.coveo.com/admin/#/orgid/search/pipelines/)) page, click the query pipeline for which you want to associate the model, and then click **Edit components** in the Action bar. . On the subpage that opens, select the **Machine learning** tab, and then in the upper-right corner, click **Associate model**. . In the **Model** dropdown menu, select the desired model. . On the right side, under **Condition**, you can select a [query pipeline condition](https://docs.coveo.com/en/2793/) in the dropdown menu or [create a new one](https://docs.coveo.com/en/1959#create-a-condition). . Click **Associate model**. ## Edit a CPR model association > **Important** > > Follow the [model association leading practices](https://docs.coveo.com/en/oaie6403#leading-practices) when associating your model with your query pipeline. . On the [**Query Pipelines**](https://platform.cloud.coveo.com/admin/#/orgid/search/pipelines/) ([platform-ca](https://platform-ca.cloud.coveo.com/admin/#/orgid/search/pipelines/) | [platform-eu](https://platform-eu.cloud.coveo.com/admin/#/orgid/search/pipelines/) | [platform-au](https://platform-au.cloud.coveo.com/admin/#/orgid/search/pipelines/)) page, click the query pipeline for which you want to edit a model association, and then click **Edit components** in the Action bar. . On the subpage that opens, select the **Machine learning** tab, click the desired model, and then click **Edit** in the Action bar. . On the right side, under **Condition**, you can select a [query pipeline condition](https://docs.coveo.com/en/2793/) in the dropdown menu or [create a new one](https://docs.coveo.com/en/1959#create-a-condition). . Click **Save**. ## Dissociate a CPR model . On the [**Query Pipelines**](https://platform.cloud.coveo.com/admin/#/orgid/search/pipelines/) ([platform-ca](https://platform-ca.cloud.coveo.com/admin/#/orgid/search/pipelines/) | [platform-eu](https://platform-eu.cloud.coveo.com/admin/#/orgid/search/pipelines/) | [platform-au](https://platform-au.cloud.coveo.com/admin/#/orgid/search/pipelines/)) page, click the query pipeline from which you want to dissociate a model, and then click **Edit components** in the Action bar. . On the subpage that opens, select the **Machine learning** tab. . Click the model you want to dissociate from the pipeline, and then click **Dissociate** in the Action bar. ## CPR model association advanced configuration You can use the [CPR](https://docs.coveo.com/en/oaie9196/) [model](https://docs.coveo.com/en/1012/) association advanced configuration to [modify the maximum number of items](#maximum-number-of-items-to-consider) that the [CPR](https://docs.coveo.com/en/oaie9196/) model considers when retrieving the relevant text segments (passages) from which your LLM will generate outputs. > **Important** > > Modifying the default values for the model association advanced parameters may result in unintended model behavior following a model version upgrade. ### Maximum number of items to consider [Passage Retrieval (CPR)](https://docs.coveo.com/en/oaie9196/) uses [two stages of content retrieval](https://docs.coveo.com/en/oaie5277#relevant-content-retrieval). First-stage content retrieval identifies the most relevant items in the [index](https://docs.coveo.com/en/204/), and second-stage content retrieval identifies the most relevant segments of text (passages) from those items. The most relevant passages will then be used by your LLM application. If you find that your LLM application generates an output using text from low relevance items, you can use the `numberOfDocumentsToConsider` [model](https://docs.coveo.com/en/1012/) association parameter to set a custom value for the maximum number of items considered during second-stage content retrieval. For example, if you set the maximum number of items to 20, the CPR [model](https://docs.coveo.com/en/1012/) retrieves the most relevant passages only from the 20 most relevant items identified during first-stage content retrieval. > **Important** > > This is an advanced [model](https://docs.coveo.com/en/1012/) association configuration that should be used by experienced Coveo administrators only. > > The default setting of `40` provides good results in most use cases. > However, you can specify a custom value if you have a finely tuned [query pipeline](https://docs.coveo.com/en/180/) and you have a good understanding of the relevance hierarchy of the search results returned by your query pipeline configuration. > If you set the value too low, there may not be enough relevant text (passages) for your LLM to generate an output. To set a custom value for the number of items to consider for CPR . On the [**Query Pipelines**](https://platform.cloud.coveo.com/admin/#/orgid/search/pipelines/) ([platform-ca](https://platform-ca.cloud.coveo.com/admin/#/orgid/search/pipelines/) | [platform-eu](https://platform-eu.cloud.coveo.com/admin/#/orgid/search/pipelines/) | [platform-au](https://platform-au.cloud.coveo.com/admin/#/orgid/search/pipelines/)) page, click the query pipeline associated with the [CPR](https://docs.coveo.com/en/oaie9196/) [model](https://docs.coveo.com/en/1012/), and then click **Edit components** in the Action bar. . Select the **Machine learning** tab. . Double-click the [CPR](https://docs.coveo.com/en/oaie9196/) [model](https://docs.coveo.com/en/1012/). . If the **Edit a Model Association** subpage opens in JSON view, proceed to the next step. Otherwise, in the upper-right corner, click [dots], click **Switch to JSON view**, and then click **Switch to JSON view** in the confirmation window. . In the JSON editor, add `"numberOfDocumentsToConsider": ""` under `customQueryParameters`, where `` is the maximum number of items. The value must be an integer between `1` and `100` (default is `40`). **Example** To set the custom value to 50, the JSON would be: ```json { "passageRetrieval":{ "numberOfDocumentsToConsider": 50 } } ``` ## Reorder model associations The order in which [models](https://docs.coveo.com/en/1012/) appear in the query pipeline **Machine learning** tab is only relevant when multiple models of the same type are present. If there are no duplicate model types in the list, the model order has no effect and each model will either execute or not based on its individual condition. However, when multiple models of the same type are present, the models are evaluated sequentially from top to bottom. Models of a given type are evaluated one after another. The first model of a given type is evaluated and executes only if its condition is satisfied. Evaluation then continues with each subsequent model of the same type following the same rules. This can result in multiple models of the same type being executed for the same query. The order in which they execute is determined by their order in the list, with each model potentially overriding the effect of the previous model of the same type. To reorder model associations in a query pipeline . On the [**Query Pipelines**](https://platform.cloud.coveo.com/admin/#/orgid/search/pipelines/) ([platform-ca](https://platform-ca.cloud.coveo.com/admin/#/orgid/search/pipelines/) | [platform-eu](https://platform-eu.cloud.coveo.com/admin/#/orgid/search/pipelines/) | [platform-au](https://platform-au.cloud.coveo.com/admin/#/orgid/search/pipelines/)) page, click the query pipeline in which you want to reorder model associations, and then click **Edit components** in the Action bar. . On the subpage that opens, select the **Machine learning** tab. . Click the model whose position you want to change, and then use the **Move up** or **Move down** arrows in the Action bar to change the position of the model. ## Required privileges By default, members with the [required privileges](https://docs.coveo.com/en/1832#required-privileges) can view and edit elements of the [**Models**](https://platform.cloud.coveo.com/admin/#/orgid/ai-and-ml/models/) ([platform-ca](https://platform-ca.cloud.coveo.com/admin/#/orgid/ai-and-ml/models/) | [platform-eu](https://platform-eu.cloud.coveo.com/admin/#/orgid/ai-and-ml/models/) | [platform-au](https://platform-au.cloud.coveo.com/admin/#/orgid/ai-and-ml/models/)) page. The following table indicates the privileges required to use elements of the **Models** page and associated panels (see [Manage privileges](https://docs.coveo.com/en/3151/) and [Privilege reference](https://docs.coveo.com/en/1707/)). [cols="3",options="header"] |=== |Action |Service - Domain |Required access level |View model associations |Machine Learning - Models Organization - Organization Search - Query pipelines |View .2+|Edit model associations |Organization - Organization Machine Learning - Models |View |Search - Query pipelines |Edit |=== ## What's next? [Use the Passage Retrieval API](https://docs.coveo.com/en/o86c8334/) to extract the passages that were retrieved by the CPR [model](https://docs.coveo.com/en/1012/) to use in your LLM-powered application.