Skip to content

Promote generic GGUF projector cohort - #678

Merged
justinchuby merged 5 commits into
mainfrom
justinchuby-promote-generic-gguf-projectors
Aug 27, 2026
Merged

justinchuby merged 5 commits into
mainfrom
justinchuby-promote-generic-gguf-projectors

Conversation

@justinchuby

Copy link
Copy Markdown
Member

Summary

  • promote the generic llama.cpp adapter, mlp, resampler, ldp, and ldpv2 GGUF projector routes to exact graph import
  • add reusable model-agnostic projector components and a three-model decoder/vision/embedding package with a float32 processor boundary
  • enforce exact metadata, tensor closure, shapes, target architecture, feature-layer selection, and fail-closed unknown-variant behavior
  • preserve processor-owned image sentinels, including negative/out-of-vocabulary IDs, and scope MiniCPM <unk> replacement between <image> boundaries
  • pin immutable sidecar, paired-text, and processor evidence totaling 12,414,806,816 bytes while keeping runtime support truthfully deferred
  • update the generated GGUF census/docs and expose image_token_id through the public API and CLI without changing Hugging Face revision routing

Schema authority

Pinned llama.cpp commit: 8d9af256337d1a501250f9bbf4c0859a654bddd6.

The implementation matches its legacy CLIP penultimate-layer selection, tanh-approximate GELU, LDP HardSigmoid coefficients, GLM-Edge gated SwiGLU/BOI/EOI topology, and MiniCPM learned-query resampler with generated 2D sinusoidal positions.

Validation

  • focused projector/importer/docs/CLI suite: 696 passed
  • broad serial non-integration suite: 8,649 passed, 64 skipped, 12 deselected, 1 subtest passed
  • sparse immutable header closure: all five selected sidecars accepted exactly (377-447 tensors each)
  • repository lintrunner passed
  • new projector model passed mypy
  • independent high-confidence review found no remaining issues

Runtime status

All five routes are graph-supported and runtime-deferred. No paired runtime or generation parity is claimed until the processor/runtime ABI is independently proven.

@justinchuby
justinchuby requested review from a team and a lite review from Copilot August 27, 2026 16:09
@github-actions

github-actions Bot commented Aug 27, 2026 •

Copy link
Copy Markdown

Performance Comparison

Comparing 0c7ac6c → 99ff6a2

Model Metric Baseline Current Delta
bert (feature-extraction) model_size_bytes 359 KB 359 KB +0.0% ⚪
bert (feature-extraction) num_nodes 68 68 +0.0% ⚪
falcon model_size_bytes 364 KB 364 KB +0.0% ⚪
falcon num_nodes 66 66 +0.0% ⚪
gemma2 model_size_bytes 428 KB 428 KB +0.0% ⚪
gemma2 num_nodes 105 105 +0.0% ⚪
gpt2 model_size_bytes 324 KB 324 KB +0.0% ⚪
gpt2 num_nodes 54 54 +0.0% ⚪
llama model_size_bytes 425 KB 425 KB +0.0% ⚪
llama num_nodes 60 60 +0.0% ⚪
llama (static-cache) model_size_bytes 425 KB 425 KB +0.0% ⚪
llama (static-cache) num_nodes 56 56 +0.0% ⚪
mamba (ssm-text-generation) model_size_bytes 296 KB 296 KB +0.0% ⚪
mamba (ssm-text-generation) num_nodes 94 94 +0.0% ⚪
phi3 model_size_bytes 421 KB 421 KB +0.0% ⚪
phi3 num_nodes 58 58 +0.0% ⚪
phi3 (static-cache) model_size_bytes 421 KB 421 KB +0.0% ⚪
phi3 (static-cache) num_nodes 54 54 +0.0% ⚪
qwen2 model_size_bytes 425 KB 425 KB +0.0% ⚪
qwen2 num_nodes 60 60 +0.0% ⚪
qwen2 (static-cache) model_size_bytes 425 KB 425 KB +0.0% ⚪
qwen2 (static-cache) num_nodes 56 56 +0.0% ⚪
qwen3_5_moe (hybrid-text-generation) model_size_bytes 506 KB 506 KB +0.0% ⚪
qwen3_5_moe (hybrid-text-generation) num_nodes 265 265 +0.0% ⚪
qwen3_5_text (hybrid-text-generation) model_size_bytes 458 KB 458 KB +0.0% ⚪
qwen3_5_text (hybrid-text-generation) num_nodes 127 127 +0.0% ⚪
qwen3_5_vl (hybrid-qwen-vl) model_size_bytes 977 KB 977 KB +0.0% ⚪
qwen3_5_vl (hybrid-qwen-vl) num_nodes 450 450 +0.0% ⚪
t5 (seq2seq) model_size_bytes 836 KB 836 KB +0.0% ⚪
t5 (seq2seq) num_nodes 176 176 +0.0% ⚪
whisper (speech-to-text) model_size_bytes 1008 KB 1008 KB +0.0% ⚪
whisper (speech-to-text) num_nodes 128 128 +0.0% ⚪

No performance regressions.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Promotes the “generic” llama.cpp GGUF projector cohort (adapter/mlp/resampler/ldp/ldpv2) from route stubs to exact graph import, including a new reusable three-model (decoder/vision_encoder/embedding) packaging flow with a float32 processor boundary and stricter evidence/pinning/registry enforcement.

Changes:

  • Added model-agnostic projector components plus a GenericGGUFProjectorModel that is built as separate decoder/vision/embedding graphs.
  • Implemented generic mmproj parsing/mapping/shape validation and a new VLM builder route wired through the GGUF builder/arch registry.
  • Exposed image_token_id through the public API + CLI (including negative processor sentinels) and updated docs/census/tests accordingly.

Reviewed changes

Copilot reviewed 25 out of 25 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tests/cli_test.py Adds CLI parsing test for negative --image-token-id sentinel.
src/mobius/tasks/_vision_language_3model.py Introduces GGUFProjectorVisionLanguageTask with single-image FLOAT boundary + rank-2 features output.
src/mobius/tasks/init.py Exports the new GGUF projector VLM task.
src/mobius/models/minicpm.py Extends MiniCPM text model to accept inputs_embeds for decoder-from-embeds packaging.
src/mobius/models/gguf_projector.py Adds generic 3-graph wrapper (decoder/vision/projector/embedding) for GGUF sidecars.
src/mobius/models/gguf_projector_test.py Adds graph-build and embedding correctness tests for the new generic projector package.
src/mobius/models/clip.py Tightens SigLIPVisionModel constructor typing for the config view used by sidecars.
src/mobius/integrations/gguf/_route_census_test.py Updates census counts for reclassified projector routes.
src/mobius/integrations/gguf/_mmproj.py Adds generic vision config extraction + tensor mapping + generic-projector VLM builder + image_token_id plumbing.
src/mobius/integrations/gguf/_mmproj_test.py Adds fail-closed tests for unknown/MLP_NORM variants; updates dispatch tests for image_token_id.
src/mobius/integrations/gguf/_mmproj_registry.py Promotes generic projector specs to graph-supported; adds paired-text pin metadata validation.
src/mobius/integrations/gguf/_mmproj_registry_test.py Extends registry tests to assert generic projector support + evidence pin invariants.
src/mobius/integrations/gguf/_mmproj_mapping.py Adds generic vision/projector-to-ONNX name mapping helpers.
src/mobius/integrations/gguf/_mmproj_mapping_test.py Adds unit tests for the new generic mapping functions.
src/mobius/integrations/gguf/_docs.py Expands projector evidence table (paired text + processor source) and documents image_token_id forwarding.
src/mobius/integrations/gguf/_docs_test.py Adjusts doc size ceiling for updated generated docs.
src/mobius/integrations/gguf/_builder.py Adds image_token_id arg, forwards it to mmproj builds, and fails if used without mmproj.
src/mobius/integrations/gguf/_builder_test.py Validates image_token_id forwarding and that it requires mmproj.
src/mobius/integrations/gguf/_arch_registry.py Declares vlm_builder="generic_projector" for supported text architectures.
src/mobius/integrations/gguf/_arch_registry_test.py Updates expected set of exact paired builders to include the new generic projector pairings.
src/mobius/components/_multimodal.py Adds reusable GGUF projector components (MLP/LDP/LDPv2/adapter/resampler).
src/mobius/components/_multimodal_test.py Adds graph-shape/attribute tests for the new projector components.
src/mobius/components/init.py Exposes new projector components in the public components API.
src/mobius/main.py Adds --image-token-id CLI flag and forwards it to build_from_gguf.
docs/api/build_from_gguf.md Regenerates docs to reflect promoted projector support and new image_token_id parameter.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

github-actions Bot commented Aug 27, 2026 •

Copy link
Copy Markdown

🏗️ Architecture Diff

Comparing 0c7ac6c → 99ff6a2

Model Sub-model Changes Status
bert (feature-extraction) model 0 ⚪
falcon model 0 ⚪
gemma2 model 0 ⚪
gemma4 (gemma4) decoder 0 ⚪
gemma4 (gemma4) embedding 0 ⚪
gemma4 (gemma4) vision_encoder 0 ⚪
gemma4_text model 0 ⚪
gpt2 model 0 ⚪
llama model 0 ⚪
llama (static-cache) model 0 ⚪
mamba (ssm-text-generation) model 0 ⚪
phi3 model 0 ⚪
phi3 (static-cache) model 0 ⚪
qwen model 0 ⚪
qwen (static-cache) model 0 ⚪
qwen2 model 0 ⚪
qwen2 (static-cache) model 0 ⚪
qwen2_moe model 0 ⚪
qwen2_moe (static-cache) model 0 ⚪
qwen3 model 0 ⚪
qwen3 (static-cache) model 0 ⚪
qwen3_5_moe (hybrid-text-generation) model 0 ⚪
qwen3_5_text (hybrid-text-generation) model 0 ⚪
qwen3_5_vl (hybrid-qwen-vl) decoder 0 ⚪
qwen3_5_vl (hybrid-qwen-vl) embedding 0 ⚪
qwen3_5_vl (hybrid-qwen-vl) vision_encoder 0 ⚪
qwen3_moe model 0 ⚪
qwen3_moe (static-cache) model 0 ⚪
qwen3_next (hybrid-text-generation) model 0 ⚪
t5 (seq2seq) decoder 0 ⚪
t5 (seq2seq) encoder 0 ⚪
whisper (speech-to-text) decoder 0 ⚪
whisper (speech-to-text) encoder 0 ⚪

No architecture changes detected. ✅


Legend: ⚪ No change · 🔵 Minor (attrs/inits) · 🟡 Moderate (nodes added/removed) · 🔴 Major (interface changed)

@justinchuby
justinchuby force-pushed the justinchuby-promote-generic-gguf-projectors branch from 685a7e9 to 6c17770 Compare August 27, 2026 18:23
Implement exact graph import for the adapter, MLP, resampler, LDP, and LDPv2 projector schemas pinned to llama.cpp. Add reusable projector components, three-model package routing, exact tensor closure and mapping validation, processor-owned media sentinel handling, and immutable sidecar/text/processor evidence while keeping runtime support deferred.

Expose image-token overrides through the public API and CLI without changing Hugging Face revision routing. Update the generated support census and add graph, ABI, mapping, fail-closed, activation, layer-selection, and embedding runtime regressions.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 7f08e9a7-ccb3-4864-ae69-c3ef8adc53a1
Signed-off-by: Justin Chu <[email protected]>
Apply the repository Ruff formatter to the long initializer assignments reported by the pull request lint check.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 7f08e9a7-ccb3-4864-ae69-c3ef8adc53a1
Signed-off-by: Justin Chu <[email protected]>
Replace publisher-label pairing with exact structural and media-token contracts, restore MiniCPM learned query positions, and defer its fixed-size graph until the variable-image processor ABI is supported. Add independent nonzero-weight projector parity and correct immutable artifact and processor evidence.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 7f08e9a7-ccb3-4864-ae69-c3ef8adc53a1
Signed-off-by: Justin Chu <[email protected]>
Honor explicit single CLIP feature-layer metadata for legacy generic projector routes, including the final serialized block. Enforce exact media-placeholder/image-feature cardinality while retaining a safe padding row only for eager non-media gathers.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 7f08e9a7-ccb3-4864-ae69-c3ef8adc53a1
Signed-off-by: Justin Chu <[email protected]>
Update the generated route census expectations after the merged MoE cohort and retain the resolved companion-path type introduced on main.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 7f08e9a7-ccb3-4864-ae69-c3ef8adc53a1
Signed-off-by: Justin Chu <[email protected]>
@justinchuby
justinchuby force-pushed the justinchuby-promote-generic-gguf-projectors branch from 6c17770 to 99ff6a2 Compare August 27, 2026 19:30
@justinchuby
justinchuby merged commit b0fb5af into main Aug 27, 2026
16 of 25 checks passed
@justinchuby
justinchuby deleted the justinchuby-promote-generic-gguf-projectors branch August 27, 2026 19:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants