[PR #12125] model: add frontend support for diffusion language models #76011

Open
opened 2026-05-05 08:28:35 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ollama/ollama/pull/12125
Author: @eric8810
Created: 8/30/2025
Status: 🔄 Open

Base: mainHead: main


📝 Commits (1)

  • b73a35c model: add frontend support for diffusion language models

📊 Changes

7 files changed (+285 additions, -12 deletions)

View changed files

📝 api/types.go (+156 -0)
📝 llama/llama.go (+15 -0)
📝 llm/server.go (+42 -0)
📝 runner/llamarunner/runner.go (+10 -0)
📝 server/images.go (+22 -2)
📝 server/routes.go (+39 -10)
📝 types/model/capability.go (+1 -0)

📄 Description

This PR adds comprehensive frontend support for diffusion language models (such as Dream-Coder and LLaDA) to
Ollama, enabling users to interact with these models through the existing API while providing
diffusion-specific parameters and capabilities.

Key Changes

• New API Types: Added DiffusionOptions struct with support for diffusion-specific parameters including steps,
visual mode, epsilon, block length, algorithm type, temperature, CFG scale, and Gumbel noise
• Parameter Handling: Extended Options.FromMap() and FormatParams() to parse and validate diffusion parameters
from API requests• Model Capability Detection: Added CapabilityDiffusion and automatic detection of diffusion
models based on architecture (dream/llada)
• Backend Integration: Propagated diffusion parameters through the entire inference pipeline from API → server
→ runner → llama.cpp
• API Validation: Added proper error handling for diffusion models - they support /api/generate but not
/api/chat
• Native Bindings: Added IsDiffusion() method to detect diffusion models at the llama.cpp level

Technical Details

  • Diffusion parameters are passed as a nested diffusion object in the API request options
  • Parameters include defaults (steps: 128, algorithm: 4) matching llama.cpp expectations
  • Chat endpoint explicitly rejects diffusion models with helpful error messages
  • All parameter parsing includes proper type validation and error handling
  • Integration follows existing patterns for model capabilities and parameter propagation

Test Plan

  • Verify diffusion model detection works correctly for Dream/LLaDA architectures
  • Test parameter validation for all diffusion options (int32, float32, bool types)
  • Confirm chat endpoint properly rejects diffusion models
  • Validate generate endpoint accepts diffusion models with proper parameters
  • Test parameter defaults are applied when not specified

🔄 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/12125 **Author:** [@eric8810](https://github.com/eric8810) **Created:** 8/30/2025 **Status:** 🔄 Open **Base:** `main` ← **Head:** `main` --- ### 📝 Commits (1) - [`b73a35c`](https://github.com/ollama/ollama/commit/b73a35c9b0dd4e1081f544de31d0ee979af0f56c) model: add frontend support for diffusion language models ### 📊 Changes **7 files changed** (+285 additions, -12 deletions) <details> <summary>View changed files</summary> 📝 `api/types.go` (+156 -0) 📝 `llama/llama.go` (+15 -0) 📝 `llm/server.go` (+42 -0) 📝 `runner/llamarunner/runner.go` (+10 -0) 📝 `server/images.go` (+22 -2) 📝 `server/routes.go` (+39 -10) 📝 `types/model/capability.go` (+1 -0) </details> ### 📄 Description This PR adds comprehensive frontend support for diffusion language models (such as Dream-Coder and LLaDA) to Ollama, enabling users to interact with these models through the existing API while providing diffusion-specific parameters and capabilities. Key Changes • New API Types: Added DiffusionOptions struct with support for diffusion-specific parameters including steps, visual mode, epsilon, block length, algorithm type, temperature, CFG scale, and Gumbel noise • Parameter Handling: Extended Options.FromMap() and FormatParams() to parse and validate diffusion parameters from API requests• Model Capability Detection: Added CapabilityDiffusion and automatic detection of diffusion models based on architecture (dream/llada) • Backend Integration: Propagated diffusion parameters through the entire inference pipeline from API → server → runner → llama.cpp • API Validation: Added proper error handling for diffusion models - they support /api/generate but not /api/chat • Native Bindings: Added IsDiffusion() method to detect diffusion models at the llama.cpp level Technical Details - Diffusion parameters are passed as a nested diffusion object in the API request options - Parameters include defaults (steps: 128, algorithm: 4) matching llama.cpp expectations - Chat endpoint explicitly rejects diffusion models with helpful error messages - All parameter parsing includes proper type validation and error handling - Integration follows existing patterns for model capabilities and parameter propagation Test Plan - Verify diffusion model detection works correctly for Dream/LLaDA architectures - Test parameter validation for all diffusion options (int32, float32, bool types) - Confirm chat endpoint properly rejects diffusion models - Validate generate endpoint accepts diffusion models with proper parameters - Test parameter defaults are applied when not specified --- <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 08:28:35 -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#76011