File size: 12,562 Bytes
44b4651 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 145dbdf 2e8ed21 |
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 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 |
---
model_name: Qwen2.5-Coder-14B-Frontend-UI-Architect
base_model: Qwen/Qwen2.5-Coder-14B-Instruct
language:
- en
license: mit
tags:
- code
- text-generation
- gguf
- qwen
- transformers
- react
- typescript
- tailwind
- frontend
- ui
- coding
library_name: transformers
pipeline_tag: text-generation
---
# Qwen2.5-Coder-14B-Frontend-UI-Architect
A finetuned variant of **Qwen2.5-Coder-14B-Instruct**, specialized for **frontend engineering**, with a strong focus on **React + TypeScript** and **Tailwind CSS**.
The goal of this model is **not** to be a frontier / SOTA LLM, but to be a **practical, fast and reliable workhorse** you can run on **consumer hardware** (via GGUF) while getting UI code quality close to what you would normally expect from paid API models — all fully local and with effectively unlimited usage.
---
## Why This Model
Instead of chasing leaderboard scores, this finetune is designed around a few pragmatic goals:
- **Run comfortably on a single consumer GPU or small server** using GGUF quantizations.
- **Behave like a seasoned frontend engineer** for UI-focused tasks.
- **Prioritize latency and iteration speed** for rapid UI/UX prototyping.
- **Produce full, shippable React + TypeScript components**, not just snippets.
- **Integrate naturally with Tailwind CSS (v4-style utilities)** and modern layout patterns.
If you’re building dashboards, internal tools, marketing pages or app shells and want a local model that “just writes solid UI code” at high speed, this is what this finetune is trying to solve.
---
## Model Choice: Why Qwen2.5-Coder and Not Qwen 3.0-Instruct?
I experimented with **Qwen 3.0 Instruct** as a base model and actually **finetuned both** Qwen 3.0 and Qwen2.5-Coder on similar frontend/UI datasets.
In practice:
- During training, **Qwen2.5-Coder** showed **cleaner, more stable behavior** on UI-heavy examples (React + TS + Tailwind).
- On downstream tests (building real pages, dashboards and forms), **Qwen2.5-Coder consistently produced better structured UI code**:
- Fewer hallucinated patterns,
- More realistic component boundaries,
- Better alignment with TypeScript + Tailwind usage.
Even though Qwen 3.0 is the newer family, for this **very specific niche (frontend UI codegen)**, the **coder-oriented 2.5 base** simply gave better practical results after finetuning. That’s why this release is based on **Qwen2.5-Coder-14B-Instruct** instead of Qwen 3.0.
---
## Overview
**Qwen2.5-Coder-14B-Frontend-UI-Architect** is tuned for high-quality code generation across:
- **React** (Vite/CRA/Next-style patterns adapted to vanilla React)
- **TypeScript** (strict-oriented, explicit typing where it adds clarity)
- **Tailwind CSS v4** (atomic-first, utility-driven styling)
- **Component architecture & layout composition**
- **State management** (Zustand, Context API, basic Jotai patterns)
- **UI/UX best practices** (visual hierarchy, spacing, responsiveness, basic accessibility)
It is particularly good at acting as a **UI prototyping companion**: give it a clear description of the page, and it will return a realistic, ready-to-tweak implementation.
---
## What It Does Well
### Frontend / UI Generation
- Full **React + TypeScript** component files, ready to drop into a project.
- **Layouts, dashboards, forms, modals, settings pages**, landing pages.
- Tailwind-style utility usage with attention to **spacing, typography and alignment**.
- Sensible **component decomposition** (breaking larger pages into subcomponents when asked).
- **Responsive behavior** using common breakpoint patterns (e.g. `sm`, `md`, `lg`, `xl`).
### Architecture & Reasoning
- Suggests **file/folder structures** for scalable UI projects.
- Proposes **design system primitives** (buttons, cards, inputs, layout shells, etc.).
- Can refactor an existing UI into **cleaner, more composable components**.
- Offers **naming, props design and variant ideas** for design-system-level components.
### Practical Speed & Local Usage
Running via **GGUF** in tools like LM Studio, it is tuned to be **fast enough for interactive use**:
- Short prompts return full pages in a single generation.
- Great for “**one screen at a time**” workflows.
- Well-suited as a **local UI copilot** for iterative front-end work.
---
## Limitations & Recommended Usage Patterns
This model sits on top of the Qwen2.5 14B architecture and inherits its **context and scaling limitations**. A few practical notes:
### 1. Best for *building* interfaces, not scanning huge codebases
- Works best when you ask it to **create or refactor a single page / screen at a time**.
- It is **not intended as a repo-wide code-understanding model** for massive monorepos.
- For large refactors, feed it **just the relevant components** and a **clear description** of the target state.
### 2. Use a “token system” for multi-page apps
For complex products, a good pattern is:
1. Define a small **token vocabulary** in your docs or prompt, e.g.:
- `[DASHBOARD]` – main analytics view
- `[SETTINGS_ACCOUNT]` – account settings page
- `[SETTINGS_BILLING]` – billing page
- `[ADMIN_USERS]` – user management view
2. When prompting the model, **remind it which token you’re working on** and provide a short spec, for example:
> “Generate the React + TS page for [SETTINGS_BILLING]: …”
3. Keep each generation centered on **one token/page at a time**, and stitch things together in your codebase.
This keeps the context clean and helps the model stay **consistent and focused**, while still supporting high-quality, reusable UIs.
### 3. Refactoring vs. long-context editing
- You *can* paste existing components and ask for **refactors, cleanup, or modernized layout**.
- For very long files, consider:
- Sending only the parts you actually want to change.
- Asking for **stepwise changes** (e.g., first refactor layout, then add accessibility tweaks).
### 4. General model limitations
- Not a frontier model; for very complex multi-step reasoning or huge refactors, **SOTA hosted models will still be stronger**.
- Can occasionally:
- Over-abstract components when you over-emphasize “architecture”.
- Invent imports or hooks if you’re not explicit about your tech stack.
- Works best when the prompt is **concrete about libraries and constraints** (React version, routing, state management, etc.).
If you run into consistent failure patterns, I would genuinely appreciate detailed reports (see **Feedback** below).
---
## Training Details
- **Base model:** `Qwen/Qwen2.5-Coder-14B-Instruct`
- **Finetuning method:** QLoRA (via Unsloth)
- **Trainable parameters:** ~68.8M (≈0.46%)
- **Epochs:** 2
- **Training examples:** 12,805
- **Effective batch size:** 16
- **Hardware:** A100-40GB (Unsloth-accelerated pipeline)
The dataset is heavily biased toward:
- **Full React + TS component files** (not fragments).
- **Tailwind-based layouts**.
- Clear, real-world-style UI specs (dashboards, settings, CRUD, internal tools, etc.).
### Loss Curve (Summary)
This is a simple snapshot of the training loss:
| Step | Loss |
|------|------|
| 20 | 1.24 |
| 100 | 0.35 |
| 500 | 0.29 |
| 1000 | 0.25 |
| Final | **0.26** |
Loss converged smoothly with no visible instability. A small held-out set of UI-oriented instructions showed stable behavior (sensible structure, no collapse). The main focus was **practical behavior** over chasing the lowest possible loss.
---
## Files & Formats
### HuggingFace (safetensors)
Typical HF layout:
- `config.json`
- `tokenizer.json`
- `tokenizer_config.json`
- `vocab.json`
- `merges.txt`
- `model-00001-of-00006.safetensors` … `model-00006-of-00006.safetensors`
- `model.safetensors.index.json`
### GGUF (for llama.cpp, LM Studio, etc.)
Converted via a Qwen2-compatible fork of `convert_hf_to_gguf.py` from `llama.cpp`.
Available variants:
- `qwen2.5-coder-14b-frontend-ui-architect-q4_K_M.gguf`
- `qwen2.5-coder-14b-frontend-ui-architect-q5_K_M.gguf`
- `qwen2.5-coder-14b-frontend-ui-architect-q8_0.gguf`
- `qwen2.5-coder-14b-frontend-ui-architect-f16.gguf`
Pick the quantization that best fits your hardware and latency needs. For most consumer GPUs and recent CPUs, **q4_K_M** is a good starting point.
---
## Usage
### Python (Transformers)
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_name = "codavidgarcia/qwen2.5-coder-14b-frontend-ui-architect"
tokenizer = AutoTokenizer.from_pretrained(model_name)
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype=torch.float16,
device_map="auto"
)
prompt = (
"You are a senior frontend engineer.
"
"Build a clean, production-ready React + TypeScript page using Tailwind CSS.
"
"Requirements:
"
"- Dashboard layout with sidebar and top bar
"
"- Cards for key metrics
"
"- Responsive behavior for mobile and desktop
"
"- Return a full file, no pseudo-code.
"
)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(
**inputs,
max_new_tokens=800,
do_sample=True,
temperature=0.3,
top_p=0.9
)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
```
### LM Studio (GGUF)
1. Download one of the `*.gguf` files.
2. In **LM Studio**: go to **Local Models → Add model** and load the GGUF file.
3. Suggested configuration:
- **Context length:** 8192
- **Temperature:** 0.2–0.4
- **Repetition penalty:** 1.05–1.15
4. Use a focused system / instruction prompt, for example:
```text
You are a senior frontend engineer.
Always:
- Produce full, production-ready React + TypeScript components.
- Use Tailwind CSS utility classes (v4-style).
- Prefer clear layout hierarchy, good spacing and readable typography.
- Avoid pseudo-code. Return concrete code that can be pasted into a project.
```
Then provide your page or component requirements in the user message.
---
## Recommended Prompting Patterns
A few patterns that tend to work well in practice:
### 1. React Page / Screen
```text
You are a senior frontend engineer.
Build a clean, production-ready React + TypeScript page:
- Use Tailwind CSS for all styling.
- Return a single full `.tsx` file.
- Include a default export component.
- No comments, no placeholder lorem ipsum – use realistic labels.
```
### 2. Component Library / Design System Primitives
```text
Act as a frontend architect.
Design a small component system for a product dashboard:
- Button, Card, PageShell, Sidebar, TopBar
- Show props and variants for each component
- Use React + TypeScript + Tailwind
- Suggest a folder structure for these components
```
### 3. Refactor an Existing Component
```text
You are a senior frontend engineer.
Refactor the following React + TypeScript component:
- Improve the layout and spacing using Tailwind.
- Keep the existing behavior.
- Extract repeated pieces into smaller components if it helps readability.
[PASTE COMPONENT HERE]
```
Feel free to adapt these patterns to your own stack and conventions.
---
## Feedback & Improvements
This is a relatively small, targeted finetune, and I’m quite happy with how much UI behavior it managed to internalize given the scale. That said, **I absolutely welcome feedback**.
If you:
- Notice systematic mistakes,
- See opportunities for better architectural defaults,
- Or have specific failure cases (prompt + input + expected vs actual output),
please open an **Issue or Discussion** on the HuggingFace repo. Concrete examples are extremely valuable for future finetuning rounds and for improving the prompt recommendations.
---
## License
- **Base model:** Qwen/Qwen2.5-Coder-14B-Instruct — follows the original Qwen license.
- **Finetuning code, configuration, and additional assets:** released under the **MIT License**.
- **Finetuned weights:** inherit any obligations from the base model’s license. Please refer to Qwen’s official license terms for usage in commercial or sensitive contexts.
Attribution to the original finetune author (`codavidgarcia`) is appreciated but not strictly required beyond what the underlying licenses demand.
---
## Contact
For questions, feedback, or suggestions:
- Open an **Issue** or **Discussion** on the HuggingFace model page.
If you end up using this model in your own tools, dashboards, or UI builders, I’d genuinely love to hear how it performs for you and what could be improved in the next iteration.
|