Text Generation
Transformers
Safetensors
qwen3_5_text
agentic-coding
reasoning
tool-use
on-device
laptop-scale
sft
reinforcement-learning
conversational
Instructions to use jsbaicenter/JSBAI-Coder-4B with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use jsbaicenter/JSBAI-Coder-4B with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="jsbaicenter/JSBAI-Coder-4B") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("jsbaicenter/JSBAI-Coder-4B") model = AutoModelForCausalLM.from_pretrained("jsbaicenter/JSBAI-Coder-4B", device_map="auto") 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=256) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use jsbaicenter/JSBAI-Coder-4B with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "jsbaicenter/JSBAI-Coder-4B" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "jsbaicenter/JSBAI-Coder-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/jsbaicenter/JSBAI-Coder-4B
- SGLang
How to use jsbaicenter/JSBAI-Coder-4B 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 "jsbaicenter/JSBAI-Coder-4B" \ --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": "jsbaicenter/JSBAI-Coder-4B", "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 "jsbaicenter/JSBAI-Coder-4B" \ --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": "jsbaicenter/JSBAI-Coder-4B", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use jsbaicenter/JSBAI-Coder-4B with Docker Model Runner:
docker model run hf.co/jsbaicenter/JSBAI-Coder-4B
Upload README.md with huggingface_hub
Browse files
README.md
CHANGED
|
@@ -2,4 +2,88 @@
|
|
| 2 |
license: apache-2.0
|
| 3 |
base_model:
|
| 4 |
- Qwen/Qwen3.5-4B
|
| 5 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2 |
license: apache-2.0
|
| 3 |
base_model:
|
| 4 |
- Qwen/Qwen3.5-4B
|
| 5 |
+
tags:
|
| 6 |
+
- agentic-coding
|
| 7 |
+
- reasoning
|
| 8 |
+
- tool-use
|
| 9 |
+
- on-device
|
| 10 |
+
- laptop-scale
|
| 11 |
+
- sft
|
| 12 |
+
- reinforcement-learning
|
| 13 |
+
library_name: transformers
|
| 14 |
+
pipeline_tag: text-generation
|
| 15 |
+
---
|
| 16 |
+
|
| 17 |
+
# JSBAI-Coder-4B
|
| 18 |
+
|
| 19 |
+
**An agentic coding model that runs on your laptop.** JSBAI-Coder-4B is a 4B-parameter model fine-tuned from Qwen3.5-4B for multi-step, tool-using software engineering β the capability class currently gated to 27B+ models β at a size that fits consumer GPUs.
|
| 20 |
+
|
| 21 |
+
Built by the [James Silberrad Brown Center for AI](https://sdsu.edu) (SDSU).
|
| 22 |
+
|
| 23 |
+
## Results
|
| 24 |
+
|
| 25 |
+
| Benchmark | Qwen3.5-4B (base) | **JSBAI-Coder-4B** | Ξ |
|
| 26 |
+
|---|---|---|---|
|
| 27 |
+
| **Live-60** (real-world SWE, t32) | 15.0% | **21.7%** | **+44% relative** |
|
| 28 |
+
| **IFEval** (excl-empty, 8K) | 84.66 | **87.21** | +2.55 |
|
| 29 |
+
| **Held-out SWE** (unseen instances, K=8) | 10.1% | **82.9%** | **+72.8pp** |
|
| 30 |
+
| MMLU-Pro (generative) | TBD | TBD | β |
|
| 31 |
+
| Terminal-Bench 2.1 | TBD | TBD | β |
|
| 32 |
+
|
| 33 |
+
*Held-out SWE: 121 never-trained coding instances solved with verified test execution β the gains are broad-spectrum generalization, not benchmark memorization. Our decontamination protocol is published with the model.*
|
| 34 |
+
|
| 35 |
+
## What it does
|
| 36 |
+
|
| 37 |
+
- **Agentic software engineering**: multi-turn bug investigation, tool orchestration (bash, file editing, test running), patch generation and verification β in real repositories, inside sandboxed containers
|
| 38 |
+
- **Interleaved reasoning**: thinks before each tool call, like much larger reasoning models
|
| 39 |
+
- **Quality held**: instruction-following *improved* over base (87.21 vs 84.66 IFEval) β the agentic gains cost nothing on general quality
|
| 40 |
+
- **Laptop-scale**: ~8GB VRAM BF16 / ~5GB NVFP4
|
| 41 |
+
|
| 42 |
+
## Training methodology
|
| 43 |
+
|
| 44 |
+
**Teacher-seeded agentic RL.** The model was produced in three stages:
|
| 45 |
+
|
| 46 |
+
1. **Seed SFT**: a small curated set (~1,875 verified trajectories) from GLM-5.3 (a 744B-A40B open model) bootstrap the student into the agentic tool-use distribution
|
| 47 |
+
2. **GRPO with verifiable rewards**: 145 batches of on-policy RL on a difficulty-banded pool of real SWE tasks (237 unique instances), where the reward is *actual test execution* β the model's patch must make the hidden tests pass
|
| 48 |
+
3. **Generalization gates**: held-out never-trained instances verified the transfer at every phase boundary (10.1% β 82.9% pass rate)
|
| 49 |
+
|
| 50 |
+
The RL phase is the capability engine: the seed SFT contributes the behavioral format, the verification-driven RL builds the problem-solving. We extensively studied on-policy distillation from the teacher (logprob-scoring) and found the signal prefers stylistic imitation over correctness at every model family and tier we tested β those negative results and the mechanism are documented in our technical report.
|
| 51 |
+
|
| 52 |
+
## Usage
|
| 53 |
+
|
| 54 |
+
```python
|
| 55 |
+
from vllm import LLM
|
| 56 |
+
llm = LLM(model="jsbaicenter/JSBAI-Coder-4B", max_model_len=131072)
|
| 57 |
+
```
|
| 58 |
+
|
| 59 |
+
Recommended sampling: `temperature 1.0, top_p 0.95`. The model uses the Qwen3.5 chat template with interleaved thinking (the `nemotron_v3`/`qwen3` reasoning parser in vLLM) and `qwen3_coder` tool-call format.
|
| 60 |
+
|
| 61 |
+
A quantized NVFP4 variant (~5GB) and an MTP-boosted speculative decoding head (for faster inference) are available from the same organization.
|
| 62 |
+
|
| 63 |
+
## Limitations
|
| 64 |
+
|
| 65 |
+
- 4B-scale knowledge limits: obscure factual recall and extreme-domain reasoning remain behind larger models
|
| 66 |
+
- The agent loop is tuned for sandboxed container environments; other deployment contexts are untested
|
| 67 |
+
- Safety behaviors inherited from the base model; the RL phase was reward-verification only (no safety-specific training) β see the base model card
|
| 68 |
+
|
| 69 |
+
## Lineage & credits
|
| 70 |
+
|
| 71 |
+
- **Base model**: [Qwen/Qwen3.5-4B](https://huggingface.co/Qwen/Qwen3.5-4B) (Apache-2.0)
|
| 72 |
+
- **Distillation teacher (seed data)**: GLM-5.3 (Z.AI), served locally; training data generated and verified by us
|
| 73 |
+
- **Quantization**: NVIDIA ModelOpt (NVFP4)
|
| 74 |
+
- **Technical report**: coming soon (the arXiv submission covers the full methodology, the ablations, and the negative results)
|
| 75 |
+
|
| 76 |
+
## License
|
| 77 |
+
|
| 78 |
+
Apache-2.0 (matching the base model).
|
| 79 |
+
|
| 80 |
+
## Citation
|
| 81 |
+
|
| 82 |
+
```bibtex
|
| 83 |
+
@misc{jsbai_coder_4b,
|
| 84 |
+
title={JSBAI-Coder-4B: Agentic Coding at Laptop Scale via Teacher-Seeded RL},
|
| 85 |
+
author={James Silberrad Brown Center for AI},
|
| 86 |
+
year={2026},
|
| 87 |
+
publisher={HuggingFace}
|
| 88 |
+
}
|
| 89 |
+
```
|