Repository navigation
Pin the samples to Windows ML 2.9.42 experimental - #46
Merged
Merged
Conversation
Microsoft.Windows.AI.MachineLearning moves to 2.9.42-experimental and the LibLlama packages to 0.7.0.113-experimental, which come from the same release. Text generation from published weights can now hold its key and value cache as INT8 or 16-bit floating point, and a capacity that doesn't fit in dedicated GPU memory fails with an error that names the largest one that fits. Only WinMLTextGenerationTask.h and the metadata change, with methods appended to two existing interfaces. llama.cpp stays at build 11847 with backend API 3. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ca5b72cf-ae75-4384-9fc4-a6081b9fddea
2.9.42 adds SetKeyValueCacheType and GetKeyValueCacheType to IWinMLModelTextGenerationConfiguration, and GetKeyValueCacheType to IWinMLTextGenerationSession. The rules for sessions from a model, composed models and llama.cpp sessions now say which types each holds and how CreateSession fails, and the Python section names the new methods. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ca5b72cf-ae75-4384-9fc4-a6081b9fddea
Nick Eubanks (nieubank)
marked this pull request as ready for review
November 20, 2026 04:27
The 2.9.42a0 wheels aren't on PyPI yet, and 2.9.36a0 has no set_key_value_cache_type, so the reference names the release that does. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: ca5b72cf-ae75-4384-9fc4-a6081b9fddea
angelser
approved these changes
Nov 20, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Moves the samples to
Microsoft.Windows.AI.MachineLearning2.9.42-experimental and the LibLlama packages to 0.7.0.113-experimental, and documents the new key and value cache type in the text generation reference.Samples/Directory.Packages.propsis the only build change. All five NuGet packages are on nuget.org.The matching
windowsml2.9.42a0 wheels aren't on PyPI yet, so Python stays on 2.9.36a0 until they are. The Python samples take their version from the installedwindowsml, so they keep working, and the reference says the new Python methods need 2.9.42a0.Since 2.9.36, 2.9.42 brings these changes.
SetKeyValueCacheTypeonIWinMLModelTextGenerationConfigurationsets it, andGetKeyValueCacheTypeon the configuration and the session reports it. INT8 needskv_cache_scales.safetensorsbeside the model.CreateSessionwithERROR_NOT_ENOUGH_MEMORYand names the largest capacity that fits, instead of spilling into shared memory.--kv-cache-typeand--compiled-program-directory, and enables parallel tool calls on model lanes when a request omitsparallel_tool_calls.In the package only
WinMLTextGenerationTask.hand the metadata change, with methods added at the end of two existing interfaces, so no sample source changes. ONNX Runtime stays at 1.30.1, and llama.cpp at build 11847 with backend API 3.Related issue
None.
Affected samples
Samples/Directory.Packages.props, which sets the package versions for every sample catalogdocs/api-reference/IWinMLTextGenerationTask.md, which adds the key and value cache type to the rules for sessions from a model, composed models and llama.cpp sessions, and the Python methodsChecklist
Samples/WindowsML-Samples.slnlocally with Visual Studio 2022 or Visual Studio 2026 (the samples build per catalog, so I built the Runtime, Tasks and Server catalogs withbuild.ps1 -Rebuildand Task Studio withdotnet build, Visual Studio 2026, for ARM64 and x64).clang-format(ranSamples/format-code.ps1if available) (there's no C++ change in this PR)README.md(no README names the version, because the build and the docs take it fromDirectory.Packages.props)Testing notes
Tested on an NVIDIA RTX Spark device (ARM64) running Windows 11, with Visual Studio 2026 and Python 3.14 ARM64.
.\build.ps1 -Rebuildbuilds the Runtime, Tasks and Server samples for ARM64 and x64 with no warnings, and Task Studio builds for both.windowsml2.9.42a0.FLOAT16,FLOAT16works with a 32,768-token capacity, andINT8without a scales file failsCreateSessionwithHRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED), as the reference describes.Not covered
INT8cache, because the sample models don't includekv_cache_scales.safetensors.