File size: 4,373 Bytes
4d15e13
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
---
license: apache-2.0
base_model: Qwen/Qwen3-Coder-30B-A3B-Instruct
language:
  - en
tags:
  - angular
  - gguf
  - ollama
  - typescript
  - frontend
  - code
  - lora
  - peft
datasets:
  - bharathmuppa/angular-instruct
pipeline_tag: text-generation
library_name: transformers
---

# angular-coder-30b-a3b

A code model that is an expert in Angular. It knows each Angular version from
v14 to v22. It writes modern Angular: standalone components, signals,
`inject()`, `@if` / `@for`, `@defer`, zoneless change detection, Signal Forms,
the `@Service` decorator, the application builder and the `ng update` migrations.
It was trained to write complete, compiling projects that follow one coding
guideline (`docs/ANGULAR-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 A100 80GB
- Data: `bharathmuppa/angular-instruct` (3461 instruction pairs: Angular docs, version facts,
  known issues, Material, CDK, NgRx, angular-eslint, the CLI, and 400 compiled and
  lint-checked project records)

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

## Use with transformers

```python
from transformers import AutoModelForCausalLM, AutoTokenizer
m = "bharathmuppa/angular-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 standalone Angular 22 component with a required signal input."}]
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 Angular engineer. You know every Angular version from v12 to the current release: NgModules, standalone components, signals, the new control flow, inject(), deferrable views, zoneless change detection, SSR, the CLI and migrations. Answer with correct, modern, idiomatic TypeScript and say which Angular 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:
`angular-coder-30b-a3b-Q4_K_M.gguf` (about 18 GB, needs about 20 GB of memory) and
`angular-coder-30b-a3b-Q8_0.gguf` (about 32 GB), plus a `Modelfile` with the system prompt and
chat template.

```sh
ollama run hf.co/bharathmuppa/angular-coder-30b-a3b:Q4_K_M
```

Or build it locally from the Modelfile:

```sh
hf download bharathmuppa/angular-coder-30b-a3b --include "angular-coder-30b-a3b-Q4_K_M.gguf" "Modelfile" --local-dir angular-coder
cd angular-coder && ollama create angular-coder -f Modelfile && ollama run angular-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:

```sh
pip install mlx-lm
python -m mlx_lm convert --hf-path bharathmuppa/angular-coder-30b-a3b -q --q-bits 4 --mlx-path angular-coder-4bit
python -m mlx_lm generate --model angular-coder-4bit --prompt "What is new in Angular 22?"
```

## Training

| Setting | Value |
| --- | --- |
| Records (train / valid / test) | 3182 / 172 / 103 |
| Steps done | 796 optimizer steps (2.0 epochs; the loop has a wall-clock limit of 170 minutes) |
| Final loss | train 1.1279, eval 1.1662 |
| 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 source, the dataset builder, the checker that
compiles and lints the project records, and the evaluation script are 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 linter. Version facts after early 2026 come
only from the training data.