[PR #11715] chore: remove dependencies on 16-bit floats #24150

Open
opened 2026-04-19 17:24:49 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/11715
Author: @mxyng
Created: 8/6/2025
Status: 🔄 Open

Base: mainHead: mxyng/16-bit


📝 Commits (3)

📊 Changes

8 files changed (+295 additions, -59 deletions)

View changed files

convert/bfloat16/bfloat16.go (+21 -0)
convert/bfloat16/bfloat16_test.go (+82 -0)
convert/float16/float16.go (+97 -0)
convert/float16/float16_test.go (+75 -0)
📝 convert/reader_safetensors.go (+9 -17)
📝 convert/reader_test.go (+11 -36)
📝 go.mod (+0 -2)
📝 go.sum (+0 -4)

📄 Description

this change removes two dependencies on float16 and bfloat16 types, replacing them with simpler implementations. the new implementations are 3x faster for ollama's specific use cases

some metrics:

goos: darwin
goarch: arm64
pkg: github.com/ollama/ollama/convert/float16
cpu: Apple M3 Max
BenchmarkFloat16/x448/float16-16                     159           7398462 ns/op
BenchmarkFloat16/simple-16                           512           2327098 ns/op
PASS
ok      github.com/ollama/ollama/convert/float16        2.553s
goos: darwin
goarch: arm64
pkg: github.com/ollama/ollama/convert/bfloat16
cpu: Apple M3 Max
BenchmarkBfloat16/d4l3k/go-bfloat16-16               516           2269453 ns/op
BenchmarkBfloat16/simple-16                          1759            626316 ns/op
PASS
ok      github.com/ollama/ollama/convert/bfloat16        2.502s

🔄 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/11715 **Author:** [@mxyng](https://github.com/mxyng) **Created:** 8/6/2025 **Status:** 🔄 Open **Base:** `main` ← **Head:** `mxyng/16-bit` --- ### 📝 Commits (3) - [`276c4df`](https://github.com/ollama/ollama/commit/276c4df7702d9ff25c3b3e10778e90c5654428de) drop bfloat16 dependency - [`7bd3f02`](https://github.com/ollama/ollama/commit/7bd3f0269cb9e29a2b2d02111eb355cfc345945b) drop float16 dependency - [`69f3dfd`](https://github.com/ollama/ollama/commit/69f3dfdedf5c9f4a15f9aa271c8ff1faf32dc6fa) update tests ### 📊 Changes **8 files changed** (+295 additions, -59 deletions) <details> <summary>View changed files</summary> ➕ `convert/bfloat16/bfloat16.go` (+21 -0) ➕ `convert/bfloat16/bfloat16_test.go` (+82 -0) ➕ `convert/float16/float16.go` (+97 -0) ➕ `convert/float16/float16_test.go` (+75 -0) 📝 `convert/reader_safetensors.go` (+9 -17) 📝 `convert/reader_test.go` (+11 -36) 📝 `go.mod` (+0 -2) 📝 `go.sum` (+0 -4) </details> ### 📄 Description this change removes two dependencies on float16 and bfloat16 types, replacing them with simpler implementations. the new implementations are 3x faster for ollama's specific use cases some metrics: ``` goos: darwin goarch: arm64 pkg: github.com/ollama/ollama/convert/float16 cpu: Apple M3 Max BenchmarkFloat16/x448/float16-16 159 7398462 ns/op BenchmarkFloat16/simple-16 512 2327098 ns/op PASS ok github.com/ollama/ollama/convert/float16 2.553s ``` ``` goos: darwin goarch: arm64 pkg: github.com/ollama/ollama/convert/bfloat16 cpu: Apple M3 Max BenchmarkBfloat16/d4l3k/go-bfloat16-16 516 2269453 ns/op BenchmarkBfloat16/simple-16 1759 626316 ns/op PASS ok github.com/ollama/ollama/convert/bfloat16 2.502s ``` --- <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-04-19 17:24:49 -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#24150