anyze's picture
Update README.md
fdf410d verified
|
Raw
History Blame Contribute Delete
8.73 kB
---
license: apache-2.0
language:
- en
library_name: transformers
pipeline_tag: text-generation
tags:
- coding
- python
- linux
- systems-programming
- embedded-systems
- automotive
- communication protocols
- rtos/register
- tool-calling
- agent
- 128k context
- C
- CPP
- 1.5B
- Microcontroller
- STM32
- CAN
- Ethernet
- Autosar
---
# Anyze Ze1.5 Instruct (Automotive / Embedded Specialist)
**~1.54B params · 28 transformer layers (hidden 1536, GQA 12/2, SwiGLU) · 128k context
(131,072, YaRN) · vocab 151,936 · F16 · Apache-2.0** — full details in [Architecture](#architecture).
A compact 1.5B-parameter instruction-tuned model specialized for **automotive and
embedded firmware**: C/C++, MCUs (STM32 & friends), RTOS (FreeRTOS/Zephyr), peripherals
(UART/SPI/I2C/CAN/LIN), ISRs, UDS/OBD diagnostics, MISRA C, and AUTOSAR (Classic &
Adaptive) — with **agentic tool calling** and a verify-by-web-search behavior for
precise specification values. On top of the specialty it keeps solid **general coding**
ability: **Python**, **Linux/systems**, and cross-platform **shell** work (PowerShell,
cmd, bash). Context window: **128k tokens** (YaRN).
> Scope: a small (1.5B) specialist, not a frontier assistant. Strongest on embedded code,
> concept explanations, and tool-driven workflows, with everyday Python/Linux/shell as a
> general baseline. For exact spec values (service IDs, register words, rule numbers,
> timing limits) it prefers to *verify via a search tool* rather than answer from memory —
> **serve it with a `web_search` tool available** for best factual reliability. Always
> review generated code before flashing.
## Capabilities
- **Embedded C/C++**: drivers, ISRs, ring buffers, register-level code, RTOS patterns.
- **Automotive**: CAN/CAN-FD/LIN mechanics, UDS diagnostics flow, AUTOSAR concepts (RTE,
SWC, BSW/MCAL, COM, DEM/DCM), MISRA C themes.
- **General coding & shell**: everyday **Python** and **Linux/systems** tasks, plus
cross-platform terminal ops (**PowerShell, cmd, bash**) — installing Python/uv/pip,
creating venvs, and the agentic "detect platform → install the missing tool → use it"
pattern.
- **Concept explanations**: `volatile`, mutex vs semaphore, priority inversion, DMA,
watchdogs, memory sections, Cortex-M interrupts/faults.
- **Agentic tool calling** (protocol below): emits exactly one tool call and stops;
routes *own-code* questions to `grep`/`read`, *live facts* (versions, prices, errata,
CVEs) and *precise spec values* to `web_search`; answers well-known concepts directly.
- Frontier-style behavior: handles general requests naturally (greetings, everyday
coding) instead of refusing, and states uncertainty on unverifiable spec figures.
- **Long context**: 131,072-token window (YaRN); a 128k KV-cache needs several GB of
memory — size your hardware accordingly.
## Example prompts
Embedded C
- `Set up CAN1 on an STM32 at 500 kbit/s.`
- `Write a UART RX interrupt handler with a ring buffer.`
- `Why is my log output garbled at 115200 baud?`
Automotive / AUTOSAR / UDS
- `Explain how CAN bus arbitration decides message priority.`
- `What is the AUTOSAR RTE and what does it sit between?`
- `Walk me through a UDS flashing sequence.`
Concepts
- `What does the volatile keyword guarantee, and what does it NOT guarantee?`
- `What is priority inversion and how does an RTOS prevent it?`
General coding & shell
- `Write a Python script to parse a CSV and summarize one column.`
- `How do I find and kill the process using a given port on Linux?`
- `Install uv and create a Python venv on Windows PowerShell.`
Agentic (with tools provided)
- `What is the newest stable Zephyr RTOS release?` → calls `web_search`
- `Where is our CAN receive ISR defined?` → calls `grep`
## Tool-calling protocol (```json code block)
The model emits tool calls as a **```json code block** and then stops:
````
```json
{"name": "web_search", "arguments": {"query": "Zephyr RTOS latest stable LTS release version"}}
```
````
Describe the available tools in the **system prompt** using this exact framing:
```text
{YOUR SYSTEM PROMPT}
# Tools
You may call one or more functions to assist with the user query.
You are provided with function signatures within <tools></tools> XML tags:
<tools>
{"type": "function", "function": {"name": "web_search", "description": "Search the web for current information.", "parameters": {"type": "object", "properties": {"query": {"type": "string", "description": "the search query"}}, "required": ["query"]}}}
</tools>
To call a function, output a ```json code block containing a JSON object with the
function name and arguments, then stop:
```json
{"name": <function-name>, "arguments": <args-json-object>}
```
```
Your harness parses the block, executes the tool, and returns the result as a **user**
message wrapped in `<tool_response>...</tool_response>`; the model then answers from it.
**Agent mode (THINK → ACT):** append this to the system prompt for a one-sentence
rationale before each call, plus the verify/restraint policy:
```text
When working autonomously, think first: give your reasoning in one short sentence, then act. Call a tool only when you genuinely cannot answer from your own knowledge or the codebase — explain well-known concepts and definitions directly, with no tool call. Use grep or read for the user's own code; use web_search for external facts that change over time (latest versions, prices, errata, CVEs) and never guess such a fact. Also VERIFY precise specification values you are not certain of — exact service IDs, rule numbers, register addresses, thresholds, timing figures — with web_search instead of answering from memory; if you cannot verify, say so explicitly. Emit at most one tool call, then stop.
```
## Usage (transformers)
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
model = AutoModelForCausalLM.from_pretrained("anyze/Ze1.5-Automotive-Embedded-Instruct",
torch_dtype="auto", device_map="auto")
tok = AutoTokenizer.from_pretrained("anyze/Ze1.5-Automotive-Embedded-Instruct")
messages = [
{"role": "system", "content": "You are Ze1.5, an embedded-systems and automotive "
"firmware specialist: C/C++, MCUs, RTOS, drivers/peripherals (UART/SPI/I2C/CAN/LIN/"
"Ethernet), ISRs, UDS/OBD diagnostics, MISRA C, and AUTOSAR (Classic and Adaptive "
"Platform). Answer precisely and, when a tool is provided and useful, call it."},
{"role": "user", "content": "Set up CAN1 on an STM32 at 500 kbit/s."},
]
text = tok.apply_chat_template(messages, add_generation_prompt=True, tokenize=False)
out = model.generate(**tok(text, return_tensors="pt").to(model.device), max_new_tokens=512)
print(tok.decode(out[0], skip_special_tokens=True))
```
Suggested sampling: `temperature 0.7`, `top_p 0.8`, `top_k 20`, `repetition_penalty 1.1`
(as shipped in `generation_config.json`), or greedy for deterministic tool calls.
## Usage (Ollama / LM Studio)
A ready F16 GGUF is provided. **Ollama** — create a `Modelfile`:
```
FROM ./Ze1.5-1.5B-Automotive-Embedded-Instruct-F16.gguf
SYSTEM """You are Ze1.5, an embedded-systems and automotive firmware specialist: C/C++, MCUs, RTOS, drivers/peripherals (UART/SPI/I2C/CAN/LIN/Ethernet), ISRs, UDS/OBD diagnostics, MISRA C, and AUTOSAR (Classic and Adaptive Platform). Answer precisely and, when a tool is provided and useful, call it."""
PARAMETER temperature 0.7
PARAMETER top_p 0.8
PARAMETER top_k 20
PARAMETER repeat_penalty 1.1
```
```bash
ollama create ze1_5-embedded -f Modelfile
ollama run ze1_5-embedded "Write a ring buffer in C for a UART RX ISR"
```
**LM Studio** — load the GGUF; the ChatML-style chat template is embedded, so no manual
prompt-format setup is needed. Set the system prompt as above.
## Limitations
- **Exact spec values**: service-ID tables, register reset words, rule numbers and
timing figures can be confabulated when answered from memory — it prefers to verify
via `web_search` when the tool is present; **run it with a search tool** for factual
work and treat from-memory numbers as unverified.
- Correct concept explanations are sometimes decorated with imprecise tails; phrasing
can affect recall. Register-exact code (peripheral bit fields) should be checked
against the reference manual.
- Long-context quality beyond ~32k is extrapolated; don't expect book-length attention
fidelity.
- English only. 1.5B-scale reasoning: fine for focused tasks, not long multi-step proofs.
## Architecture
28 layers, hidden 1536, 12 query / 2 KV heads (GQA), FFN 8960 (SwiGLU), RMSNorm,
RoPE (θ=1e6, YaRN ×4), tied embeddings, vocab 151,936, context 131,072, 1.54B params.