Text Generation
Transformers
Safetensors
qwen3_5_text
w4a4
nvfp4
agentic-coding
reasoning
tool-use
on-device
laptop-scale
sft
reinforcement-learning
conversational
modelopt
Instructions to use jsbaicenter/Aztec-Coder-4B-NVFP4 with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use jsbaicenter/Aztec-Coder-4B-NVFP4 with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="jsbaicenter/Aztec-Coder-4B-NVFP4") messages = [ {"role": "user", "content": "Who are you?"}, ] pipe(messages)# Load model directly from transformers import AutoTokenizer, AutoModelForCausalLM tokenizer = AutoTokenizer.from_pretrained("jsbaicenter/Aztec-Coder-4B-NVFP4") model = AutoModelForCausalLM.from_pretrained("jsbaicenter/Aztec-Coder-4B-NVFP4", 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=40) print(tokenizer.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use jsbaicenter/Aztec-Coder-4B-NVFP4 with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "jsbaicenter/Aztec-Coder-4B-NVFP4" # 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/Aztec-Coder-4B-NVFP4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }'Use Docker
docker model run hf.co/jsbaicenter/Aztec-Coder-4B-NVFP4
- SGLang
How to use jsbaicenter/Aztec-Coder-4B-NVFP4 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/Aztec-Coder-4B-NVFP4" \ --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/Aztec-Coder-4B-NVFP4", "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/Aztec-Coder-4B-NVFP4" \ --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/Aztec-Coder-4B-NVFP4", "messages": [ { "role": "user", "content": "What is the capital of France?" } ] }' - Docker Model Runner
How to use jsbaicenter/Aztec-Coder-4B-NVFP4 with Docker Model Runner:
docker model run hf.co/jsbaicenter/Aztec-Coder-4B-NVFP4
|
Download README.md from jsbaicenter/Aztec-Coder-4B-NVFP4: direct link, hf CLI and curl.
- Browser
- Download file 8.19 kB
-
https://huggingface.co/jsbaicenter/Aztec-Coder-4B-NVFP4/resolve/main/README.md
- Command line
-
hf download hf://jsbaicenter/Aztec-Coder-4B-NVFP4/README.md
-
curl -L -o README.md https://huggingface.co/jsbaicenter/Aztec-Coder-4B-NVFP4/resolve/main/README.md
8.19 kB
| license: apache-2.0 | |
| base_model: | |
| - Qwen/Qwen3.5-4B | |
| tags: | |
| - w4a4 | |
| - nvfp4 | |
| - agentic-coding | |
| - reasoning | |
| - tool-use | |
| - on-device | |
| - laptop-scale | |
| - sft | |
| - reinforcement-learning | |
| library_name: transformers | |
| pipeline_tag: text-generation | |
| datasets: | |
| - nvidia/Nemotron-Post-Training-Dataset-v2 | |
| # James Silberrad Brown Center for AI Research | |
| The **James Silberrad Brown Center for Artificial Intelligence (JSBCAI)** is an interdisciplinary research hub at San Diego State University dedicated to advancing artificial intelligence through foundational research, applied innovation, and student-driven inquiry. | |
| # Aztec-Coder-4B-NVFP4 (W4A4) | |
| > ⚠ **PREVIEW RELEASE** — This is a research preview, not recommended for production use. Full evaluations are in progress. Release 1.0 with complete, validated benchmark results is coming. Safety results (HarmBench, XSTest) are measured and reported below. | |
| > | |
| > **Known issue (fixed in the next release):** testing has revealed the model uses `git checkout` / `git restore` / `git stash` to solve tasks, which can lead to **lost uncommitted work** in your repository. Wait for the next release, or make sure to commit your work before running it. | |
| **An agentic coding model that runs on your laptop.** This variant uses **NVFP4 W4A4** quantization: both weights and activations at 4-bit, calibrated on our training distribution. A W4A16 variant (weights-only quantization, higher quality) is in development. | |
| Aztec-Coder-4B is a 4B-parameter model, fine-tuned from Qwen3.5-4B, that investigates bugs, edits files, runs commands, and verifies its own fixes in real software repositories. Agentic coding at this level has required 27B+ models. This one fits on a consumer GPU. | |
| ## Results | |
| We reserved 121 real software bugs that the model never saw during training. Before fine-tuning, it solved 10% of them. After training, it solved **83%**, verified by running each project's hidden test suite. The model learned to fix bugs in general, not just the ones it practiced on. | |
| | Benchmark | Qwen3.5-4B (base) | Aztec-Coder-4B (BF16) | **Aztec-Coder-4B-NVFP4** | | |
| |---|---|---|---| | |
| | **Generalization test** (121 unseen bugs, tests run to verify) | 10.1% | 82.9% | **38.0%*** | | |
| | **Live-60** (60 real-world engineering tasks, solved end-to-end in containers) | 15.0% | 21.7% | **15.0%** | | |
| | **Instruction-following** (IFEval) | 84.66 | 87.21 | **86.37** | | |
| | MMLU-Pro | 64.0% | 70.0% | **66.85%** | | |
| | Terminal-Bench 1.0 (core, 80 tasks) | 33.8% | 33.8% | **18.8%** | | |
| | HarmBench (harmful-behavior refusal rate, 159 standard behaviors) | 99.4% | 98.1% | **96.9%** | | |
| | XSTest (benign-but-scary request compliance, 450 prompts) | 54.0% | 97.1% | **99.8%** | | |
| The instruction-following score *improved* over the base model. The coding gains cost nothing on general quality. Gains of this kind usually trade one for the other. | |
| Safety alignment survived both the RL training and the quantization: the refusal rate on HarmBench's 159 standard harmful behaviors holds at 96.9% (vs 98.1% for the BF16 and 99.4% for the base model), with the serious harm categories clean on all three. On the over-refusal side the quant answers 99.8% of benign-but-scary requests (vs 54.0% for the base model) — the deployment artifact's best safety number. See the BF16 model card for the full safety verification. See the BF16 model card for the full safety verification. | |
| The NVFP4 quantization preserves instruction-following (within ~1 point of BF16) and trades real coding capability: Live-60 drops from 21.7% to 15.0%. The BF16 remains the best model; this variant trades that margin for a 40% smaller footprint and ~5GB VRAM. | |
| *12/32 on a 32-instance subset (the same slice our comparisons use). The quantization costs roughly half the generalization capability of the BF16. | |
| Note: Terminal-Bench 2.1 and future benchmark additions are evaluated on the BF16 release (Aztec-Coder-4B). Safety verification (HarmBench refusal testing) is evaluated on both releases. Community quants are welcome; see the BF16 model card for full benchmark coverage. | |
| Our decontamination protocol is published with the model: none of these benchmark problems overlap the training data. | |
| ## What it does | |
| - **Investigates and fixes bugs in real repositories.** The model explores a codebase, reads the failing code, writes a patch, and runs the tests to check itself, inside a sandboxed container. | |
| - **Thinks before each action.** Like much larger reasoning models, it reasons between tool calls. | |
| - **Runs on consumer hardware.** ~5GB VRAM (the NVFP4 quantized variant). | |
| ## How we trained it | |
| Three stages, each with a plain-language summary: | |
| 1. **Seed demonstrations.** GLM-5.3, a frontier 744B open model, generated roughly 1,875 coding trajectories. We verified every one by running the actual tests before using it. These demonstrations taught our model the *format* of agentic coding: how to use tools, when to run tests, what a working solution looks like. | |
| 2. **Reinforcement learning on real bugs.** The model then practiced on 237 curated software engineering problems: ones it could sometimes solve, but not reliably. For each problem, the model repeatedly attempted a fix. Solutions that made the real hidden tests pass were reinforced; failures were not. This phase, 145 batches of on-policy GRPO, built the actual problem-solving ability. | |
| 3. **Generalization checks.** At every stage boundary, we re-tested the model on problems it had never trained on. The 10.1% to 82.9% jump above is the result. | |
| ### Training data | |
| - **[NVIDIA Nemotron-Post-Training-Dataset-v2](https://huggingface.co/datasets/nvidia/Nemotron-Post-Training-Dataset-v2)**: a portion of its general instruction-following, structured-output, and tool-use data anchored the model's general capabilities. | |
| - **Our distilled seed set**: ~1,875 verified coding trajectories generated by GLM-5.3 (Z.AI), each confirmed by running the real test suite before use. | |
| - **Open SWE datasets**: a blend of open software-engineering problem sets provided the RL practice pool. | |
| - **The RL phase used no static data at all**: the model generated fresh attempts each batch, and only test-verified outcomes became training signal. | |
| ## Usage | |
| ```python | |
| from vllm import LLM | |
| llm = LLM(model="jsbaicenter/Aztec-Coder-4B-NVFP4", quantization="modelopt", max_model_len=131072) | |
| ``` | |
| Recommended sampling: `temperature 1.0, top_p 0.95`. The model uses the Qwen3.5 chat template with interleaved thinking (the `qwen3` reasoning parser in vLLM) and `qwen3_coder` tool-call format. | |
| The full-precision BF16 release and an MTP-boosted speculative decoding head (for faster inference) are available from the same organization. This variant uses NVFP4 **W4A4** quantization (4-bit weights and 4-bit activations, group size 16, calibrated on 512 samples from our training distribution) via [NVIDIA ModelOpt](https://github.com/NVIDIA/Model-Optimizer). A **W4A16** variant (4-bit weights only, higher coding quality) is planned as a separate release. | |
| ## Limitations | |
| - A 4B model has 4B knowledge: obscure facts and extreme-domain reasoning still favor larger models. | |
| - We tuned the agent loop for sandboxed container environments; other deployment contexts are untested. | |
| - Safety behaviors come from the base model; the RL phase optimized test-passing only, with no safety-specific training. See the base model card. | |
| ## Lineage & credits | |
| - **Base model**: [Qwen/Qwen3.5-4B](https://huggingface.co/Qwen/Qwen3.5-4B) (Apache-2.0) | |
| - **Demonstration generator**: GLM-5.3 (Z.AI), served locally | |
| - **General training data**: [nvidia/Nemotron-Post-Training-Dataset-v2](https://huggingface.co/datasets/nvidia/Nemotron-Post-Training-Dataset-v2) | |
| - **Quantization**: [NVIDIA ModelOpt](https://github.com/NVIDIA/Model-Optimizer) (NVFP4) | |
| - **Technical report**: coming soon, covering the full methodology, the ablations, and our negative results on teacher-logprob distillation. | |
| ## License | |
| Apache-2.0, matching the base model. | |
| ## Citation | |
| ```bibtex | |
| @misc{jsbai_coder_4b, | |
| title={Aztec-Coder-4B: Agentic Coding at Laptop Scale via Teacher-Seeded RL}, | |
| author={James Silberrad Brown Center for AI}, | |
| year={2026}, | |
| publisher={HuggingFace} | |
| } | |
| ``` | |