LLaVA-Qwen-0.5B VLM (bam_umoe) — Multimodal Attention Surgery Zoo
This repository provides a multimodal Vision-Language Model (VLM) derived from llava-hf/llava-interleave-qwen-0.5b-hf (SigLIP vision encoder + MLP projector + 24-layer Qwen2 decoder, D=1024, H=16) where 18 / 24 decoder attention blocks (hybrid_3_1) have been replaced with bam_umoe (BAMUMoEBlock) and distilled on image-bearing questions from derek-thomas/ScienceQA.
Architecture & Operator Profile
BAMUMoEBlock: BAMUMoEBlock neural operator. BAM-UMoE: Unified Mixture of Experts Attention Block (Activation-Aware).
| Property | Specification |
|---|---|
Registry Key (ATTENTION_REGISTRY) | bam_umoe |
| NeuralOps Class & Family | BAMUMoEBlock (sparse) |
| Source Implementation | neuralops/layers/sparse/bam_umoe.py |
| Vision Tower (Frozen) | SigLIP Vision Encoder + 2-layer Multimodal MLP Projector |
| Language Decoder Geometry | 24 layers, D=1024, H=16, d_h=64 (exact power-of-2 widths) |
Multimodal Architecture & Frozen Vision Contract
In LlavaForConditionalGeneration, visual patch tokens extracted by the frozen SigLIP vision tower are interleaved with text tokens inside language_model.model.layers. Keeping vision_tower and multi_modal_projector completely frozen isolates how well subquadratic mechanism bam_umoe handles dense visual-to-text cross-modal routing under hybrid_3_1 surgery (18 transplanted layers + 6 quadratic anchor layers [3, 7, 11, 15, 19, 23]).
Multimodal Benchmark Results (derek-thomas/ScienceQA)
| Metric | Teacher Baseline (llava-interleave-qwen-0.5b) | Pre-KD Zero-Shot (bam_umoe) | Post-KD Distilled (bam_umoe) | Delta ($\Delta$) |
|---|---|---|---|---|
| ScienceQA Visual Accuracy (%) | 63.75% | 31.25% | 31.25% | +0.00% |
| Image-Conditioned Answer PPL | 2.45 | 5.62 | 3.02 | -2.6 |
Telemetry
- Optimization Steps:
238(Stage 1: 92|Stage 2: 146) - Duration & Peak VRAM:
120.3s|17280 MBon NVIDIA RTX 3090 24GB - Timestamp (UTC):
2026-11-11T05:03:29.279973Z
Packaged Artifacts
attention_weights.safetensors(378.19 MB): Transplanted decoder attention & layernorm parameters (FP16; loads directly onto frozen basellava-hf/llava-interleave-qwen-0.5b-hf)processor&tokenizerconfigs +training_metrics.json
Quick Start (Attention-Only Weights)
import torch
from huggingface_hub import hf_hub_download
from safetensors.torch import load_file
from transformers import AutoProcessor, LlavaForConditionalGeneration
from scripts.benchmarks.qwen_zoo_train_mix import apply_qwen_attention_surgery
repo_id = "tahamajs/llava-qwen-0.5b-bam-umoe-scienceqa"
processor = AutoProcessor.from_pretrained(repo_id)
model = LlavaForConditionalGeneration.from_pretrained("llava-hf/llava-interleave-qwen-0.5b-hf", torch_dtype=torch.float16)
model.language_model = apply_qwen_attention_surgery(model.language_model, attn_key="bam_umoe", pattern="hybrid_3_1")
ckpt_path = hf_hub_download(repo_id=repo_id, filename="attention_weights.safetensors")
model.load_state_dict(load_file(ckpt_path), strict=False)
model.eval()
Quick Start (Universal NeuralOps Hub API)
import torch
from neuralops.hub import load_surgeried_model
# Load model and tokenizer/processor in one line directly from Hugging Face Hub
model, tokenizer = load_surgeried_model("tahamajs/llava-qwen-0.5b-bam-umoe-scienceqa")
model.eval()
print(f"Successfully loaded tahamajs/llava-qwen-0.5b-bam-umoe-scienceqa with NeuralOps modular surgical weights!")
Citation
@software{neuralops2026vlmzoo,
title = {NeuralOps: Multimodal Vision-Language Subquadratic Attention Surgery Zoo (LLaVA-ScienceQA)},
author = {Majlesi, Taha},
year = {2026},
url = {https://github.com/tahamajs/NeuralOps},
note = {Hub Repository: tahamajs/llava-qwen-0.5b-bam-umoe-scienceqa}
}