spring-coder-30b-a3b

A code model that is an expert in Spring Boot. It knows Spring Boot 3 and 4, Spring Framework 6 and 7, Spring Security 6, Spring Data JPA, Hibernate, MongoDB, Redis and Spring Cloud. It also knows Keycloak, Okta and Open Policy Agent. It writes modern Java 21 and Spring code. It was trained to write complete, compiling projects that follow one coding guideline (docs/SPRING-GUIDELINES.md in the source repository).

  • Base model: Qwen/Qwen3-Coder-30B-A3B-Instruct
  • Method: LoRA (rank 16, attention projections q/k/v/o), merged into the base weights in bf16
  • Trained with transformers and peft on one NVIDIA 80 GB GPU
  • Data: bharathmuppa/spring-instruct (4613 instruction pairs: 4012 authored records on Spring Boot, Spring Security, Spring Data, Spring Cloud, Hibernate, Keycloak, Okta, Open Policy Agent, version facts and known issues, with 360 compiled project records, and 601 CodeAlpaca Java records in train only, CC-BY-4.0)

The weights are the full merged model in bf16, so this repository is large. The adapter alone is in bharathmuppa/spring-coder-30b-a3b-lora.

Use with transformers

from transformers import AutoModelForCausalLM, AutoTokenizer
m = "bharathmuppa/spring-coder-30b-a3b"
tok = AutoTokenizer.from_pretrained(m)
model = AutoModelForCausalLM.from_pretrained(m, dtype="auto", device_map="auto")
msgs = [{"role": "system", "content": SYSTEM},
        {"role": "user", "content": "Write a SecurityFilterChain bean for Spring Security 6 that protects /api/** with JWT and leaves /actuator/health open."}]
text = tok.apply_chat_template(msgs, add_generation_prompt=True, tokenize=False)
enc = tok(text, return_tensors="pt").to(model.device)
print(tok.decode(model.generate(**enc, max_new_tokens=800)[0][enc["input_ids"].shape[1]:], skip_special_tokens=True))

The model was trained with this system prompt (SYSTEM above). Use it for best results:

You are an expert Spring Boot engineer. You know Spring Boot 3 and 4, Spring Framework 6 and 7, Spring Security 6, Spring Data, Spring Cloud, Hibernate, Keycloak, Okta and Open Policy Agent. Answer with correct, modern, idiomatic Java 21 and Spring code and say which Spring Boot version a feature needs when it matters.

Use with Ollama / llama.cpp (GGUF)

This repo also holds GGUF builds, made on the training pod with llama.cpp: spring-coder-30b-a3b-Q4_K_M.gguf (about 18 GB, needs about 20 GB of memory) and spring-coder-30b-a3b-Q8_0.gguf (about 32 GB), plus a Modelfile with the system prompt and chat template.

ollama run hf.co/bharathmuppa/spring-coder-30b-a3b:Q4_K_M

Or build it locally from the Modelfile:

hf download bharathmuppa/spring-coder-30b-a3b --include "spring-coder-30b-a3b-Q4_K_M.gguf" "Modelfile" --local-dir spring-coder
cd spring-coder && ollama create spring-coder -f Modelfile && ollama run spring-coder

Q8_0 is closest to the bf16 weights; Q4_K_M is fine for scaffolding. On Apple Silicon mlx-lm can also load the bf16 weights directly:

pip install mlx-lm
python -m mlx_lm convert --hf-path bharathmuppa/spring-coder-30b-a3b -q --q-bits 4 --mlx-path spring-coder-4bit
python -m mlx_lm generate --model spring-coder-4bit --prompt "Write a SecurityFilterChain bean that uses JWT."

Training

Setting Value
Records (train / valid / test) 4293 / 200 / 120
Steps done 1074 optimizer steps (2.0 epochs; the loop has a wall-clock limit of 180 minutes)
Final loss train 1.056, eval 1.1449
Batch 1 x 8 gradient accumulation, max 4096 tokens
Learning rate 3e-5, cosine, 50 warm-up steps
LoRA rank 16, alpha 16, dropout 0.05, q/k/v/o
Loss answer tokens only

The run log with every loss line is in the dataset repository bharathmuppa/angular-lm-runs. The dataset builder and the checker that compiles the project records are in the spring-lm repository. The training pipeline is in the GitLab project mahaamatsya/ai/angular-lm.

Limits

The model writes scaffolds well. Logic can still have defects, so review the output and run the compiler and the tests. Version facts after early 2026 come only from the training data.

Releases

Each Spring Boot version is a git tag on the Hub. The tag of this upload is below. It marks the files of that version. Choose the tag in the branch menu, or add revision="<tag>" when you download. The main branch holds the latest release.

This upload has no release tag.

Downloads last month
2
Safetensors
Model size
31B params
Tensor type
BF16
·
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for bharathmuppa/spring-coder-30b-a3b

Adapter
(62)
this model

Dataset used to train bharathmuppa/spring-coder-30b-a3b