> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sglang.io/llms.txt
> Use this file to discover all available pages before exploring further.

# NVIDIA Nemotron 3.5 Rerank

> Serve Nemotron 3.5 Rerank for text, image, and combined-document relevance scoring with SGLang.

## Overview

[Nemotron 3.5 Rerank](https://huggingface.co/nvidia/Nemotron-3.5-Rerank-8B-BF16) scores how relevant a document is to a text query. Documents can contain text, an image, or both. Use it to reorder candidate documents before passing them to a retrieval-augmented generation pipeline.

## Installation

Install SGLang on an NVIDIA CUDA system using the [installation guide](https://docs.sglang.io/docs/get-started/install.md). The BF16 checkpoint has been tested on A100, H100, and B200 GPUs.

Install the Python client dependency:

```bash theme={null}
pip install requests
```

## Start the server

Set the context length to the model card's 32,768-token limit:

```bash theme={null}
sglang serve \
  --model-path nvidia/Nemotron-3.5-Rerank-8B-BF16 \
  --context-length 32768
```

SGLang enables embedding mode and loads the checkpoint's query/document template automatically. You do not need `--is-embedding`, `--chat-template`, or `--trust-remote-code`. Prefix caching and chunked prefill are disabled automatically because this model uses bidirectional attention.

The examples below send requests to the server's default address, `http://127.0.0.1:30000`.

## Rerank text documents

```python theme={null}
import requests

response = requests.post(
    "http://127.0.0.1:30000/v1/rerank",
    json={
        "query": "What is NVIDIA NeMo Framework?",
        "documents": [
            "NeMo Framework offers comprehensive functionalities for developing both LLMs and Multimodal Models.",
            "A biological foundation model designed to analyze and generate DNA, RNA, and protein sequences.",
        ],
        "return_documents": False,
    },
    timeout=120,
)
response.raise_for_status()
for result in response.json():
    print(result["index"], result["score"])
```

The NeMo document, at index `0`, should rank above the biology document. Results are sorted by descending score; `index` is the document's position in your original list. Scores are raw logits, not probabilities, and can be negative.

## Rerank images and combined documents

Represent an image document as a list of content parts. Include a text part alongside the image to score a combined document:

```python theme={null}
import requests

image = {
    "type": "image_url",
    "image_url": {
        "url": "https://raw.githubusercontent.com/sgl-project/sgl-test-files/refs/heads/main/images/man_ironing_on_back_of_suv.png"
    },
}
text = "A man is ironing clothes on the back of a car."
response = requests.post(
    "http://127.0.0.1:30000/v1/rerank",
    json={
        "query": "What is the man doing?",
        "documents": [
            [image],
            [{"type": "text", "text": text}, image],
            text,
            "A biological foundation model designed to analyze and generate DNA, RNA, and protein sequences.",
        ],
    },
    timeout=120,
)
response.raise_for_status()
for result in response.json():
    print(result["index"], result["score"])
```

The image, combined document, and matching text should rank above the unrelated biology document. Their exact order can vary. By default, each result also includes its original document, preserving text and image content parts. Set `return_documents` to `False` to omit them.

You can replace an image URL with a base64 data URL such as `data:image/png;base64,...`. Set `top_n` in the request to return only the highest-ranked documents.

## Supported inputs and limits

* Queries must contain text only.
* Each document can contain at most one image. Multiple image documents can be ranked in the same request.
* Videos and unsupported image inputs return HTTP 400.
* The context limit includes the query, document, template, and image tokens.
* ROCm serving is rejected at startup because its default AITER prefill does not provide the required bidirectional attention.
* Pipeline parallelism is not supported by this serving path.

See [reranking models](https://docs.sglang.io/docs/supported-models/rerank_models.md) for the shared reranking API and other supported models.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.