From f0d2df0215f29a034a0710aec15116fdaa9a4f54 Mon Sep 17 00:00:00 2001 From: "zed-zippy[bot]" <234243425+zed-zippy[bot]@users.noreply.github.com> Date: Wed, 4 Feb 2026 11:29:46 -0500 Subject: [PATCH] ep: Lower max_output_tokens default for Ollama (#48370) (cherry-pick to preview) (#48373) Cherry-pick of #48370 to preview ---- Zeta 1 should not be configurable, not by this setting. Release Notes: - N/A --------- Co-authored-by: Ben Kunkle Co-authored-by: Oleksiy Syvokon Co-authored-by: Ben Kunkle --- assets/settings/default.json | 2 +- crates/edit_prediction/src/ollama.rs | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/assets/settings/default.json b/assets/settings/default.json index 8b739fc9ebcd4f4686365ce095e522429ef82661..6a3b2bfe68ae2788f22a671edad6f8d820a83ede 100644 --- a/assets/settings/default.json +++ b/assets/settings/default.json @@ -1550,7 +1550,7 @@ "ollama": { "api_url": "http://localhost:11434", "model": "qwen2.5-coder:7b-base", - "max_output_tokens": 256, + "max_output_tokens": 64, }, // Whether edit predictions are enabled when editing text threads in the agent panel. // This setting has no effect if globally disabled. diff --git a/crates/edit_prediction/src/ollama.rs b/crates/edit_prediction/src/ollama.rs index 19ffde67d1cdc083fe3f5d53c81343cb94365b1d..f23be607ddb54cc1c091955b19d5a50bc4afb2e7 100644 --- a/crates/edit_prediction/src/ollama.rs +++ b/crates/edit_prediction/src/ollama.rs @@ -110,7 +110,6 @@ impl Ollama { let Some(model) = settings.model.clone() else { return Task::ready(Ok(None)); }; - let max_output_tokens = settings.max_output_tokens; let api_url = settings.api_url.clone(); log::debug!("Ollama: Requesting completion (model: {})", model); @@ -127,7 +126,18 @@ impl Ollama { let is_zeta = is_zeta_model(&model); + // Zeta generates more tokens than FIM models. Ideally, we'd use MAX_REWRITE_TOKENS, + // but this might be too slow for local deployments. So we make it configurable, + // but we also have this hardcoded multiplier for now. + let max_output_tokens = if is_zeta { + settings.max_output_tokens * 4 + } else { + settings.max_output_tokens + }; + let result = cx.background_spawn(async move { + let zeta_editable_region_tokens = max_output_tokens as usize; + // For zeta models, use the dedicated zeta1 functions which handle their own // range computation with the correct token limits. let (prompt, stop_tokens, editable_range_override, inputs) = if is_zeta { @@ -136,7 +146,7 @@ impl Ollama { cursor_point, &path_str, &snapshot, - max_output_tokens as usize, + zeta_editable_region_tokens, ZETA_MAX_CONTEXT_TOKENS, ); let input_events = zeta1::prompt_for_events(&events, ZETA_MAX_EVENT_TOKENS);