Zum Inhalt springen

Arize Phoenix - LLM Observability & Evaluation Cheatsheet

Arize Phoenix - LLM Observability & Evaluation Cheatsheet

Arize Phoenix ist eine Open-Source Observability- und Evaluation-Plattform für LLM-Anwendungen und Agenten. Sie ist OpenTelemetry-nativ: Instrumentierung sendet Standard-OTLP-Traces, die Phoenix sammelt, daher können Sie jeden Prompt, Model Call, Tool-Aufruf und Retrieval-Schritt sehen, dann Evaluationen darüber durchführen. Sie läuft lokal (Notebook, Container oder selbst gehosteter Server) und integriert sich mit gängigen Frameworks über OpenInference-Instrumentoren.

Installation

MethodBefehl
pippip install arize-phoenix
Lokalen Server ausführenphoenix serve (UI auf http://localhost:6006)
Dockerdocker run -p 6006:6006 arizephoenix/phoenix:latest
In einem Notebookimport phoenix as px; px.launch_app()
Instrumentierungs-Extraspip install openinference-instrumentation-openai (und andere)

Tracing Quickstart

from phoenix.otel import register

# Configure the tracer provider and point it at a Phoenix collector
tracer_provider = register(
    project_name="my-llm-app",
    endpoint="http://localhost:6006/v1/traces",
)

# Auto-instrument a library (example: OpenAI)
from openinference.instrumentation.openai import OpenAIInstrumentor
OpenAIInstrumentor().instrument(tracer_provider=tracer_provider)

# ...now your LLM calls show up as traces in Phoenix
KonzeptBedeutung
SpanEine Operation (LLM Call, Tool Call, Retriever-Schritt)
TraceEin Baum von Spans für eine Anfrage
ProjektEine benannte Sammlung von Traces
OpenInferenceDie semantischen Konventionen, die Phoenix über OTLP verwendet

Framework-Instrumentierung

LibraryInstrumentor-Paket
OpenAIopeninference-instrumentation-openai
LangChainopeninference-instrumentation-langchain
LlamaIndexopeninference-instrumentation-llama-index
Anthropicopeninference-instrumentation-anthropic
DSPyopeninference-instrumentation-dspy
Auto (many)enable via register(auto_instrument=True)

Manuelle Spans

from opentelemetry import trace
tracer = trace.get_tracer(__name__)

with tracer.start_as_current_span("retrieve") as span:
    span.set_attribute("input.value", query)
    docs = retriever(query)
    span.set_attribute("retrieval.documents", len(docs))

Evaluation

Phoenix kann Traces bewerten (besonders LLM-as-Judge Evals) und Ergebnisse anhängen.

from phoenix.evals import llm_classify, OpenAIModel, HALLUCINATION_PROMPT_TEMPLATE

results = llm_classify(
    dataframe=spans_df,
    model=OpenAIModel(model="gpt-4o"),
    template=HALLUCINATION_PROMPT_TEMPLATE,
    rails=["factual", "hallucinated"],
)
EvalMisst
HallucinationIst die Antwort im Kontext verankert?
QA correctnessIst die Antwort korrekt gegen eine Referenz?
RelevanceSind abgerufene Dokumente für die Abfrage relevant?
ToxicityUnsicherer/toxischer Inhalt
CustomIhre eigene LLM-as-Judge oder Code-Vorlage

Datasets & Experiments

FähigkeitVerwendung
DatasetsBeispiel Ein/Ausgaben aus Traces kuratieren
ExperimentsEine Aufgabe über einen Dataset ausführen und bewerten
px.Client().upload_dataset(...)Ein Dataset programmatisch erstellen
Compare runsQualität über Prompt/Model-Änderungen verfolgen

Retrieval-Debugging

FeatureHilft bei
Span-Attribute für abgerufene DocsSehen Sie genau, was RAG abgerufen hat
Embedding/UMAP-AnsichtenFlecken und Drift in Embeddings erkennen
Eval on retrieval relevanceRetrieval-Qualität pro Abfrage quantifizieren

Phoenix vs. andere LLM Observability

AspektArize PhoenixLangfuseMLflow
StandardOpenTelemetry/OTLPOTel + SDKMLflow tracing
FocusTracing + Eval + Retrieval DebugTracing + Prompts + EvalFull ML platform + LLM
Self-hostJaJaJa
Best forOTel-native Eval & RAG DebuggingProduct Analytics + PromptsTeams already on MLflow

Ressourcen