mlflow无法看到prompt_text,已设置token2text=True
背景: 在运行agentic RL的示例程序,发现mlfow没打印prompt_text,已经按照要求添加token2text=True,请问应该如何处理。 https://verl.readthedocs.io/en/latest/start/agentic_rl.html
set -x
ulimit -n 65535
PROJECT_DIR="$(pwd)" CONFIG_PATH="$PROJECT_DIR/examples/sglang_multiturn/config"
python3 -m verl.trainer.main_ppo
--config-path="$CONFIG_PATH"
--config-name='gsm8k_multiturn_grpo'
algorithm.adv_estimator=grpo
data.train_batch_size=256
data.max_prompt_length=1024
data.max_response_length=1024
data.filter_overlong_prompts=True
data.truncation='error'
data.return_raw_chat=True
actor_rollout_ref.model.path=/workspace/data/Qwen2.5-3B-Instruct
actor_rollout_ref.actor.optim.lr=1e-6
actor_rollout_ref.model.use_remove_padding=True
actor_rollout_ref.actor.ppo_mini_batch_size=256
actor_rollout_ref.actor.ppo_micro_batch_size_per_gpu=1
actor_rollout_ref.actor.use_kl_loss=True
actor_rollout_ref.actor.kl_loss_coef=0.001
actor_rollout_ref.actor.kl_loss_type=low_var_kl
actor_rollout_ref.actor.entropy_coeff=0
actor_rollout_ref.model.enable_gradient_checkpointing=True
actor_rollout_ref.actor.fsdp_config.param_offload=False
actor_rollout_ref.actor.fsdp_config.optimizer_offload=False
actor_rollout_ref.rollout.log_prob_micro_batch_size_per_gpu=1
actor_rollout_ref.rollout.tensor_model_parallel_size=2
actor_rollout_ref.rollout.name=sglang
actor_rollout_ref.rollout.mode=async
actor_rollout_ref.rollout.gpu_memory_utilization=0.8
actor_rollout_ref.rollout.n=16
actor_rollout_ref.ref.log_prob_micro_batch_size_per_gpu=1
actor_rollout_ref.ref.fsdp_config.param_offload=True
actor_rollout_ref.rollout.trace.backend=mlflow
actor_rollout_ref.rollout.trace.token2text=True
algorithm.use_kl_in_reward=False
trainer.critic_warmup=0
trainer.logger='["console","mlflow"]'
trainer.project_name='gsm8k_tool-agent'
trainer.experiment_name='qwen2.5-3b_function_rm-gsm8k-sgl-tool-agent-verify-n16'
trainer.n_gpus_per_node=8
trainer.nnodes=1
trainer.save_freq=-1
trainer.test_freq=20
data.train_files=$HOME/data/gsm8k/train.parquet
data.val_files=$HOME/data/gsm8k/test.parquet
actor_rollout_ref.rollout.multi_turn.tool_config_path="$PROJECT_DIR/examples/sglang_multiturn/config/tool_config/gsm8k_tool_config.yaml"
trainer.total_epochs=15 $@
列表页面展示也很奇怪,都是null
请问解决了吗,我也遇到这个问题了
same problem here
我跑bash examples/sglang_multiturn/run_qwen2.5-3b_gsm8k_tool_agent_mlflow.sh这个例子得到的trace都是空的
https://verl.readthedocs.io/en/latest/advance/rollout_trace.html#usage-of-mlflow 这个给的例子mlflow版本是3.1.1,现在最新的是3.4.0。安装3.1.1版本后我这边看起来没问题了
mlflow3.8.1 还有这个问题, mlflow 3.1.1 似乎不兼容最新的 verl 7.0 版本,有人能提供一下精确版本吗
same here for verl 0.8.0 + mlflow 3.8.1
中文:
这个问题看起来不是单纯的配置问题。当前 main 上 token2text=True 的实现只会在被 trace 函数的返回值里查找 prompt_ids / response_ids,并且要求被装饰对象本身有 self.tokenizer。但 async agentic RL 路径里的 LLMServerClient.generate 接收的 prompt_ids 是输入参数,返回的是 TokenOutput.token_ids,不是 response_ids,所以这个 span 里不会自动生成 prompt_text / response_text。
已有 PR #5588 正是针对这个缺口提出修复:支持自定义 token2text 字段映射,把 input.prompt_ids 解码为 prompt_text,把 output.token_ids 解码为 response_text,并增加 tokenizer fallback。但该 PR 已关闭且没有合并,所以目前不能认为 issue 已解决。
短期 workaround:如果只需要完整轨迹文本,优先查看 ToolAgentLoop.run 的输出 span;若使用 MLflow 新版本仍看到空 trace,可以先按评论中提到的 MLflow 版本差异做本地验证,但根因层面仍需要类似 #5588 的代码支持才能让 LLMServerClient.generate 的每轮输入/输出文本稳定可见。
English:
This does not look like a pure configuration issue. On current main, token2text=True only decodes prompt_ids / response_ids from the traced function output, and it also requires the traced object to have self.tokenizer. In the async agentic RL path, LLMServerClient.generate receives prompt_ids as an input argument and returns TokenOutput.token_ids, not response_ids, so that span will not automatically get prompt_text / response_text.
PR #5588 was aimed at exactly this gap: configurable token2text field mappings for input.prompt_ids -> prompt_text and output.token_ids -> response_text, plus a tokenizer fallback. However, that PR is closed and was not merged, so the issue should not be considered fixed yet.
Short-term workaround: if you only need the full trajectory text, inspect the ToolAgentLoop.run output span first. If newer MLflow versions still show empty traces, it is worth validating the MLflow version difference mentioned above, but the code-level fix still needs support similar to #5588 for stable per-turn text visibility in LLMServerClient.generate.
This response was generated by a scheduled Codex GPT5.5 issue processing task.
Hi, I'd like to work on this issue.
I confirmed the root cause on current main: token2text currently reads prompt_ids / response_ids only from the traced output and requires a tokenizer on the decorated object. In the async agentic RL path, LLMServerClient.generate receives prompt_ids as input and returns TokenOutput.token_ids, so its per-turn span cannot produce prompt_text / response_text.
I searched the open PRs and found no active duplicate. I also reviewed the closed, unmerged PR #5588. Compared with that PR's general configurable field-mapping and global tokenizer fallback, this proposed fix is intentionally narrower:
- keep the existing public API and configuration unchanged;
- decode
input.prompt_idsandoutput.token_idswhile preserving the existingoutput.prompt_ids/output.response_idsbehavior; - provide the tokenizer to the LLM client only when
token2textis enabled; - add an MLflow-focused CPU unit test and update the rollout-trace documentation.
The tested implementation is available on YAO-001:fix/3515-rollout-trace-token2text, and Draft PR #7204 is now open for review: https://github.com/verl-project/verl/pull/7204.