feat(profiler): ATIF-native profiler#1751
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Tip Try Coding Plans. Let us write the prompt for your AI agent so you can ship faster (with fewer bugs). Comment |
…lerStep adapter Signed-off-by: afourniernv <afournier@nvidia.com>
778cf53 to
b740e0b
Compare
|
Thx @afourniernv. I like the guiding principles of this change. Is there a way to look for drift in behavior before and after? For example for evaluators, I added a script to provide a summary of diff in scores when using IntermediateStep vs. AtifTrajectory - PR-1747 |
| from nat.plugins.profiler.atif_dataframe import dataframe_to_profiler_traces | ||
| from nat.plugins.profiler.forecasting.model_trainer import ModelTrainer | ||
| from nat.plugins.profiler.utils import create_standardized_dataframe | ||
| from nat.utils.atif_converter import IntermediateStepToATIFConverter |
There was a problem hiding this comment.
With the changes in this #1747 you should be able to always pass ATIF Trajectory list to ProfilerRunner.run in EvaluationRun.profile_workflow.
That way we can drop the IntermediateStepToATIFConverter and have nvidia-nat-profiler only deal with ATIF (and drop all IntermediateStep references)
NAT-366: ATIF-native profiler
Summary
How it works
list[Trajectory]list[Trajectory]pd.DataFramepd.DataFrameImplements NAT-366: the profiler now accepts ATIF Trajectories and uses ATIF internally. Both IntermediateStep (existing) and Trajectory (ATIF) inputs are supported at the boundary.
Requirements (per JIRA / Anuradha doc)
list[list[IntermediateStep]]andlist[Trajectory]. IntermediateStep input is converted to ATIF at the boundary when needed.create_dataframe_from_atif(trajectories)produces the same DataFrame schema ascreate_standardized_dataframe. Downstream modules consume DataFrame.step.extra: Usesstep.extrafor profiling metadata (function_id, parent_function_id, span_event_timestamp, nat_tool_ancestry for per-tool ancestry).Changes
New
atif_dataframe.py:create_dataframe_from_atif(trajectories)— builds profiler DataFrame from ATIF trajectories. Maps user → WORKFLOW_START; agent with metrics → LLM_START/LLM_END; agent with tool_calls+observation → TOOL_END; agent message-only → WORKFLOW_END. Includescached_tokensintotal_tokens.dataframe_to_profiler_traces(df)for JSON output and PredictionTrieBuilder.Modified
profile_runner.py: Usescreate_dataframe_from_atif;_normalize_to_trajectories()converts IntermediateStep → ATIF when needed.pd.DataFrame | list[list[IntermediateStep]]; use DataFrame path when available.RandomForestModel/ModelTrainer: Accept DataFrame fromcreate_dataframe_from_atiffor training.atif_converter.py: Minor updates for profiling metadata instep.extra.Tests
dataframe_to_profiler_traces, empty DataFrame, ModelTrainer with DataFrame.nat evalwith simple calculator example (profiler enabled).Testing
uv run pytest packages/nvidia_nat_profiler/tests/ --ignore=.../test_profiler_e2e.pynat eval --config_file examples/evaluation_and_profiling/simple_calculator_eval/configs/config-atif-smoke.ymlBy Submitting this PR I confirm: