Observability handbook for OPD training: Tracing integration, custom metric reporting, console tabs, metric dictionary, training effect evaluation, and FAQ troubleshooting
- OPD principles and example selection → see OPD Training Overview
- Model OPD development → see Model OPD Development; Agentic OPD development → see Agentic OPD Development
- Full set of submission parameters and hyperparameters → see OPD Training Configuration
Overview
The observability capability is built on OpenTelemetry (an open-source observability standard) to implement Tracing (distributed tracing). Data is exported to ARMS (Application Real-time Monitoring Service) and displayed in the Model Studio console. A Span is the observability unit of a single operation in OpenTelemetry; multiple Spans nest automatically to form a call chain.
Five sections:
- Integrate Tracing — the SDK automatically reports training metrics to the console; how to view them on the Trajectory page
- Custom metrics — reporting paths and constraints for
rollout_metricsandreward_metrics - View effects in the console — how to read the Metrics / Trajectory / Output / Logs tabs
- Training metrics reference — OPD-specific metric dictionary + common metrics quick reference
- Judge training effects and troubleshoot — in-training interpretation, post-training evaluation, and FAQ
Integrate Tracing
Using the Rollout processor of an OPD project as an example, Tracing is integrated in 3 steps. OPD difference: the LLM Span in the call chain corresponds to the student model call, and teacher model scoring happens on the server side.
Step 1: Add dependencies
Add the following OpenTelemetry-related dependencies to the requirements.txt in the project root:
Dependency | Description |
|---|---|
| OTel API |
| OTel SDK |
| OTLP HTTP exporter |
| Baggage processor |
| Generative AI utility library |
dashscope, fastapi, uvicorn, and pyyaml pre-installed; you may also pin versions in requirements.txt if needed.
Step 2: Add observability code
Code changes concentrate on 5 decorators/functions. They nest automatically to form a complete call chain:
@observe_processor — Track processor entry
Add it to the process() method to create the top-level ENTRY Span (the entry Span, the outermost layer of the call chain). The SDK infers the Span type from the inheritance chain: inheriting AbstractRolloutProcessor is recognized as ROLLOUT, and inheriting AbstractRewardProcessor is recognized as REWARD. It automatically records input, output, duration, and success/failure status.
Rollout side example (functions/rollout/my_rollout.py):
functions/reward/reward.py):
trace_client() — Track LLM client
Call it during initialization or in the process method to wrap the LLM client instance. Afterwards, all LLM requests from that client automatically produce an LLM Span that records the model name, request content, token usage, and latency.
Supported client types (auto-detected by object attributes):
- OpenAI clients (
AsyncOpenAI/OpenAI) - OpenAI completions resource (
.chat.completions) - LangChain ChatOpenAI and similar classes (via
.client/.async_client) - DashScope Generation class (pass the class itself, not an instance)
functions/rollout/my_rollout.py):
trace_tool() — Track tool calls
After obtaining a tool instance, call this to wrap the tool object. Afterwards, each tool call produces a TOOL Span that records the tool name, parameters, return value, and latency.
Supported input formats:
- A single LangChain BaseTool
- List / tuple / dict (auto-traversed)
- LangGraph ToolNode (auto-expands
.tools_by_name) - MCP tools (auto-detected, provider set to "mcp")
- Custom provider (
trace_tool(tool, provider="my-plugin"))
@observe_llm — Custom LLM function
When trace_client() cannot auto-detect your LLM client, use this decorator to manually mark an LLM call function.
Signature requirement: the function must include keyword arguments model and messages after *.
Example (functions/rollout/my_rollout.py):
@observe_tool — Custom tool function
When trace_tool() cannot auto-detect your tool (e.g., a plain Python function used as a tool), use this decorator to mark it manually. You can customize the Span name via the name parameter.
Example (functions/rollout/my_rollout.py):
Step 3: Submit the task
When submitting a task, leave the Runtime env field empty — Tracing is enabled by default:
{"ENABLE_TRAJECTORY": "false"} in env. After disabling, system metrics are unaffected; only Tracing data collection stops.Tracing performance and cost trade-off
Data pipeline and cost sources
- Data flow: function code (decorators) → OpenTelemetry SDK → ARMS → console Trajectory/Metrics tabs
- Cost sources: ARMS Span storage (pay-as-you-go) + a small amount of CPU/network overhead on the function side + a slight increase in training latency
Switch strategy and cost governance
Phase | Tracing status | Collected data | Not collected | Cost impact |
|---|---|---|---|---|
Development / small-batch debugging | Fully on | All (trajectories + Reward analysis + tool calls + system metrics) | — | Low |
Canary / pre-release confirmation | Retained | All | — | Medium |
Large-scale formal training | Can disable | actor/critic/trajectory/timing system metrics | Trajectory replay / tool call details / custom metrics curves | Significantly reduced |
trace/distillation/* are system metrics and remain viewable after disabling (teacher model health troubleshooting is unaffected).
Cost governance for custom metrics:
- Count and cardinality: the count and cardinality of
reward_metrics/rollout_metricsaffect ARMS storage - Avoid high-cardinality fields: do not use user_id / request_id as metric keys
- Streamline metrics: keep key metrics ≤10; do not leave temporary debugging metrics
Custom metrics
The key-value metrics defined through the following entry points in your code automatically appear in the trace/ group of the console Metrics tab and on the Reward analysis page:
Entry | Code location | Console path |
|---|---|---|
reward_metrics |
|
|
rollout_metrics |
|
|
- Flat dict: reward_metrics / rollout_metrics return a flat dict (not a nested list), with each value a float
- Main score reported separately: reward_score goes into
Reward.reward_scorealone; do not duplicate it in reward_metrics - Non-float only persisted: non-float data is persisted only via
rollout_extraand does not enter metrics - Metric path: the reward_score main score maps to
trace/reward/<name>/, and each dimension maps totrace/reward_metrics/<name>/<metric>
RewardFunctionComponent(name="reward-1") to give each Reward function a unique name; metric paths are distinguished automatically (trace/reward_metrics/reward-1/...).
View effects in the console
After training starts, open the Model Fine-tuning console, enter the Model Fine-tuning page, and click the task name to view observability data in the details. The following explains the correspondence between "what you did in code → what you see in the console".
OPD difference: the task details page has no standalone "Details" tab; status is viewed in the task list. Focus points: on the Metrics tab, watch the distillation loss, teacher model health, and validation reward; on the Trajectory tab, inspect tool call chains per sample; on the Output tab, the last Checkpoint is auto-published.
The task details contain the following tabs, to be used in the order "check progress first → then check behavior → drill down when issues arise":
Tab | Main question answered | When to use |
|---|---|---|
Trajectory | What the model actually did, why the score is what it is | Verify model behavior, attribute low-score samples |
Metrics | Quantitative training trends | Read curves to judge convergence, spot inflection points |
Output | Checkpoint list and publishing | Select a model after training completes |
Logs | stdout / stderr / error stack traces | Troubleshoot when FAILED |
Trajectory and behavior analysis
Trace details — corresponds to @observe_processor: on the Trajectory Details subpage of the Trajectory tab, you can see the complete interaction process of each Rollout:
- Trace list: shows all sampled trajectories; supports filtering by Sample ID / Trajectory ID / Epoch / Step
- Dialogue process: complete multi-turn interaction (user → assistant → tool_call → tool_result → assistant), intuitively showing the model's reasoning chain
- Reward score: each Step shows the corresponding Reward score and status (SUCCESS/FAILED)
- Tool call records: tool name, call parameters, return results, and duration
- Tracing sub-tab: the Span tree of each trajectory; expandable to view the full details of each tool call and LLM request
- Sample: one raw sample in the training data (one problem, one instruction, one prompt)
- Trajectory: one specific interaction trajectory produced by the same Sample under
n_rolloutssamplings - Relationship: one Sample → N Trajectories (N =
n_rollouts)
- Step dimension: select a training Step to view the Reward aggregation (average score, success rate, trend chart) of all samples under that Step, to judge overall training trend
- Sample dimension: select a Sample ID to compare the Reward of the same sample across different trajectories, to find problematic samples
- Trajectory dimension: view the raw score of each scoring dimension for a single trajectory, for attribution analysis
Metrics, output, and logs
Metrics tab — corresponds to rollout_metrics / reward_metrics: in the trace/ group of the Metrics tab, you can see the aggregation curves (avg / sum) of all custom metrics you defined in code. For the full metric groups, see §Training metrics reference below; for how to attribute an abnormal metric → §Judge training effects and troubleshoot.
Output tab: after training completes, you can see the Checkpoint list in the Output tab; each row contains the Checkpoint ID, publish status, and remaining retention time.
- Select the target Checkpoint and click the Publish button
- Wait for publishing to complete (status changes from "Pending Publish" to "Published")
- After publishing, you can call it via the model name in the API
validation/data/reward/mean@1 rather than the default last one. Pure distillation (without registering a reward component) has no validation reward; judge effects by loss trend and independent evaluation.
Logs tab: view training run logs on the Logs tab; they can also be obtained via the SDK / CLI:
- SDK:
AgenticRL.logs(job_id="ft-xxx", lines=100) - CLI:
dashscope rl logs "ft-xxx" --lines 100
Training metrics reference
Below is the full set of OPD-specific metrics and common metrics. Metrics are displayed on the Metrics page; click to expand each group's details.
OPD-specific metrics
The following are OPD-specific metrics:
distillation/ — distillation loss
distillation/ — distillation loss
Metric | Meaning and interpretation |
|---|---|
| Distillation loss; a decline indicates the student model is approaching the teacher model |
actor/distillation/loss and actor/pg_loss together constitute the total loss; both should decline or stabilize.trace/distillation/ — teacher model signal health
trace/distillation/ — teacher model signal health
Metric | Meaning and interpretation |
|---|---|
| Proportion of tokens for which the teacher model successfully provided a logprob (log probability); normally close to 1.0; less than 1 indicates missing scores |
| Proportion of tokens for which the teacher model did not provide a logprob; normally close to 0 |
| Proportion of empty responses returned by the teacher model; normally close to 0; an increase points to an anomaly on the teacher model side |
validation/ — validation set metrics (reported when Reward is enabled)
validation/ — validation set metrics (reported when Reward is enabled)
Metric | Meaning and interpretation |
|---|---|
| Aggregated reward mean on the validation set; a rise relative to the baseline is healthy |
trace/reward_metrics/<reward_name>/<metric> (the dimension name comes from the keys of reward_metrics and varies by task). Pure distillation (without registering a reward component, functions=None) does not report this group.Key metrics quick reference
Category | Metric | Interpretation |
|---|---|---|
Distillation |
| Decline or stabilize |
Teacher model health |
| Close to 1.0 |
Teacher model health |
| Close to 0 |
Teacher model health |
| Close to 0 |
Validation |
| Rise relative to baseline |
reward dimension |
| Key business dimensions do not regress |
Common metrics
Metrics produced during training are grouped by prefix as follows; detailed metric descriptions for each group are in the collapsible panels below:
Group prefix | Metric count | Type | Description |
|---|---|---|---|
actor/ | 8 | System | Policy network metrics: loss, entropy, KL divergence, clip ratio, gradient norm, learning rate |
critic/ | 12 | System | Reward and value estimation: mean / max / min of score / rewards / advantages / returns |
trajectory/ | 15 | System | Trajectory statistics: response length, prompt length, truncation rate, abort rate, conversation turns |
trace/ | 40+ | Mixed | Observability metrics: epoch, LLM call count, success rate, custom metrics |
timing/ | 11 | System | Latency analysis: Trainer phase duration, Rollout duration, per-token duration |
perf/ and fully_async/ metric groups.
Click to expand the full metric list for each group:
actor/ — policy network metrics (8)
actor/ — policy network metrics (8)
Metric | Meaning |
|---|---|
| Total loss (pg + entropy + ...) |
| Policy gradient loss |
| Average token entropy of the current policy, reflecting exploration level |
| KL divergence of the current policy relative to the initial policy |
| Importance sampling clip trigger rate, reflecting policy drift speed |
| Dual-clip lower-bound clip trigger rate (always 0 when dual-clip is not enabled) |
| Gradient norm |
| Current learning rate |
critic/ — reward and value estimation (12)
critic/ — reward and value estimation (12)
Metric | Meaning |
|---|---|
| Raw reward score statistics (before KL deduction) |
| Final training Reward statistics after KL penalty deduction |
| Advantage function statistics, reflecting the current policy's improvement over the baseline |
| Returns (Critic target) statistics |
trajectory/ — trajectory statistics (15)
trajectory/ — trajectory statistics (15)
Metric | Meaning |
|---|---|
| Response token count statistics (including abort samples) |
| Proportion of trajectories with zero response length |
| Effective response token count statistics after excluding aborts |
| Proportion of responses truncated at max length |
| Prompt token count statistics |
| Proportion of prompts truncated at max length |
| Statistics of turns of interaction between the Agent and the LLM |
trace/ — observability metrics
trace/ — observability metrics
Metric | Meaning |
|---|---|
| Current training epoch |
| Per-trajectory / total LLM call count |
| Agent task success rate / cumulative success count |
| Reward computation success rate / cumulative success count |
| Agent average / cumulative HTTP attempt count (including retries) |
| Average / cumulative value of a single Reward function |
| Custom sub-metrics returned by a Reward function |
timing/ — latency analysis (11)
timing/ — latency analysis (11)
timing/s/* (Trainer phase duration, seconds), timing/s/rollout/* (Rollout-side duration, seconds), and timing/ms/*_per_token (per-token duration, milliseconds).Metric | Meaning |
|---|---|
| Total duration of a complete Trainer step |
| Time for the Trainer to wait for and fetch a batch |
| Log-prob computation time of the old policy |
| Advantage computation time |
| Actor backpropagation + optimizer step time |
| Time for the Rollouter to sync parameters from the Trainer |
| Total duration of a single Rollout |
| Cumulative LLM inference time for a single trajectory |
| Reward call duration |
| Per-token duration in the generation phase |
| Per-token duration in the Actor update phase |
Judge training effects
The metrics reported during training are sufficient to judge whether a round of OPD is converging normally; post-training business effect evaluation is performed by the user according to their own criteria.
In-training interpretation order
On the Metrics page, interpret in the following order:
① Teacher model signal completeness — trace/distillation/valid_token_rate is close to 1.0. When noticeably below 1, teacher model scoring is missing, the explanatory power of other metrics decreases, and you should troubleshoot first (troubleshooting decision tree P2).
② Distillation convergence — actor/distillation/loss declines or stabilizes over training, indicating the student model is approaching the teacher model.
③ Validation set performance — validation/data/reward/mean@1 rises relative to the pre-training baseline. View per-dimension via trace/reward_metrics/<reward_name>/<metric>; key business dimensions (especially safety) must not regress.
Validation frequency is controlled by eval_steps. If a validation point exists at step 0, that point corresponds to the pre-training model state and can be used directly as the baseline.
Pure distillation (without registering a reward component, functions=None) produces no validation metrics or per-dimension metrics. Judge whether training is normal based on the distillation loss and teacher model health metrics; judge business effects via post-training evaluation.
Post-training business evaluation
Keep the pre-training baseline — distillation gain is a relative quantity; without a baseline, the improvement magnitude cannot be judged. Training produces a new model ID; the original model remains callable, but you must retain the baseline evaluation results yourself.
Maintain consistent criteria — pre- and post-training evaluation should use the same evaluation set and decoding parameters (temperature, max_tokens, whether thinking is enabled, etc.). When criteria are inconsistent, the difference is not comparable — for example, a response truncated by the length limit can manifest as a false decline in capability.
The example directory ships with evaluation and comparison scripts; these are only implementation references and can be modified as needed.
Acceptance criteria
Four items must be satisfied simultaneously:
Criterion | Requirement |
|---|---|
Main criterion | Core evaluation metric improves and is not random fluctuation |
Safety criterion | Safety dimensions are no higher than before training |
Format criterion | Format dimensions are no lower than before training |
Per-category criterion | No category significantly regresses after splitting by business category |
Measured value reference (for reference only, not a universal criterion)
Measured value reference (for reference only, not a universal criterion)
Metric | Base | Teacher | OPD |
|---|---|---|---|
Core success rate | 0.700 | 0.955 | 0.990 |
Safety violation rate | 0.235 | 0 | 0 |
OPD troubleshooting decision tree
Spot an abnormal curve on the Metrics page → locate the issue against this section → handle per the recommendations.
P1 Distillation loss not declining
- Main signal:
actor/distillation/lossdoes not decline over training or even rises - Root cause: teacher model signal missing / learning rate unsuitable (too small to converge or too large to break the output format) / poor data quality
- Handling: first check whether
valid_token_rateis close to 1.0 → when the signal is normal, loss not declining is often due to a too-small learning rate; increaselearning_rate(×1.5~2, see the training config tuning decision table) → spot-check the reference answers inrollout_extraof the training data
P2 Teacher model scoring missing
- Main signal:
trace/distillation/valid_token_rateis noticeably below 1.0 - Root cause: scoring missing on the teacher model side (the teacher model is hosted on the server, opaque to the user, and cannot be troubleshot directly)
- Handling: check whether
missing_token_rateandempty_response_raterise in tandem → if the teacher model timeout or empty-response ratio is high, submit a ticket
P3 Validation set not rising
- Main signal:
validation/data/reward/mean@1shows a downward inflection while training reward keeps rising - General handling: early stop (select an earlier Checkpoint on the Output tab) + keep pre- and post-training evaluation criteria consistent + view
reward_metricsregression per dimension - Additional root cause: overfitting the teacher model style (in pure distillation)
- Additional handling: spot-check the reference answer quality in
rollout_extra
Problem type | Primary | Secondary | Not needed |
|---|---|---|---|
Training divergence | Metrics | Trajectory | Logs |
Task FAILED | Logs | Metrics | Trajectory |
Reward not rising | Metrics → Trajectory | reward_metrics | Logs |
Tool call error | Tracing sub-tab | Logs | — |
Training slowdown | Metrics timing | Tracing sub-tab | — |
Poor output quality | Trajectory | reward_metrics | — |
Problem type | Primary | Secondary | Not needed |
|---|---|---|---|
Distillation loss not declining | Metrics | Trajectory | Logs |
Teacher model scoring missing | Metrics | Logs | Trajectory |
Validation set not rising | Metrics → Trajectory | reward_metrics | Logs |
Next steps
- OPD Training Overview → principles and end-to-end flow
- Model OPD Development / Agentic OPD Development → full function development details
- OPD Training Configuration → full set of submission parameters and hyperparameters
FAQ
Teacher model side anomalies
The teacher model is deployed on the server and is opaque to the user. The following symptoms require submitting a ticket:
Symptom | Handling |
|---|---|
| Submit a ticket |
Teacher model timeout or scoring missing | Submit a ticket |
Same-family teacher/student still reports a tokenizer mismatch | Submit a ticket |
Self-check items
General self-check items:
Symptom | Troubleshooting direction |
|---|---|
Tracing console is blank | ①Confirm env is not set to |
Reward intermittent FAILED | Unhandled empty messages / encoding errors → add try/except returning |
Low format-type dimension | Check whether the student model output format meets the Reward function requirements |
How to distinguish different Reward functions | Set a unique name via |
Symptom | Troubleshooting direction |
|---|---|
400 ... teacher_model must be a valid model ID | Use a Model Studio model ID |
On submission, error says the SDK lacks OPD capability | Switch to the wheel specified in the example |
Pure distillation has no validation metrics | Normal behavior (no reward component registered, functions=None); judge via independent evaluation |
format_valid abnormally low | Check whether the student model output is polluted by thinking/tool-call text, and confirm the Reward format-judgment regex matches the pre- and post-training decoding parameters |
Fault quick reference and FAILED troubleshooting
General fault quick reference:
Symptom | First check | Next check |
|---|---|---|
FAILED · function registration failed | classpath wrong / dependency missing | Check requirements.txt |
FAILED · Rollout timeout | Single-traj timeout | timeout ↑ / use Tracing to find the slow segment |
Tracing not visible | Console blank | Check ARMS authorization / requirements.txt |
Symptom | First check | Next check |
|---|---|---|
valid_token_rate low | Teacher model side anomaly | Submit a ticket |
Distillation loss not declining | Teacher model signal completeness | Learning rate / data quality |
tool_call_count is 0 / NO_TOOL frequent | Whether the student model supports function calling, and whether the passed tools parameter is correct | Check tool definition and api_key/base_url |
- Step 1 Task list confirm status and the failure time point
-
Step 2 Logs tab last 100-500 lines (SDK
AgenticRL.logs(job_id, lines=100)/ CLIdashscope rl logs --lines 100) -
Step 3 Distinguish error layer:
- User function error (Rollout/Reward throws an exception) →
test_functionsto reproduce locally → fix code → re-register/run - Framework error (OOM / insufficient resources / network) → tune
concurrency/capacity - Data error (JSONL parse failed) → validate single-line format and
rollout_extra
- User function error (Rollout/Reward throws an exception) →
Error pattern | Main symptom | Handling suggestion |
|---|---|---|
Insufficient resources | Scaling cannot keep up | See Step 3 framework error (tune |
Data format error | JSONL parse failed | Line-level JSON validation / |