File size: 3,949 Bytes
975c43e
 
 
 
 
 
 
de5839f
 
975c43e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
de5839f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
975c43e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8a0f78a
 
975c43e
 
 
8a0f78a
 
975c43e
 
 
 
8a0f78a
 
975c43e
 
 
 
 
 
 
 
 
 
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
---
license: apache-2.0
base_model: Qwen/Qwen2.5-Coder-1.5B-Instruct
language:
  - en
tags:
  - angular
  - gguf
  - ollama
  - typescript
  - frontend
  - code
  - mlx
  - lora
datasets:
  - bharathmuppa/angular-instruct
pipeline_tag: text-generation
library_name: mlx
---

# angular-coder-1.5b

A small 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 new application builder and the `ng update` migrations.

- Base model: `Qwen/Qwen2.5-Coder-1.5B-Instruct`
- Method: LoRA (rank 16, last 16 layers, attention + MLP), fused into the base weights
- Trained with `mlx-lm` on an Apple M2 Max
- Data: `bharathmuppa/angular-instruct` (2030 instruction pairs written from the official Angular docs and changelog)

## Use with mlx-lm (Apple Silicon)

```sh
pip install mlx-lm
python -m mlx_lm generate --model bharathmuppa/angular-coder-1.5b \
  --prompt "Which Angular version introduced @defer and how do I use it?"
```

## Use with Ollama / llama.cpp (GGUF)

This repo also holds GGUF builds: `angular-coder-1.5b-Q4_K_M.gguf` (1.0 GB), `angular-coder-1.5b-Q8_0.gguf` (1.6 GB) and `angular-coder-1.5b-f16.gguf` (3.1 GB), plus a `Modelfile` with the system prompt and chat template.

```sh
ollama run hf.co/bharathmuppa/angular-coder-1.5b:Q8_0
```

Or build it locally from the Modelfile:

```sh
hf download bharathmuppa/angular-coder-1.5b --include "angular-coder-1.5b-Q8_0.gguf" "Modelfile" --local-dir angular-coder
cd angular-coder && sed -i '' 's/Q4_K_M/Q8_0/' Modelfile && ollama create angular-coder -f Modelfile && ollama run angular-coder
```

Q8_0 is recommended for version facts; Q4_K_M is fine for scaffolding. Both were checked against the full model on held-out questions.

## Use with transformers

```python
from transformers import AutoModelForCausalLM, AutoTokenizer
m = "bharathmuppa/angular-coder-1.5b"
tok = AutoTokenizer.from_pretrained(m)
model = AutoModelForCausalLM.from_pretrained(m, torch_dtype="auto", device_map="auto")
msgs = [{"role": "user", "content": "Write a standalone Angular 22 component with a required signal input."}]
ids = tok.apply_chat_template(msgs, add_generation_prompt=True, return_tensors="pt").to(model.device)
print(tok.decode(model.generate(ids, max_new_tokens=500)[0][ids.shape[1]:], skip_special_tokens=True))
```

The model was trained with this system prompt. 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.

## Training

| Setting | Value |
| --- | --- |
| Records (train / valid / test) | 2427 / 131 / 79 |
| Iterations | 1700 |
| Batch size | 4 |
| Max sequence length | 2048 |
| Loss | assistant tokens only |
| Final validation loss | 1.313 (from 2.175) |
| Test loss, assistant tokens (base → tuned) | 2.104 → 1.293 |
| Learning rate | 3e-5, cosine decay, 50 warm-up steps |

## Limits

- Known-issue answers ("I'm on 19.2 and see X") give the right shape, release line and fix description, but the issue and PR numbers are often wrong. Verify them on GitHub. A 1.5B model does not memorize 250 issue numbers from a few exposures.

- Use `repetition_penalty` 1.1 or similar; long import lists can repeat otherwise.

- 1.5B parameters. It is good for Angular questions and small components. It is not a general assistant.
- Knowledge ends at Angular 22 (October 2026).
- Check generated code before you ship it.

## Sources

Training records were written from the Angular documentation
(`angular/angular`, `adev/src/content`, MIT license) and the Angular changelog.