Instructions to use codefuse-ai/CLI-7B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use codefuse-ai/CLI-7B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="codefuse-ai/CLI-7B") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("codefuse-ai/CLI-7B") model = AutoModelForCausalLM.from_pretrained("codefuse-ai/CLI-7B") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = tokenizer.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use codefuse-ai/CLI-7B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "codefuse-ai/CLI-7B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "codefuse-ai/CLI-7B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/codefuse-ai/CLI-7B
- SGLang
How to use codefuse-ai/CLI-7B with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "codefuse-ai/CLI-7B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "codefuse-ai/CLI-7B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "codefuse-ai/CLI-7B" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "codefuse-ai/CLI-7B", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Docker Model Runner
How to use codefuse-ai/CLI-7B with Docker Model Runner:
docker model run hf.co/codefuse-ai/CLI-7B
# Load model directly
from transformers import AutoTokenizer, AutoModelForCausalLM
tokenizer = AutoTokenizer.from_pretrained("codefuse-ai/CLI-7B")
model = AutoModelForCausalLM.from_pretrained("codefuse-ai/CLI-7B")
messages = [
{
"role": "user",
"content": [
{"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"},
{"type": "text", "text": "What animal is on the candy?"}
]
},
]
inputs = tokenizer.apply_chat_template(
messages,
add_generation_prompt=True,
tokenize=True,
return_dict=True,
return_tensors="pt",
).to(model.device)
outputs = model.generate(**inputs, max_new_tokens=40)
print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:]))CLI-7B: Cross-Layer Injection for Deep Vision-Language Fusion
Official model checkpoint of "From One-to-One to Many-to-Many: Dynamic Cross-Layer Injection for Deep Vision-Language Fusion" (ECCV 2026).
CLI-7B is the 7B-parameter variant of our Cross-Layer Injection (CLI) framework, built on top of LLaVA-OneVision-Qwen2-7B (Qwen2-7B LLM + SigLIP-so400m-patch14-384 vision encoder). It replaces the conventional one-to-one visionโlanguage bridge with a dynamic many-to-many connection, allowing every designated LLM decoder layer to query the full visual hierarchy on demand.
Abstract. Vision-Language Models (VLMs) create a severe visual feature bottleneck by using a crude, asymmetric connection that links only the output of the vision encoder to the input of the large language model (LLM). This static architecture fundamentally limits the ability of LLMs to achieve comprehensive alignment with hierarchical visual knowledge, compromising their capacity to accurately integrate local details with global semantics into coherent reasoning. To resolve this, we introduce Cross-Layer Injection (CLI), a novel framework that forges a dynamic "many-to-many" bridge between the two modalities. CLI consists of two synergistic, parameter-efficient components: an Adaptive Multi-Projection (AMP) module that harmonizes features from diverse vision layers, and an Adaptive Gating Fusion (AGF) mechanism that empowers the LLM to selectively inject the most relevant visual information based on its real-time decoding context. We validate the effectiveness and versatility of CLI by integrating it into LLaVA-OneVision and LLaVA-1.5. Extensive experiments on 28 diverse benchmarks demonstrate significant performance improvements, establishing CLI as a scalable paradigm that unlocks deeper multimodal understanding by granting LLMs on-demand access to the full visual hierarchy. Code is available at https://github.com/codefuse-ai/CLI.
Key Features
- Many-to-Many Fusion โ CLI replaces the conventional one-to-one visionโlanguage bridge with a dynamic many-to-many architecture; each LLM decoder layer can query the full visual hierarchy on demand.
- Adaptive Multi-Projection (AMP) โ Parameter-efficient LoRA-based projectors that harmonize features from diverse vision encoder layers into a shared semantic space.
- Adaptive Gating Fusion (AGF) โ A query-based attention gate that dynamically selects and injects the most relevant visual information based on the LLM's real-time decoding context.
- Architecture-Agnostic โ Validated on both LLaVA-OneVision (0.5B/7B) and LLaVA-1.5-7B. This checkpoint is the 7B variant.
- Minimal Overhead โ Only ~1.3% inference memory increase with marginal latency impact.
Model Details
| Base VLM | LLaVA-OneVision-Qwen2-7B (mid-stage) |
| LLM | Qwen2-7B (28 decoder layers) |
| Vision Encoder | SigLIP-so400m-patch14-384 (28 layers) |
| Projector | mlp2x_gelu |
| LLM injection layers | RANGE-1-28-4 โ layers 1, 5, 9, 13, 17, 21, 25 |
| Vision extraction layers | RANGE-1-28-4 โ layers 1, 5, 9, 13, 17, 21, 25 |
| Image resolution | anyres_max_9 (spatial unpad, up to 6ร6 grid) |
| Model max length | 32768 |
| Precision | bf16 |
| License | Apache 2.0 |
This model card is a model checkpoint hosted here for convenience. To actually load and run CLI-7B you need the custom model implementation (AMP + AGF) shipped with the codefuse-ai/CLI codebase โ a plain transformers LlavaOneVision load will not reproduce CLI behavior.
How to Use
CLI requires the custom architecture from the codefuse-ai/CLI repository. The layer configuration passed at load time must match the training configuration above.
1. Install
git clone https://github.com/codefuse-ai/CLI.git
cd CLI
conda create -n cli python=3.10 -y
conda activate cli
pip install -e ".[train]"
pip install flash-attn --no-build-isolation
2. Download this checkpoint
# Option A: huggingface-cli
huggingface-cli download codefuse-ai/CLI-7B --local-dir ./checkpoints/CLI-7B
# Option B: git-lfs
git clone https://huggingface.co/codefuse-ai/CLI-7B ./checkpoints/CLI-7B
3. Inference
The way to run CLI-7B is through the repo's evaluation/inference entry point, which instantiates the AMP + AGF modules and wires the cross-layer connections using the RANGE-1-28-4 / RANGE-1-28-4 configuration:
python run_eval_cli.py \
--model_path ./checkpoints/CLI-7B \
--eval_tasks mme,mmmu,ai2d \
--vlm_exp_layers RANGE-1-28-4 \
--vision_exp_layers RANGE-1-28-4 \
--num_gpus 1
โ ๏ธ Important: The
--vlm_exp_layers RANGE-1-28-4and--vision_exp_layers RANGE-1-28-4flags are mandatory โ they rebuild the CLI architecture (which LLM layers receive injections, which vision layers are extracted). Loading with the default one-to-one projector path or withtransformers.LlavaOnevisionForConditionalGenerationwill not reproduce CLI.
For single-turn visual chat / custom inference, use the LLaVA-OneVision conversation template (qwen_1_5 prompt version) with anyres_max_9 image preprocessing. See run_eval_cli.py and llava/eval/ in the repo for reference implementations.
Evaluation
We evaluate on 28 benchmarks across three categories using the LMMs-Eval framework:
- Chart / Diagram / Document:
ai2d,chartqa,docvqa_val/test,infovqa_val/test - Perception & Reasoning:
mme,mmbench_en_dev,mmvet,mmmu,mmstar,mathvista_testmini,mathverse_*,gqa,ok_vqa,scienceqa_img,seedbench,pope - Real-world & Visual Chat:
realworldqa,llava_in_the_wild
Run all benchmarks in one command:
python run_eval_cli.py \
--model_path ./checkpoints/CLI-7B \
--eval_tasks ai2d,chartqa,docvqa_val,docvqa_test,infovqa_val,infovqa_test,mme,mmbench_en_dev,mmvet,mmmu,mmstar,mathvista_testmini,gqa,ok_vqa,scienceqa_img,seedbench,pope,realworldqa,llava_in_the_wild \
--vlm_exp_layers RANGE-1-28-4 \
--vision_exp_layers RANGE-1-28-4 \
--num_gpus 1
Citation
If you find this work useful, please cite:
@inproceedings{chen2026cli,
title={From One-to-One to Many-to-Many: Dynamic Cross-Layer Injection for Deep Vision-Language Fusion},
author={Chen, Cheng and Guo, Yuyu and Zeng, Pengpeng and Song, Jingkuan and Di, Peng and Yu, Hang and Gao, Lianli},
booktitle={European Conference on Computer Vision (ECCV)},
year={2026}
}
Acknowledgements
This checkpoint is built upon LLaVA-OneVision-Qwen2-7B, SigLIP, and the LLaVA-NeXT framework, and is evaluated with LMMs-Eval.
License
Released under the Apache 2.0 License.
- Downloads last month
- 26
Model tree for codefuse-ai/CLI-7B
Base model
google/siglip-so400m-patch14-384
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="codefuse-ai/CLI-7B") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)