Skip to content

Add System One API for Liquid AI d1 decision models on OpenVINO - #206

Open
SearchSavior wants to merge 12 commits into
mainfrom
ccr-b120949a-fpuwvt
Open

SearchSavior wants to merge 12 commits into
mainfrom
ccr-b120949a-fpuwvt

Conversation

@SearchSavior

@SearchSavior SearchSavior commented Dec 3, 2026 •

Copy link
Copy Markdown
Owner

This pr was written by claude using the mobile app and cpu in the cloud; the 20 claude plan gets you access to 15gb ram, 60gb disk and 4 cpu cores that usually have amx instruction support. For openvino development using tiny models this creates an ideal workflow for hammering out implementations without much effort until the end, which is where we are now. Anyway I'll update the pr with more notes once we get gpu performance evaluated.

--‐-

Serve LiquidAI/d1-2B and LiquidAI/d1-Omni-2B through POST /v1/systemone
(the Liquid API / llama.cpp request and response) and /v1/systemone/batch,
with a pipeline written from scratch on OpenVINO: no remote code, torch or
transformers model classes at runtime.

  • src/engine/openvino/d1/export.py: self-contained export (fp16, int8,
    int4) of the text embeddings, a stateless language graph under d1's
    "set" attention (logits at answer slots, hidden states for reads), the
    vision tower and d1-Omni's audio encoder.
  • prompt, answers, parsing, media, tokenizer: d1's prompt protocol,
    packing, readouts, calibration, pointer spans, boxes, number and date
    parsing, and image, video and audio preparation.
  • pipeline.py / d1.py: request preparation with per-request errors,
    token-budget batching, OpenArc engine with calls served together.
  • Model type d1, engine openvino, config block system_one_config
    (score_readout, abstain_below, set_size), worker queue with dynamic
    batching, CLI model types derived from ModelType.
  • bench.py: the model card's speed table and agreement with d1's own
    PyTorch answers.
  • Tests: goldens from d1's reference code at pinned revisions (prompts,
    readouts, reads, media, every answer type, spans, parsing), media,
    pipeline orchestration on fake graphs, routes, worker, and integration
    tests on exported models against fp32 reference answers.
  • Docs: Decision Models page, configure and models entries.

claude added 12 commits December 1, 2026 08:35
Serve LiquidAI/d1-2B and LiquidAI/d1-Omni-2B through POST /v1/systemone
(the Liquid API / llama.cpp request and response) and /v1/systemone/batch,
with a pipeline written from scratch on OpenVINO: no remote code, torch or
transformers model classes at runtime.

- src/engine/openvino/d1/export.py: self-contained export (fp16, int8,
  int4) of the text embeddings, a stateless language graph under d1's
  "set" attention (logits at answer slots, hidden states for reads), the
  vision tower and d1-Omni's audio encoder.
- prompt, answers, parsing, media, tokenizer: d1's prompt protocol,
  packing, readouts, calibration, pointer spans, boxes, number and date
  parsing, and image, video and audio preparation.
- pipeline.py / d1.py: request preparation with per-request errors,
  token-budget batching, OpenArc engine with calls served together.
- Model type `d1`, engine `openvino`, config block `system_one_config`
  (score_readout, abstain_below, set_size), worker queue with dynamic
  batching, CLI model types derived from ModelType.
- bench.py: the model card's speed table and agreement with d1's own
  PyTorch answers.
- Tests: goldens from d1's reference code at pinned revisions (prompts,
  readouts, reads, media, every answer type, spans, parsing), media,
  pipeline orchestration on fake graphs, routes, worker, and integration
  tests on exported models against fp32 reference answers.
- Docs: Decision Models page, configure and models entries.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011SRNH8ZNUsNWCxzMiAC7J6
fp16 weights expand to fp32 on a CPU without bf16 (about 10 GB for
d1-Omni-2B), so the bench records each process's peak memory and can
leave a scenario out, and the integration tests release a model before
compiling the next.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011SRNH8ZNUsNWCxzMiAC7J6
The Decision Models page gets the bench table for both models at fp16,
int8 and int4 on a 4-vCPU CPU (latency, disk, peak memory, agreement
with d1's fp32 answers) and the CPU recommendation (int8). The
integration tests allow d1-Omni int4's measured box-edge drift and skip
fp16 on machines under 20 GB, where it runs as fp32.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011SRNH8ZNUsNWCxzMiAC7J6
On the model card ticket, d1-Omni-2B's fp32 team is billing 0.505
against shipping 0.478; int4 answers shipping. The model card check
keeps the exact answer for every other format and for clear answers,
and the docs name the flip.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011SRNH8ZNUsNWCxzMiAC7J6
…ch call

The language model's full-attention layers read d1's set attention through
PagedAttention sequence views (a state view read both ways, a view per
question after the state's shared blocks), its sliding layers one causal
sequence per row: no dense mask or score matrix, exact against the SDPA
graph. The export saves a D1PagedAttention stand-in the engine swaps for
PagedAttentionExtension on load; the cache follows the inference precision.

The pipeline hands back the plugin's intermediate buffers and glibc's free
arenas after each call, and the tokenizer memoises short texts only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011SRNH8ZNUsNWCxzMiAC7J6
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011SRNH8ZNUsNWCxzMiAC7J6
Releasing the plugin's buffers after every call cost a small call about
30 ms: the pipeline now trims glibc's free memory after calls past 512
padded tokens and releases the plugin's buffers past 2048, which keeps
the same steady memory (2.4 GB besides the mapped file on d1-2B int8).

The performance table is re-measured with every export on PagedAttention,
on an AMX machine, with a section on where the memory goes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011SRNH8ZNUsNWCxzMiAC7J6
The language graph takes each token's row and place in it (row_ids,
position_ids) instead of a padding mask: the conv layers' taps stop at a
row's start, as LFM3's seq_idx packing does, RoPE reads each token's
position, and the PagedAttention layouts run over packed offsets. The
pipeline packs a call's rows side by side into passes under the token
budget, and encodes its pictures and videos by patch grid, together.
Exact against the padded SDPA graph on the tiny checkpoints (9e-8).

Exports need redoing: the language graph's inputs changed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011SRNH8ZNUsNWCxzMiAC7J6
Packed passes fill to the budget: 16384 tokens peaked at 8.3 GB against
5.3 GB at 4096 on d1-2B int8, at the same throughput.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011SRNH8ZNUsNWCxzMiAC7J6
Encoding same-size pictures together measured no faster on CPU (1.36 a
second batched against 1.43 one at a time, d1-2B int8): back to one item
an encoder call. The performance table is re-measured on packed passes,
with a column of 64 mixed-length states, where packing runs 1.5 times as
fast as padding and peaks about 2 GB lower.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011SRNH8ZNUsNWCxzMiAC7J6
GPU lays keys out [blocks, kv heads, head dim, block] and values [blocks,
kv heads, block, head dim]; CPU both as values. The pipeline sized both
from the value cache, which only holds on CPU: each now takes its own
compiled shape. The attention and integration tests run on
OPENARC_TEST_DEVICE, and the docs say GPU is untested and how to check it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011SRNH8ZNUsNWCxzMiAC7J6
Python keeps a replaced D1PagedAttention alive, so it stayed a consumer of the
attention inputs. Compiling ignores it, but tools that walk consumers do not:
NNCF's data-aware weight compression refused the graph (duplicate edges).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011SRNH8ZNUsNWCxzMiAC7J6
@SearchSavior SearchSavior added the do-not-review Your work is still in progress, and is not ready for review. label Dec 3, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

do-not-review Your work is still in progress, and is not ready for review.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants