Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
9cc968d
init
Dec 11, 2025
9259280
update
Dec 11, 2025
0b66b69
add overview
Dec 11, 2025
f0fe91b
add playground
Dec 11, 2025
4b4b020
Merge branch 'main' into hualxie/aitk_profiling
xieofxie Dec 11, 2025
6d9c1ac
Update docs/intelligentapps/overview.md
xieofxie Dec 12, 2025
ff0a8a1
Update docs/intelligentapps/playground.md
xieofxie Dec 12, 2025
526ac70
Update docs/intelligentapps/playground.md
xieofxie Dec 12, 2025
cd13998
Update docs/intelligentapps/profiling.md
xieofxie Dec 12, 2025
3edc3f2
Update docs/intelligentapps/profiling.md
xieofxie Dec 12, 2025
3d1edcd
Update docs/intelligentapps/profiling.md
xieofxie Dec 12, 2025
f6349ac
Update docs/intelligentapps/profiling.md
xieofxie Dec 12, 2025
294c9ca
Update docs/intelligentapps/profiling.md
xieofxie Dec 12, 2025
4bbdab6
Update docs/intelligentapps/profiling.md
xieofxie Dec 12, 2025
6c68eff
Update docs/intelligentapps/profiling.md
xieofxie Dec 12, 2025
08b401b
Update docs/intelligentapps/profiling.md
xieofxie Dec 12, 2025
f19cee5
Update docs/intelligentapps/profiling.md
xieofxie Dec 12, 2025
efc4a89
Update docs/intelligentapps/profiling.md
xieofxie Dec 12, 2025
bbaaaa4
Update docs/intelligentapps/profiling.md
xieofxie Dec 12, 2025
23700bb
Update docs/intelligentapps/profiling.md
xieofxie Dec 12, 2025
b52cec9
Update docs/intelligentapps/profiling.md
xieofxie Dec 12, 2025
c5246fd
Update docs/intelligentapps/profiling.md
xieofxie Dec 12, 2025
636f487
Apply suggestions from code review
xieofxie Dec 12, 2025
2462aff
Update docs/intelligentapps/profiling.md
xieofxie Dec 12, 2025
c4d4715
Merge branch 'main' into hualxie/aitk_profiling
xieofxie Dec 12, 2025
eaf4f1b
more fix
Dec 12, 2025
162b5e7
Merge branch 'main' into hualxie/aitk_profiling
xieofxie Dec 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions docs/intelligentapps/images/overview/profiling.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions docs/intelligentapps/images/profiling/by-model-file.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions docs/intelligentapps/images/profiling/events-view-admin.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions docs/intelligentapps/images/profiling/events-view.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions docs/intelligentapps/images/profiling/resource-usage-view.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions docs/intelligentapps/images/profiling/the-next-session.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions docs/intelligentapps/modelconversion.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ Model conversion is an integrated development environment designed to help devel

## Prerequisites

- VS Code must be installed. Follow these steps to [set up VS Code](https://code.visualstudio.com/docs/setup/setup-overview).
- AI Toolkit extension must be installed. For more information, see [install AI Toolkit](/docs/intelligentapps/overview.md#install-and-setup).
- Install the latest version of [Visual Studio Code](/download).
- Install the AI Toolkit VS Code extension. For more information, see [install AI Toolkit](/docs/intelligentapps/overview.md#install-and-setup).

## Create project

Expand Down
1 change: 1 addition & 0 deletions docs/intelligentapps/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ AI Toolkit offers seamless integration with popular AI models from providers lik
| [Fine-tuning](/docs/intelligentapps/finetune) | Customize and adapt models for specific domains and requirements. Train models locally with GPU support or leverage Azure Container Apps for cloud-based fine-tuning. | ![Screenshot showing the Fine-tuning interface with model adaptation and training controls](./images/overview/fine-tune.png) |
| [Model Conversion](/docs/intelligentapps/modelconversion) | Convert, quantize, and optimize machine learning models for local deployment. Transform models from Hugging Face and other sources to run efficiently on Windows with CPU, GPU, or NPU acceleration. | ![Screenshot showing the Model Conversion interface with tools for optimizing and transforming AI models](./images/overview/conversion.png) |
| [Tracing](/docs/intelligentapps/tracing) | Monitor and analyze the performance of your AI applications. Collect and visualize trace data to gain insights into model behavior and performance. | ![Screenshot showing the Tracing interface with tools for monitoring AI applications](./images/overview/tracing.png) |
| [Profiling](/docs/intelligentapps/profiling) | Diagnose the CPU, GPU, NPU resource usages of the process, ONNX model on different execution providers, and Windows ML events. | ![Screenshot showing the Profiling tool](./images/overview/profiling.png) |

## Who is AI Toolkit for?

Expand Down
13 changes: 13 additions & 0 deletions docs/intelligentapps/playground.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,13 @@ The available parameters depend on the model type and publisher. Common paramete
- Frequency Penalty: Reduces the likelihood of the model repeating the same tokens in the response. Higher values discourage repetition.
- Presence Penalty: Encourages the model to introduce new topics or concepts in the response. Higher values promote diversity in the generated text.

### Show resource usage

For local models, there's an additional option **Show resource usage**. When enabled, resource usage is shown with each response.

![Screenshot showing 'Show resource usage' in Model Preferences panel](./images/playground/parameters-show-resource-usage.png)


## Chat prompt

![Chat prompt input box in AI Toolkit playground showing an attachment icon for adding files.](./images/playground/chat-prompt.png)
Expand Down Expand Up @@ -96,6 +103,12 @@ Available features in the model response area:
- **Rendering**: Playground supports rendering of code snippets, images, markdown, LaTex and other content in the model's response.
- **Token Count**: Displays the number of tokens used in the model's response. This helps you understand the cost and performance of the model.

### Resource usage

When **Show resource usage** is enabled for a local model, a summary of usage is shown with each response. You could also switch to the [Profiling](/docs/intelligentapps/profiling) details by selecting **Usage details**.

![Screenshot showing resource usage for one response](./images/playground/response-resource-usage.png)

## Tool bar

The tool bar in the playground provides quick access to various actions and features:
Expand Down
92 changes: 92 additions & 0 deletions docs/intelligentapps/profiling.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
---
ContentId: 8105f83b-8291-467e-abac-2344b4f368cd
DateApproved: 12/14/2025
MetaDescription: Profiling Quickstart in AI Toolkit.
---
# Profiling an app using Windows Machine Learning

Profiling is a tool designed to help developers and AI engineers to diagnose the CPU, GPU, NPU resource usages of processes, ONNX model on different execution providers, and Windows ML events.

In this article, you could learn how to start profiling and how to inspect the resource usages view and the events view.

## Prerequisites

- Install the latest version of [Visual Studio Code](/download).
- Install the AI Toolkit VS Code extension. For more information, see [install AI Toolkit](/docs/intelligentapps/overview.md#install-and-setup).

## Profile on app startup

In this mode, the profiling tool profiles the next app that is started and that is sending out Windows ML events.
This option is ideal for testing a run-once app. In this case, you start profiling, then run the app, and the resource usages will begin showing up.

![Screenshot that shows how to start by the next session](./images/profiling/the-next-session.png)

The tool starts profiling a newly started app. This means that for profiling a Python notebook, if the kernel is already running, you need to restart the kernel to begin profiling for it. Just starting a new notebook does not automatically start profiling.

> [!IMPORTANT]
> To receive Windows ML events, the tool needs to be run in admin mode. If VS Code is not started in admin mode, a notification shows up and guides you to restart VS Code. You need to close all other VS Code instances to make the restart in admin mode work.
> ![Screenshot that shows a notification to restart VS Code in admin mode](./images/profiling/the-next-session-admin.png)


## Profile a running app

In this mode, the profiling tool starts profiling an already running app. You can select a process based on these criteria:

- Process ID: like 12345
- Process name: usually the name of app without `.exe`. The first match will be profiled.
- Process path: like `c:\Users\xxx\Inference.Service.Agent.exe`. The first match will be profiled.

This option is ideal for profiling an app that is already running and you're unable to restart it for profiling purposes.

![Screenshot that shows how to start by process id or name](./images/profiling/by-process-id-or-name.png)

## Profile an ONNX model

In this mode, the profiling tool starts profiling an ONNX model file on a target execution provider (EP) for a given duration. You can see the resource usage while it's running.

This option is ideal for profiling an ONNX model on different EPs.

![Screenshot that shows how to start by model file](./images/profiling/by-model-file.png)

After profiling, a report folder is created with logs and data.

![Screenshot that show the report data](./images/profiling/by-model-file-result.png)

## Resource Usages view

In the main window, the plot on the top shows usage of CPU, GPU, NPU, and memory. The usage is updated every second, and kept for 10 minutes. You can use the tools on the top right to navigate the timeline by zooming in, zooming out, and panning.

![Screenshot that shows the resource usages view](./images/profiling/resource-usage-view.png)

> [!NOTE]
> This feature uses performance counters. To achieve higher accuracy, you could also try [Windows Performance Recorder](https://learn.microsoft.com/en-us/windows-hardware/test/wpt/windows-performance-recorder).

## Windows ML Events view

In the main window, the plot on the bottom shows Windows ML events. Its timeline is synced with the Resource Usages view, so you can easily determine how resources are used when certain events occur.

> [!Important]
> To receive Windows ML events, the tool needs to be run in admin mode. If VS Code is not started in admin mode, a notification shows up and guides you to restart VS Code. You need to close all other VS Code instances to make the restart in admin mode work.
> ![Screenshot that shows a notification to restart VS Code in admin mode](./images/profiling/events-view-admin.png)

Currently, we only show events of the following types:

- Ensure ExecutionProvider Ready: when Windows ML is preparing the EP
- Session Creation: when the session is created
- Inference: when the model inferences on the session

![Screenshot that shows the Windows ML events view](./images/profiling/events-view.png)

## What you learned

In this article, you learned how to:

- Start profiling in different ways
- Inspect the Resource Usages view
- Inspect the Windows ML Events view

## See also

- [How to measure performance of AI models running locally](https://learn.microsoft.com/en-us/windows/ai/npu-devices/#how-to-measure-performance-of-ai-models-running-locally-on-the-device-npu)
- [Performance Monitor](https://learn.microsoft.com/en-us/troubleshoot/windows-server/support-tools/troubleshoot-issues-performance-monitor)
- [ONNX Runtime Tracing](https://onnxruntime.ai/docs/performance/tune-performance/logging_tracing.html)
1 change: 1 addition & 0 deletions docs/toc.json
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,7 @@
["Fine-tuning (Project Template)", "/docs/intelligentapps/finetune-legacy"],
["Model Conversion", "/docs/intelligentapps/modelconversion"],
["Tracing", "/docs/intelligentapps/tracing"],
["Profiling", "/docs/intelligentapps/profiling"],
["FAQ", "/docs/intelligentapps/faq"],
["", "", {
"name": "Reference",
Expand Down