From 6c5f7fe8f3ce009502e4ee25248a389e7b7c47e9 Mon Sep 17 00:00:00 2001 From: Piotr Mazurek Date: Tue, 22 Sep 2026 20:08:59 -0700 Subject: [PATCH] lfm2: restore t_layer_inp capture for speculative layer extraction The models/ split dropped the loop-head capture (present at 38a5b42d9, src/models/lfm2.cpp:252), so any decode with embeddings_layer_inp set - i.e. serving an LFM2 target with a DFlash/DSpark drafter - aborts in llm_graph_result::set_outputs (llama-graph.cpp:1352 'layer input tensor is null') as soon as graph_reserve builds the embd-batch graph variant, e.g. on the first mtmd image chunk of a vision request. Same unconditional capture style as qwen3.cpp. Verified: LFM2.5-VL-3B + DSpark sidecar no longer crashes on image requests; text-only LFM2.5-2.6B + its released sidecar unaffected (tau ~3.8 on a math probe). --- src/models/lfm2.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/models/lfm2.cpp b/src/models/lfm2.cpp index 70e837d6eb2f..8f526a93fb59 100644 --- a/src/models/lfm2.cpp +++ b/src/models/lfm2.cpp @@ -242,6 +242,8 @@ llama_model_lfm2::graph::graph(const llama_model & model, const llm_graph_ ggml_tensor * inp_out_ids = build_inp_out_ids(); for (int il = 0; il < n_layer; ++il) { + res->t_layer_inp[il] = cur; + const bool is_moe_layer = il >= static_cast(hparams.n_layer_dense_lead); auto * prev_cur = cur;