OpenFlowLM-Next icon indicating copy to clipboard operation
OpenFlowLM-Next copied to clipboard

Open engine: Nanbeige4.1-3B and Phi4-mini-Instruct

Open Cyronius opened this issue 2 months ago • 0 comments

Title

Open engine: Nanbeige4.1-3B and Phi4-mini-Instruct

Body

Two more models from the registry now run on the open-source NPU kernels instead of the closed engine.

Nanbeige4.1-3B was easy — under the hood it's built the same way as the Llama models we already support, just with a different number of attention heads, so it only needed those extra head counts added to the list of shapes the kernels are validated for.

Phi4-mini needed one real fix. Most models rotate an attention head's entire set of numbers as part of position encoding; Phi4-mini only rotates part of it (96 out of 128). The kernel that does that rotation only knew how to handle a full head or an exact half, so it needed a small addition to handle this in-between case. That addition doesn't change anything for models that don't need it — I re-ran the existing kernel builds afterward and they came out byte-for-byte identical to before.

While wiring up Nanbeige I also found and fixed a crash: its chat handler was reaching directly into the closed engine's internals to save and restore conversation state, which doesn't exist when running on the open engine, so the very first request to the server would crash it.

Both models are checked against an independent from-scratch reference implementation (not just "it produces text"), and both go through the full app end to end via flm serve.

PR: (linked below)

Cyronius avatar Sep 10 '26 21:09 Cyronius