[PR #9631] [MERGED] sample: add numerical stability to softmax transform #75312

Closed
opened 2026-05-05 07:44:53 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/9631
Author: @ParthSareen
Created: 3/10/2025
Status: Merged
Merged: 3/10/2025
Merged by: @ParthSareen

Base: mainHead: parth/sampler-softmax-stability


📝 Commits (3)

📊 Changes

3 files changed (+28 additions, -42 deletions)

View changed files

📝 sample/samplers.go (+2 -1)
📝 sample/transforms.go (+16 -24)
📝 sample/transforms_test.go (+10 -17)

📄 Description

  • Possible that not applying numerical stability on softmax was creating issues on sampling
  • collapsed the temperature and softmax transformations as both needed the max logit value

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ollama/ollama/pull/9631 **Author:** [@ParthSareen](https://github.com/ParthSareen) **Created:** 3/10/2025 **Status:** ✅ Merged **Merged:** 3/10/2025 **Merged by:** [@ParthSareen](https://github.com/ParthSareen) **Base:** `main` ← **Head:** `parth/sampler-softmax-stability` --- ### 📝 Commits (3) - [`1ea0b0b`](https://github.com/ollama/ollama/commit/1ea0b0b4f6d2ee952478205603bcb6e200854e7c) add numerical stability to softmax transform - [`f4b7572`](https://github.com/ollama/ollama/commit/f4b75720cd90b8a0c1b6522234e2e2dd81db8018) rename transform - [`c9587e7`](https://github.com/ollama/ollama/commit/c9587e7db510d9975adca92d81a6b84516a0d067) update comments ### 📊 Changes **3 files changed** (+28 additions, -42 deletions) <details> <summary>View changed files</summary> 📝 `sample/samplers.go` (+2 -1) 📝 `sample/transforms.go` (+16 -24) 📝 `sample/transforms_test.go` (+10 -17) </details> ### 📄 Description - Possible that not applying numerical stability on softmax was creating issues on sampling - collapsed the temperature and softmax transformations as both needed the max logit value --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-05-05 07:44:53 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/ollama#75312