Text Generation
Transformers
Safetensors
English
quartz_moe
Mixture of Experts
mixture-of-experts
from-scratch
instruction-tuned
custom_code
Instructions to use VertexAGI/quartz-micro-preview with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use VertexAGI/quartz-micro-preview with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("text-generation", model="VertexAGI/quartz-micro-preview", trust_remote_code=True)# pip install -U transformers accelerate # Load model directly from transformers import AutoModelForCausalLM model = AutoModelForCausalLM.from_pretrained("VertexAGI/quartz-micro-preview", trust_remote_code=True, device_map="auto") - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use VertexAGI/quartz-micro-preview with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "VertexAGI/quartz-micro-preview" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "VertexAGI/quartz-micro-preview", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'Use Docker
docker model run hf.co/VertexAGI/quartz-micro-preview
- SGLang
How to use VertexAGI/quartz-micro-preview 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 "VertexAGI/quartz-micro-preview" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "VertexAGI/quartz-micro-preview", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }'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 "VertexAGI/quartz-micro-preview" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "VertexAGI/quartz-micro-preview", "prompt": "Once upon a time,", "max_tokens": 512, "temperature": 0.5 }' - Docker Model Runner
How to use VertexAGI/quartz-micro-preview with Docker Model Runner:
docker model run hf.co/VertexAGI/quartz-micro-preview
Upload README.md with huggingface_hub
Browse files
README.md
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
library_name: transformers
|
| 4 |
+
language:
|
| 5 |
+
- en
|
| 6 |
+
pipeline_tag: text-generation
|
| 7 |
+
tags:
|
| 8 |
+
- moe
|
| 9 |
+
- mixture-of-experts
|
| 10 |
+
- from-scratch
|
| 11 |
+
- instruction-tuned
|
| 12 |
+
- custom_code
|
| 13 |
+
vertex_family: quartz
|
| 14 |
+
vertex_name: Quartz Micro Preview
|
| 15 |
+
vertex_base: VertexAGI/quartz-micro-preview-base
|
| 16 |
+
vertex_params: 1.03B
|
| 17 |
+
vertex_purpose: Full-parameter instruction tuning of the from-scratch pretrain
|
| 18 |
+
vertex_result: "Full-parameter SFT on databricks-dolly-15k, 1,317 steps. Modest, mixed improvement over the base checkpoint: clearly better at grounded/context QA, still weak at strict format- and length-following."
|
| 19 |
+
vertex_status: released
|
| 20 |
+
---
|
| 21 |
+
|
| 22 |
+
# Quartz Micro Preview
|
| 23 |
+
|
| 24 |
+
The instruction-tuned release of [Quartz Micro Preview
|
| 25 |
+
Base](https://huggingface.co/VertexAGI/quartz-micro-preview-base) β the
|
| 26 |
+
same ~1B-parameter mixture-of-experts model, trained completely from
|
| 27 |
+
scratch on a single consumer GPU, now given a full-parameter supervised
|
| 28 |
+
fine-tune so it follows instructions instead of just completing text.
|
| 29 |
+
|
| 30 |
+
This is a **preview**, not a finished product. It is small on every axis
|
| 31 |
+
by design, and its evaluation below is reported honestly, including where
|
| 32 |
+
it still falls short β that's this project's standing practice, not a
|
| 33 |
+
disclaimer added after the fact.
|
| 34 |
+
|
| 35 |
+
## What changed vs. the base checkpoint
|
| 36 |
+
|
| 37 |
+
- **Full-parameter SFT**, not LoRA β the base model has zero
|
| 38 |
+
instruction-following behavior, so a light adapter touch isn't the
|
| 39 |
+
right tool; every parameter was updated.
|
| 40 |
+
- **Dataset:** [databricks-dolly-15k](https://huggingface.co/datasets/databricks/databricks-dolly-15k),
|
| 41 |
+
human-written (not distilled from another company's model), formatted as
|
| 42 |
+
`### Instruction:\n...\n\n### Response:\n` (with an added `### Context:\n`
|
| 43 |
+
block for context-grounded examples), tokenized with the pretrain's own
|
| 44 |
+
custom 32K byte-level BPE tokenizer. 14,051 of 15,011 examples kept after
|
| 45 |
+
filtering to the model's 2,048-token context.
|
| 46 |
+
- Only the response tokens are supervised (prompt tokens masked to
|
| 47 |
+
`label=-100`); optimizer is 8-bit AdamW (bitsandbytes) with full gradient
|
| 48 |
+
checkpointing, matching the pretrain's own training stack.
|
| 49 |
+
- This is the **second** SFT attempt (v2): the first pass underperformed,
|
| 50 |
+
so this run used a higher learning rate and a fresh optimizer state
|
| 51 |
+
rather than continuing from the first run's optimizer. It completed
|
| 52 |
+
1,317 steps on a single GTX 1660 Ti (6GB VRAM).
|
| 53 |
+
|
| 54 |
+
## Architecture
|
| 55 |
+
|
| 56 |
+
Unchanged from the base checkpoint β DeepSeek-style fine-grained
|
| 57 |
+
mixture-of-experts:
|
| 58 |
+
|
| 59 |
+
| | |
|
| 60 |
+
|---|---|
|
| 61 |
+
| Total parameters | 1,031.0M (~1.03B) |
|
| 62 |
+
| Active parameters / token | 394.0M |
|
| 63 |
+
| Hidden size | 1,024 |
|
| 64 |
+
| Layers | 20 (first 2 dense, rest MoE) |
|
| 65 |
+
| Attention | 16 query heads / 4 KV heads (GQA), head dim 64 |
|
| 66 |
+
| Context length | 2,048 tokens |
|
| 67 |
+
| Routed experts | 24 (6 active per token) |
|
| 68 |
+
| Shared experts | 2 (always active) |
|
| 69 |
+
| Expert FFN size | 640 (fine-grained segmentation) |
|
| 70 |
+
| Router | top-6 of 24, 0.01-weighted load-balancing loss |
|
| 71 |
+
| Vocabulary | 32,000 tokens |
|
| 72 |
+
| Tied embeddings | yes |
|
| 73 |
+
|
| 74 |
+
## Held-out evaluation: base vs. this SFT checkpoint
|
| 75 |
+
|
| 76 |
+
Ten hand-authored prompts, not sampled from dolly-15k or any training
|
| 77 |
+
data, spanning open QA, closed/context QA, summarization, brainstorming,
|
| 78 |
+
classification, extraction, general QA, instruction-following, and
|
| 79 |
+
creative writing. Full transcript below is unedited.
|
| 80 |
+
|
| 81 |
+
**Honest summary: a modest, mixed improvement β not a clean win.**
|
| 82 |
+
|
| 83 |
+
The clearest gain is grounded, context-based QA. The weakest spot is
|
| 84 |
+
still strict instruction-following (format, length). Both checkpoints
|
| 85 |
+
remain largely incoherent past the first sentence or two, which tracks
|
| 86 |
+
with the model's size β that's not something this SFT pass was expected
|
| 87 |
+
to fix.
|
| 88 |
+
|
| 89 |
+
**Win β closed QA (uses given context correctly):**
|
| 90 |
+
> Prompt: *Context: The Golden Gate Bridge is 2,737 meters long and was
|
| 91 |
+
> completed in 1937.\nQuestion: How long is the Golden Gate Bridge?*
|
| 92 |
+
>
|
| 93 |
+
> Base: ignores the context entirely, wanders into an unrelated story about
|
| 94 |
+
> "the Banana" process and the Coast Guard.
|
| 95 |
+
>
|
| 96 |
+
> SFT: *"The Golden Gate Bridge is 2,737 meters long and has an area of
|
| 97 |
+
> approximately 2.4 million square miles."* β correctly extracts and
|
| 98 |
+
> restates the fact (the second clause is invented, but the requested
|
| 99 |
+
> answer is right).
|
| 100 |
+
|
| 101 |
+
**Partial win β brainstorming (attempts the requested list format):**
|
| 102 |
+
> Prompt: *List three ideas for reducing food waste in a household kitchen.*
|
| 103 |
+
>
|
| 104 |
+
> Base: no list structure, generic unrelated advice about water and diet.
|
| 105 |
+
>
|
| 106 |
+
> SFT: *"1. Make sure you have all food waste in your kitchen. \n2.f leaf
|
| 107 |
+
> food and water should be discharged from local resources. \n3. Focus on
|
| 108 |
+
> local food waste..."* β correctly produces a numbered list (the content
|
| 109 |
+
> is still weak/garbled).
|
| 110 |
+
|
| 111 |
+
**Partial win β topical relevance:**
|
| 112 |
+
> Prompt: *Why do cats purr?*
|
| 113 |
+
>
|
| 114 |
+
> Base: drifts immediately into an unrelated riff on "the human body,"
|
| 115 |
+
> never mentions cats again.
|
| 116 |
+
>
|
| 117 |
+
> SFT: *"Finding the right balance between breast and chest health is
|
| 118 |
+
> hard... So my recommendation is to keep your cat's skin healthy and
|
| 119 |
+
> strong..."* β stays anchored to "cat" throughout, base does not.
|
| 120 |
+
|
| 121 |
+
**No win β strict instruction-following:**
|
| 122 |
+
> Prompt: *Write a short two-sentence greeting for a birthday card.*
|
| 123 |
+
>
|
| 124 |
+
> Base: an unrelated bulleted list of vague social advice.
|
| 125 |
+
>
|
| 126 |
+
> SFT: *"The free meeting is open for all people... The national party has
|
| 127 |
+
> the following 82 seats: The Democratic Party..."* β completely
|
| 128 |
+
> unrelated to the prompt, and no better than base here.
|
| 129 |
+
|
| 130 |
+
**No win β classification:**
|
| 131 |
+
> Prompt: *Classify the following as either a fruit or a vegetable:
|
| 132 |
+
> broccoli*
|
| 133 |
+
>
|
| 134 |
+
> Base: never answers the classification, rambles about diet generally.
|
| 135 |
+
>
|
| 136 |
+
> SFT: *"broccoli, broccoli, cabbage,iant cucumber, cucumber, ormanus...
|
| 137 |
+
> This fruit is most closely associated with pears and cucumber."* β also
|
| 138 |
+
> fails to answer, with garbled sub-word artifacts not seen in the base
|
| 139 |
+
> output.
|
| 140 |
+
|
| 141 |
+
## Files
|
| 142 |
+
|
| 143 |
+
- `model.safetensors` β model weights, fp32 (optimizer state dropped)
|
| 144 |
+
- `configuration_quartz.py`, `modeling_quartz.py` β `transformers`-compatible
|
| 145 |
+
`PretrainedConfig`/`PreTrainedModel` wrapper (`QuartzMoEConfig`,
|
| 146 |
+
`QuartzForCausalLM`), wired up via `auto_map` in `config.json`
|
| 147 |
+
- `model.py`, `config.py` β the original plain-PyTorch model class and
|
| 148 |
+
architecture config, used by `load_model.py`
|
| 149 |
+
- `config.json` β architecture config in HF's expected format
|
| 150 |
+
- `tokenizer.json`, `tokenizer_config.json`, `special_tokens_map.json` β a
|
| 151 |
+
standard `transformers` fast tokenizer
|
| 152 |
+
- `tokenizer/vocab.json`, `tokenizer/merges.txt` β the custom tokenizer's
|
| 153 |
+
raw vocab/merges, used by `load_model.py`'s plain-PyTorch path. Only
|
| 154 |
+
compatible with this model's weights.
|
| 155 |
+
- `load_model.py` β minimal working example using the plain-PyTorch path
|
| 156 |
+
|
| 157 |
+
## Usage
|
| 158 |
+
|
| 159 |
+
**Via `transformers` (recommended):**
|
| 160 |
+
|
| 161 |
+
```bash
|
| 162 |
+
pip install transformers torch
|
| 163 |
+
```
|
| 164 |
+
|
| 165 |
+
```python
|
| 166 |
+
from transformers import AutoModelForCausalLM, AutoTokenizer
|
| 167 |
+
|
| 168 |
+
model = AutoModelForCausalLM.from_pretrained(
|
| 169 |
+
"VertexAGI/quartz-micro-preview", trust_remote_code=True
|
| 170 |
+
)
|
| 171 |
+
tok = AutoTokenizer.from_pretrained("VertexAGI/quartz-micro-preview")
|
| 172 |
+
|
| 173 |
+
prompt = "### Instruction:\nWhy do cats purr?\n\n### Response:\n"
|
| 174 |
+
ids = tok(prompt, return_tensors="pt")
|
| 175 |
+
out = model.generate(**ids, max_new_tokens=80, do_sample=True, temperature=0.7)
|
| 176 |
+
print(tok.decode(out[0], skip_special_tokens=True))
|
| 177 |
+
```
|
| 178 |
+
|
| 179 |
+
`trust_remote_code=True` is required β this is a bespoke architecture
|
| 180 |
+
(DeepSeek-style fine-grained MoE), not one of `transformers`' built-in
|
| 181 |
+
model types. No KV-cache support yet, so `generate()` recomputes attention
|
| 182 |
+
over the full sequence each step.
|
| 183 |
+
|
| 184 |
+
**Plain PyTorch (no `transformers` dependency):**
|
| 185 |
+
|
| 186 |
+
```bash
|
| 187 |
+
pip install torch safetensors tokenizers
|
| 188 |
+
python load_model.py
|
| 189 |
+
```
|
| 190 |
+
|
| 191 |
+
## Limitations
|
| 192 |
+
|
| 193 |
+
Same size-driven limitations as the base checkpoint (factual
|
| 194 |
+
unreliability, weak general knowledge, no safety fine-tuning), plus
|
| 195 |
+
SFT-specific ones documented honestly above: strict format/length
|
| 196 |
+
instructions (e.g. "write exactly two sentences") are not reliably
|
| 197 |
+
followed, and generation occasionally produces garbled sub-word artifacts
|
| 198 |
+
the base checkpoint doesn't. Treat this as a proof-of-concept instruction
|
| 199 |
+
tune on a genuinely tiny model, not a general-purpose assistant.
|
| 200 |
+
|
| 201 |
+
---
|
| 202 |
+
|
| 203 |
+
Built by [Vertex AGI](https://vertexagi.vercel.app). Every model we ship β
|
| 204 |
+
weights, not just claims.
|