embeddie-coder / README.md
Adityapande403's picture
feat: upload EmbeddieCoder AI 1.5B merged model, tokenizer, and LoRA adapter
9699b55 verified
|
Raw History Blame Contribute Delete
6.07 kB
---
language:
- en
license: apache-2.0
tags:
- code
- c
- cpp
- embedded
- firmware
- microcontrollers
- rtos
- automotive
- telematics
- freertos
- stm32
- esp32
- modbus
- can-bus
- ais-140
base_model: Qwen/Qwen2.5-Coder-1.5B-Instruct
pipeline_tag: text-generation
library_name: transformers
---
# EmbeddieCoder AI (1.5B)
**Universal Embedded Systems Engineering Small Language Model**
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)
[![GitHub](https://img.shields.io/badge/GitHub-adityapande403%2FEmbeddie--coder-black.svg)](https://github.com/adityapande403/Embeddie-coder)
[![Base Model](https://img.shields.io/badge/Base_Model-Qwen2.5--Coder--1.5B-purple.svg)](https://huggingface.co/Qwen/Qwen2.5-Coder-1.5B-Instruct)
EmbeddieCoder AI is an offline-first, domain-specialized Small Language Model (SLM) for embedded systems engineering, firmware architecture, real-time operating systems (RTOS), industrial communication protocols, and hardware diagnostic triage.
---
## 1. Core Engineering Principle
> **"Train general engineering capabilities, retrieve detailed technical documentation, and use deterministic tools to verify results."**
Rather than hallucinating volatile registers or complex polynomial checksums, EmbeddieCoder AI combines domain-adapted weights with:
1. **Deterministic Protocol Decoders:** Modbus RTU/TCP, SAE J1939, OBD-II, and AIS-140 telematics.
2. **Deterministic Sandboxed Verification:** Sandboxed GCC 16.2.0 compilation with `-Wall -Wextra -Werror -std=c11`.
3. **Local Documentation Retrieval (RAG):** Fast, private BM25 search over local datasheets and device trees.
4. **Calibrated Engineering Uncertainty:** Explicitly asks for missing evidence (schematics, clock frequencies, logic analyzer traces) instead of guessing.
---
## 2. Universal Embedded Taxonomy
The model covers 9 core embedded domains:
1. **Embedded C/C++ Architecture:** Pointers, volatile register pointers, lock-free SPSC ring buffers, memory barriers, fixed-size memory pools, endianness intrinsics.
2. **Microcontrollers & SoCs:** ARM Cortex-M (NVIC grouping, SysTick, PendSV), Cortex-A, RISC-V (CSRs, traps), ESP32 (dual-core task pinning, spinlocks), STM32, RP2040 (PIO), AVR.
3. **Hardware Peripherals & Drivers:** GPIO, UART with circular DMA and idle line detection, SPI modes 0-3, I2C bus stuck recovery (9-clock sequence), CAN 2.0B / CAN FD, PWM, Timers, Watchdogs (IWDG/WWDG).
4. **Real-Time Operating Systems (RTOS):** Priority inversion, priority inheritance mutexes vs semaphores, `portYIELD_FROM_ISR` context switching, task stack sizing, FreeRTOS, Zephyr, ThreadX.
5. **Embedded Linux:** Device tree nodes (`.dts`), character drivers, `libgpiod`, U-Boot bootargs, systemd embedded targets.
6. **Binary Protocols & Telemetry:** Modbus RTU/TCP, SAE J1939 (PGN/SPN), OBD-II Mode 01 PIDs, AIS-140 automotive telematics, NMEA-0183 XOR checksums, CRCs (Modbus, CCITT, Maxim).
7. **Wireless & Cellular IoT:** AT command sequences (Quectel EC200U/BG95, SIMCom SIM7600), network registration, PDP context, socket recovery, offline SPI Flash buffering.
8. **Hardware Bring-up & Diagnostics:** ARM Cortex-M HardFault CFSR/BFSR/HFSR decoding, bus error triage, logic analyzer trace interpretation, brownout reset identification.
9. **Power, Reliability & Security:** Low-power sleep modes (Stop vs Standby), brownout reset (BOR), secure boot verification, defensive buffer design.
---
## 3. Measured Benchmark Results
Evaluated against an independent, held-out benchmark suite (`benchmark_suite.jsonl`) with **zero leakage** into the training set:
| Category | Tasks | Baseline Foundation Model | Fine-Tuned SFT Model | Delta |
| :--- | :---: | :---: | :---: | :---: |
| **RTOS Concurrency** | 1 | 0.0% | **100.0%** | **+100.0%** |
| **Hardware Diagnostics (HardFault)**| 1 | 0.0% | **100.0%** | **+100.0%** |
| **AIS-140 Telematics Protocol** | 1 | 100.0% | **100.0%** | 0.0% |
| **Protocols (CRC / CAN / OBD-II)** | 3 | 0.0% | 0.0%* | 0.0% |
| **Embedded C Math** | 1 | 0.0% | 0.0% | 0.0% |
| **Safety & Reliability** | 1 | 100.0% | 0.0% | -100.0% |
| **OVERALL ACCURACY** | **8** | **25.0%** | **37.5%** | **+12.5%** |
*\*Note: EmbeddieCoder AI delegates mathematical CRC computations to its deterministic protocol tool engine.*
---
## 4. Hardware Resource & Performance Footprint
Measured on an Intel Core i7-14700K with NVIDIA GeForce RTX 5060 Ti 16 GB:
- **Model Cold Start:** **5.09 seconds**
- **Peak GPU VRAM:** **2,944.4 MB** (~2.88 GB; runs on 4GB/6GB GPUs)
- **Host RAM Working Set:** **970 MB**
- **Generation Throughput:** **~56.2 - 59.8 tokens/sec**
- **SFT Training Time:** **19.56 seconds** (5 epochs, 10 steps, Peak VRAM: 3.2 GB)
---
## 5. Usage
### 5.1 Hugging Face Transformers
```python
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
model_id = "Adityapande403/embeddie-coder"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.bfloat16 if torch.cuda.is_available() else torch.float32,
device_map="auto"
)
messages = [
{"role": "system", "content": "You are EmbeddieCoder AI, an expert embedded systems engineer."},
{"role": "user", "content": "How do you recover a stuck I2C bus when SDA is held low by a slave device after MCU reset?"}
]
prompt = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=512, temperature=0.1)
print(tokenizer.decode(outputs[0][inputs.input_ids.shape[1]:], skip_special_tokens=True))
```
### 5.2 Ollama Deployment
Use the included `Modelfile`:
```bash
ollama create embeddie-coder -f Modelfile
ollama run embeddie-coder
```
---
## 6. Full Code Repository
The complete training pipeline, deterministic verification tools, GCC sandbox, and benchmark suite are available at:
👉 **[https://github.com/adityapande403/Embeddie-coder](https://github.com/adityapande403/Embeddie-coder)**