Check the init and runtime parameters you can configure for the rankers available in deepset Cloud.
YAML Init Parameters
These are the parameters you can specify in pipeline YAML:
CohereRanker Parameters
Parameter | Type | Possible Values | Description |
---|---|---|---|
api_key | String | The Cohere API key so that you can use Cohere models. Required. | |
model_name_or_path | String | The name of the Cohere model you want to use for reranking. Check the list of supported models in the Cohere documentation. Required. | |
top_k | Integer | Default: 10 | The maximum number of documents to return. Required. |
max_chunks_per_doc | Integer | Default: None | Specifies the maximum number of chunks your document is split into if the document exceeds 512 tokens. (This is because Cohere models break documents into chunks of 512 tokens.) The default None setting splits your documents into a maximum of 10 chunks. Note that this parameter counts in the length of the query as well. So if your query is 32 tokens, the split will be:First chunk: 32 tokens from query + first 480 tokens from the document Second chunk: 32 tokens from the query + tokens 481 to 961 from the document, and so on. If after splitting into 10 chunks there are still some tokens from the document left, they're disregarded. Optional. |
embed_meta_fields | List of strings | Concatenates the provided metadata fields into the text passage that is then used in reranking. The concatenated metadata are not included in the documents that are returned. (Original documents are returned.) |
DeepsetMetaFieldRanker Parameters
Parameter | Type | Possible Values | Description |
---|---|---|---|
meta_field | String | The name of the document's metadata field you want to rank by. Required. | |
weight | Float | Values in range [0,1]. Default: 1.0 | Specifies how documents are ranked:0 - disables ranking by a metadata field.0.5 - means both ranking done by a previous component and ranking by a metadata field have the same impact.1 - ranks by a metadata field only.Required. |
top_k | Integer | Default: none | The maximum number of documents to return per query. If not specified, the ranker returns all documents it received but reranked. Optional. |
ranking_mode | Literal | reciprocal_rank_fusion descending Default: descending | The mode used to combine the retriever's and ranker's scores. Use linear_score only with retrievers or rankers that return a score in the range [0,1].Required. |
sort_order | Literal | ascending descending Default: descending | Defines whether to sort the documents in the ascending or descending order. Required. |
meta_value_type | Literal | float int date Default: none | Parses the metadata field value into the data type specified before ranking. This only works if all metadata values stored under meta_field in the provided documents are strings.For example, if you specify meta_value_type="date" and then for the metadata field value: "date": "2015-02-01" , the ranker parses the string into a datetime object and sorts the documents by date.Possible values are: float : parses the values into floats.int : parses the values into integersdate : parses the values into datetime objects.none : doesn't parse.Optional. |
DiversityRanker Parameters
Parameter | Type | Possible Values | Description |
---|---|---|---|
model_name_or_path | Union[String, Path] | Model path Default: all-MiniLM-L6-v2 | The path to the directory of a saved sentence transformers model. Mandatory. |
top_k | Integer | Default: None | The maximum number of documents the Ranker should return. Optional. |
use_gpu | Boolean | True False Default: True | Specifies whether to use all available GPUs or a CPU. Falls back on a CPU if no GPU is available. Optional. |
devices | String, torch.device | Default: None | A list of devices to use for inference. Optional. |
similarity | Literal | dot_product cosine Default: dot_product | Specifies the function to apply for calculating the similarity of query and passage embeddings. Required. |
EmbeddingRanker Parameters
Parameters | Type | Possible Values | Description |
---|---|---|---|
embedding_model | Union[String, Path] | Model path | The path to the directory of a saved model or the name of a public model, for example: sentence-transformers/all-mpnet-base-v2 .Required. |
top_k | Integer | Default: 10 | The maximum number of documents the Ranker should return. Required. |
use_gpu | Boolean | True False Default: True | Specifies whether to use all available GPUs or a CPU. Falls back on a CPU if no GPU is available. Required. |
devices | String, torch.device | Default: None | A list of devices to use for inference. Optional. |
batch_size | Integer | Default: 16 | The number of documents you want the ranker to process at a time. Required. |
scale_score | Boolean | True False Default: True | Scales the similarity score to a unit interval in the range of 0 to 1, where 1 means extremely relevant. True - Scales similarity scores that naturally have a different value range, such as cosine or dot_product. False - Uses raw similarity scores. Required. |
max_seq_len | Integer | Default: 512 | Specifies the maximum number of tokens the document text can have. Longer documents are truncated. Required. |
similarity | String | dot-product cosine Default: dot-product | Specifies the function to apply for calculating the similarity of query and passage embeddings. Required. |
embedding_dim | Integer | Default: 768 | Specifies the dimensionality of the embedding vector. |
return_embedding | Boolean | True False Default: False | Returns document embeddings. |
use_auth_token | Union[string, Boolean] | Default: None | If you're using a private model from Hugging Face, pass the API token used to download the model in this parameter. If this parameter is set to True , then the token generated when running transformers-cli login (stored in ~/.huggingface) is used.Optional. |
raise_for_missing_embeddings | Boolean | True False Default: True | Raises an error if there are embeddings missing. |
LostInTheMiddleRanker Parameters
Parameter | Type | Possible Values | Description |
---|---|---|---|
word_count_threshold | Integer | Default: None | The maximum total number of words across all documents the ranker selects. If you specify this parameter, the ranker includes all documents up to the point where adding another document would exceed the word_count_threshold . The last document that exceeds the threshold is included in the resulting list of documents, but all subsequent documents are discarded.Optional. |
top_k | Integer | Default: None | The maximum number you want the ranker to return. Optional. |
RecentnessRanker Parameters
Parameter | Type | Possible Values | Description |
---|---|---|---|
date_meta_field | String | The name of the metadata field in your documents that contains the date, for example updated_at . This is a required parameter, as dates are needed for sorting documents from newest to oldest.Required. | |
top_k | Integer | Default: None (all documents are returned) | Specifies how many documents to return. You may want to set larger top_k for the Retriever and then use the RecentnessRanker top_k to filter the documents down.Optional. |
weight | Float | Values in range [0,1] Default: 0.5 | Specifies how documents are sorted.0 means sorting by document age is disabled.0.5 means both document content and its age have the same impact.1 means documents are sorted by age only. The most recent documents come first.Optional. |
ranking_mode | String | score reciprocal_rank_fusion Default: reciprocal_rank_fusion | Specifies the method used to combine the documents fetched by the Retriever with recentness ranking.reciprocal_rank_fusion - combines individual document rankings and uses the outcome to rank the documents.score - uses the document's score returned by the Retriever.Make sure you use score only with Retrievers or Rankers that return properly distributed scores in the range [0,1]If your Retriever doesn't return properly distributed scores (like BM25Retriever), you can either set the method to reciprocal_rank_fusion or combine RecentnessRanker with a model-based Ranker, such as SentenceTransfomersRanker. |
SentenceTransformersRanker Parameters
Parameter | Type | Possible Values | Description |
---|---|---|---|
model_name_or_path | String | Example: cross-encoder/ms-marco-MiniLM-L-12-v2 | The path to a saved model or the name of a public model from Hugging Face. For a list of available models, see cross encoders. Required. |
model_version | String | Default: None | The version of the model from Hugging Face. This can be a tag name, a branch name, or a commit hash. Optional. |
top_k | Integer | Default: 10 | The maximum number of documents to return. Required. |
use_gpu | Boolean | True False Default: True | Specifies whether to use all available GPUs or a CPU. Falls back on a CPU if no GPU is available. Required |
batch_size | Integer | Default: 16 | The number of documents you want the ranker to process at a time. Required |
scale_score | Boolean | True False Default: True | If the model only predicts a single label, the raw predictions are transformed using a Sigmoid activation function. No scaling is applied to multi-label predictions. If you don't want to scale raw predictions, set this value to False .Required. |
progress_bar | Boolean | True False Default: True | Shows a progress bar when processing the documents. Required. |
use_auth_token | Union[string, Boolean] | Default: None | If you're using a private model from Hugging Face, pass the API token used to download the model in this parameter. If this parameter is set to True , then the token generated when running transformers-cli login (stored in ~/.huggingface) is used.Optional. |
embed_meta_fields | List of strings | Default: None | Concatenates the provided meta fields to a text passage that is then used in reranking. The concatenated metadata are not included in the returned documents. |
model_kwargs | Dictionary. | Default: None | Additional keyword arguments passed to AutoModelForSequenceClassification.from_pretrained when loading the model specified in model_name_or_path . See the model's documentation for details on what kwargs you can pass. |
CNSentenceTransformersRanker Parameters
This ranker uses the same parameters as SentenceTransformersRanker with an additional tokenizer_kwargs
parameter:
Parameter | Type | Possible Values | Description |
---|---|---|---|
tokenizer_kwargs | Dictionary | Default: None | Additional keyword arguments you can pass to the tokenizer. For details, check the model documentation. Optional. |
REST API Runtime Parameters
For all Rankers, you can pass the following parameters at runtime:
Parameter | Type | Description |
---|---|---|
top_k | Integer | The maximum number of ranked documents to return. For default values, see the top_k parameter description in the YAML Parameters section for each ranker. |