﻿# Phoenix document annotations: preserve span and rank position after reranking

Join Phoenix retrieval evaluations using the original span and document position, keeping reranked lists, annotation names and annotator provenance consistent.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/fg2-phoenix-document-annotation-position-reranking-lineage/
Language: en

## Keep the ranked list as part of identity

A relevance score can be correct for a document yet attached to the wrong retrieved item after sorting. The [document annotation reference](https://arize.com/docs/phoenix/sdk-api-reference/typescript/packages/phoenix-client/document-annotations) targets a document by its position within a retriever span's output. Preserve both span identity and the original ranked-list position when evaluating. A dataframe's current row order is not a replacement for that target, particularly after filtering, merging or parallel judgment.

## Preserve the index during export

The [span-query guide](https://arize.com/docs/phoenix/tracing/how-to-tracing/importing-and-exporting-traces/extract-data-from-spans) explains exploding retrieved documents into rows and retaining the document-position index. Carry that identity through downstream transformations. If a judge processes rows out of order, join its result using the retained keys rather than assigning scores back by arrival order. Inspect a small list with distinct documents and deliberately reordered responses to verify that each verdict returns to the intended retrieval position.

## Distinguish initial retrieval from reranking

A reranker can return the same documents in another order. An annotation for the earlier span does not automatically describe the later ranked list. Evaluate the list actually emitted by each relevant span, preserving its own positions. The [evaluation logging guide](https://arize.com/docs/phoenix/tracing/how-to-tracing/feedback-and-annotations/llm-evaluations) describes the identifiers needed for document evaluations. Reusing positions from the initial retriever can corrupt ranking metrics even when every individual relevance judgment remains semantically correct.

## Preserve annotator provenance honestly

Current document-annotation documentation qualifies which annotation kinds and numeric scores feed automatic retrieval metrics. Stored annotations and automatically aggregated metrics are not identical sets. Keep the real annotator kind when importing human or code labels; do not relabel them as model judgments merely to activate a dashboard. If manual aggregation is needed, describe it separately. Also inspect annotation-name uniqueness, since reusing a target and name can replace a measurement rather than create an independent judge series.

## Reconcile target keys before publishing metrics

Check annotated positions against the emitted list, including missing or duplicated results. Retain separate names for deliberately distinct evaluation axes or judge versions. The guides to [retrieval ID namespaces](/journal/fg2-ragas-id-context-precision-document-chunk-namespace/) and [runtime evidence lineage](/journal/fg2-deepeval-conversation-turn-retrieval-context-lineage/) provide related controls. Accept the result when every score can be traced to the intended document at the intended rank in the intended span, preserving the difference between a good relevance judgment and a correctly assembled ranking evaluation.
