Instructions to use TIGER-Lab/VisCoder-3B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use TIGER-Lab/VisCoder-3B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="TIGER-Lab/VisCoder-3B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("TIGER-Lab/VisCoder-3B") model = AutoModelForCausalLM.from_pretrained("TIGER-Lab/VisCoder-3B") messages = [ {"role": "user", "content": "Who are you?"}, ] 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
- vLLM
How to use TIGER-Lab/VisCoder-3B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "TIGER-Lab/VisCoder-3B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "TIGER-Lab/VisCoder-3B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/TIGER-Lab/VisCoder-3B
- SGLang
How to use TIGER-Lab/VisCoder-3B 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 "TIGER-Lab/VisCoder-3B" \ --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": "TIGER-Lab/VisCoder-3B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'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 "TIGER-Lab/VisCoder-3B" \ --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": "TIGER-Lab/VisCoder-3B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use TIGER-Lab/VisCoder-3B with Docker Model Runner:
docker model run hf.co/TIGER-Lab/VisCoder-3B
VisCoder-3B
🏠 Project Page | 📖 Paper | 💻 GitHub | 🤗 VisCode-200K | 🤗 VisCoder-7B
VisCoder-3B is a lightweight language model fine-tuned for Python visualization code generation and iterative correction. It is trained on VisCode-200K, a large-scale instruction-tuning dataset that integrates natural language instructions, validated Python code, and execution-guided revision supervision.
🧠 Model Description
VisCoder-3B is trained on VisCode-200K, a large-scale instruction-tuning dataset tailored for executable Python visualization tasks. It addresses a core challenge in data analysis: generating Python code that not only executes successfully but also produces semantically meaningful plots by aligning natural language instructions, data structures, and visual outputs.
We propose a self-debug evaluation protocol that simulates real-world developer workflows. In this setting, models are allowed to revise previously failed generations over multiple rounds with guidance from execution feedback.
📊 Main Results on PandasPlotBench
We evaluate VisCoder-3B on PandasPlotBench, which tests executable visualization code generation across Matplotlib, Seaborn, and Plotly. Evaluation includes both standard generation and multi-turn self-debugging
VisCoder-3B outperforms existing open-source baselines on multiple libraries and shows consistent recovery improvements under the self-debug protocol.
📁 Training Details
- Base model: Qwen2.5-Coder-3B-Instruct
- Framework: ms-swift
- Tuning method: Full-parameter supervised fine-tuning (SFT)
- Dataset: VisCode-200K, which includes:
- 150K+ validated Python visualization samples with corresponding images
- 45K+ multi-turn correction dialogues guided by execution results
📖 Citation
If you use VisCoder-3B or VisCode-200K in your research, please cite:
@article{ni2025viscoder,
title={VisCoder: Fine-Tuning LLMs for Executable Python Visualization Code Generation},
author={Ni, Yuansheng and Nie, Ping and Zou, Kai and Yue, Xiang and Chen, Wenhu},
journal={arXiv preprint arXiv:2506.03930},
year={2025}
}
For evaluation scripts and more information, see our GitHub repository.
- Downloads last month
- 14

docker model run hf.co/TIGER-Lab/VisCoder-3B