---
title: "RerankerModel"
sidebar_label: "RerankerModel"
description: "Kotlin binding reference: RerankerModel."
---

<!-- Generated by tools/api_reference/generate_api_docs.py. Do not edit. -->

//[clika-runtime](../../../index.md)/[io.clika.modelverse](../index.md)/[RerankerModel](index.md)

# RerankerModel

[common]\
class [RerankerModel](index.md) : [PreTrainedModel](../PreTrainedModel/index.md)

A reranking model: a query and documents in, one relevance score per document out, in the documents' order (a higher score is a better match; the caller sorts).

Open it with [open](Companion/open.md) from a checkpoint the model library's reranking families claim (a family that declares a relevance score out of text). Hand it a query and documents with [rerank](rerank.md); the scores arrive through the listener on the model's own worker thread, one request at a time per model. [close](close.md) frees the weights.

## Types

| Name | Summary |
|---|---|
| [Companion](Companion/index.md) | [common]<br>object [Companion](Companion/index.md) |

## Properties

| Name | Summary |
|---|---|
| [capabilities](capabilities.md) | [common]<br>val [capabilities](capabilities.md): [Capabilities](../Capabilities/index.md)<br>What the model takes and gives, read when it opened: [Capabilities.contextLength](../Capabilities/contextLength.md) is the window a pair is cut to. |
| [config](config.md) | [common]<br>open override val [config](config.md): [PretrainedConfig](../PretrainedConfig/index.md)<br>The checkpoint's identity, read when the model opened. |

## Functions

| Name | Summary |
|---|---|
| [close](close.md) | [common]<br>open fun [close](close.md)()<br>Free the model. A running request is canceled first and the call waits for it to return; called from inside a listener callback, the free runs right after that callback's request ends instead. Idempotent. |
| [rerank](rerank.md) | [common]<br>fun [rerank](rerank.md)(query: [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html), documents: [List](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-list/index.html)&lt;[String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)&gt;, instruction: [String](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-string/index.html)? = null, listener: [RerankListener](../RerankListener/index.md)): [RerankHandle](../RerankHandle/index.md)<br>Score [documents](rerank.md) against [query](rerank.md). Returns at once; the worker runs the request and calls [listener](rerank.md) on its thread: [RerankListener.onScores](../RerankListener/onScores.md) with one score per document, in the documents' order, then [RerankListener.onDone](../RerankListener/onDone.md) with the [RerankReport](../RerankReport/index.md). [instruction](rerank.md) states the task in words when the checkpoint's default does not fit (null keeps it). A pair longer than the model's window is cut to it. |
| [residency](residency.md) | [common]<br>open override fun [residency](residency.md)(): [ResidencyReport](../ResidencyReport/index.md)<br>What the model holds on each device right now ([ResidencyReport](../ResidencyReport/index.md)); a closed model refuses with [ModelverseException](../ModelverseException/index.md). |