# `Arcana.Reranker.CrossEncoder`
[🔗](https://github.com/georgeguimaraes/arcana/blob/main/lib/arcana/reranker/cross_encoder.ex#L1)

Local cross-encoder reranker using Bumblebee.

Scores query-chunk pairs with a cross-encoder model, producing raw relevance
logits. Much more accurate than bi-encoder similarity since the model sees
the query and chunk together.

## Usage

    # In Arcana.Pipeline
    ctx
    |> Pipeline.search()
    |> Pipeline.rerank(reranker: Arcana.Reranker.CrossEncoder)
    |> Pipeline.answer()

    # Directly
    {:ok, reranked} = Arcana.Reranker.CrossEncoder.rerank(
      "What is Elixir?",
      chunks,
      threshold: 0.0
    )

## Configuration

The serving must be started in your supervision tree:

    children = [
      {Arcana.Reranker.CrossEncoder, model: "cross-encoder/ms-marco-MiniLM-L-6-v2"}
    ]

## Options

  - `:model` - HuggingFace model ID (default: `cross-encoder/ms-marco-MiniLM-L-6-v2`)
  - `:threshold` - Minimum logit score to keep (default: 0.0)
  - `:top_k` - Keep top N results regardless of threshold (overrides threshold)

# `child_spec`

Returns a specification to start this module under a supervisor.

See `Supervisor`.

# `start_link`

---

*Consult [api-reference.md](api-reference.md) for complete listing*
