--- license: apache-2.0 base_model: Qwen/Qwen1.5-0.5B library_name: peft language: - en tags: - lora - peft - qwen - edge-ai - edge-impulse - documentation - code-generation - conversational pipeline_tag: text-generation --- # edgeai-docs-embedding-qwen1.5-0.5b-instruct A LoRA adapter fine-tuned on **1,794 Edge Impulse / Edge AI MDX documentation files** from the [Edge Impulse documentation](https://docs.edgeimpulse.com), built on top of [`Qwen/Qwen1.5-0.5B`](https://huggingface.co/Qwen/Qwen1.5-0.5B). Optimized for: - Answering developer questions about Edge Impulse Studio, SDK, and APIs - Summarizing technical documentation - Generating code snippets for edge ML workflows - Lightweight local/edge deployment > **Larger variants in training:** [1.5B](https://huggingface.co/eoinedge/edgeai-qwen2.5coder-1.5b-lora) · [7B](https://huggingface.co/eoinedge/edgeai-qwen2.5coder-7b-lora) (Qwen2.5-Coder base) --- ## Model Details | Property | Value | |---|---| | Base model | `Qwen/Qwen1.5-0.5B` | | Adapter type | LoRA (PEFT) | | LoRA rank (`r`) | 8 | | LoRA alpha | 32 | | Target modules | `q_proj`, `v_proj` | | LoRA dropout | 0.05 | | Trainable parameters | ~786K (0.17% of base) | | Training epochs | 3 | | Batch size | 4 (× grad accum 2 = effective 8) | | Learning rate | 3e-4 (cosine decay) | | Sequence length | 512 tokens | | Training hardware | Apple M1 Pro (MPS, fp16) | | Precision | float16 | --- ## Training Data | Stat | Value | |---|---| | Source | [Edge Impulse Mintlify documentation](https://docs.edgeimpulse.com) | | File format | MDX (Markdown + JSX components) | | Total files | 1,794 `.mdx` files | | Preprocessing | Frontmatter, JSX tags, imports stripped; code fences unwrapped; links flattened | | Chunks generated | ~3,500 × 512-token chunks | Topics covered: Studio projects, datasets, DSP blocks, learning blocks, deployment targets, Python SDK, REST API, CLI tools, edge inference, model optimization, and more. --- ## Usage ### Load and chat ```python import torch from transformers import AutoModelForCausalLM, AutoTokenizer from peft import PeftModel BASE_MODEL = "Qwen/Qwen1.5-0.5B" ADAPTER = "eoinedge/edgeai-docs-embedding-qwen1.5-0.5b-instruct" device = "cuda" if torch.cuda.is_available() else \ "mps" if torch.backends.mps.is_available() else "cpu" tokenizer = AutoTokenizer.from_pretrained(BASE_MODEL) base = AutoModelForCausalLM.from_pretrained(BASE_MODEL, dtype=torch.float16 if device != "cpu" else torch.float32, device_map=device) model = PeftModel.from_pretrained(base, ADAPTER) model.eval() ``` ### Single question ```python prompt = "How do I collect sensor data using the Edge Impulse data forwarder?" inputs = tokenizer(prompt, return_tensors="pt").to(model.device) with torch.no_grad(): out = model.generate(**inputs, max_new_tokens=512, do_sample=True, temperature=0.7, top_p=0.95, pad_token_id=tokenizer.eos_token_id) print(tokenizer.decode(out[0], skip_special_tokens=True)) ``` ### Chat template (multi-turn) ```python messages = [ {"role": "user", "content": "What is an impulse in Edge Impulse?"} ] formatted = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True) inputs = tokenizer(formatted, return_tensors="pt").to(model.device) with torch.no_grad(): out = model.generate(**inputs, max_new_tokens=512, do_sample=True, temperature=0.7, pad_token_id=tokenizer.eos_token_id) print(tokenizer.decode(out[0], skip_special_tokens=True)) ``` --- ## Example Prompts | Task | Prompt | |---|---| | Concept explanation | `"What is a DSP block in Edge Impulse?"` | | API usage | `"How do I use the Edge Impulse Python SDK to upload data?"` | | Deployment | `"How do I deploy a model to an Arduino Nano 33 BLE Sense?"` | | Code generation | `"Write Python code to collect IMU data and upload it to Edge Impulse."` | | Troubleshooting | `"Why is my Edge Impulse model showing high latency on the Cortex-M4?"` | --- ## Limitations - Based on a 0.5B parameter base model — may struggle with complex multi-step reasoning - Training data covers documentation as of mid-2026; newer APIs may not be represented - May hallucinate undocumented Edge Impulse features - Not suitable for safety-critical or production decision-making systems - Validate generated code before running on real hardware --- ## Related Models | Model | Base | Status | |---|---|---| | This model | Qwen1.5-0.5B | ✅ Available | | [eoinedge/edgeai-qwen2.5coder-1.5b-lora](https://huggingface.co/eoinedge/edgeai-qwen2.5coder-1.5b-lora) | Qwen2.5-Coder-1.5B-Instruct | 🔄 Training | | [eoinedge/edgeai-qwen2.5coder-7b-lora](https://huggingface.co/eoinedge/edgeai-qwen2.5coder-7b-lora) | Qwen2.5-Coder-7B-Instruct | 🔄 Training | | [eoinedge/arduino-qwen0.5-lora](https://huggingface.co/eoinedge/arduino-qwen0.5-lora) | Qwen1.5-0.5B | ✅ Available (Arduino docs) | --- ## Citation ```bibtex @misc{edgeai-docs-embedding-qwen1.5-0.5b-instruct, author = {Jordan, Eoin}, title = {edgeai-docs-embedding-qwen1.5-0.5b-instruct}, year = {2026}, publisher = {Hugging Face}, howpublished = {\url{https://huggingface.co/eoinedge/edgeai-docs-embedding-qwen1.5-0.5b-instruct}} } ```