eoinedge commited on
Commit
338bb27
·
verified ·
1 Parent(s): 0321606

Update model card: real training details, LoRA config, usage examples, related models

Browse files
Files changed (1) hide show
  1. README.md +113 -135
README.md CHANGED
@@ -1,188 +1,166 @@
1
  ---
 
2
  base_model: Qwen/Qwen1.5-0.5B
3
  library_name: peft
4
- pipeline_tag: text-generation
5
- license: apache-2.0
6
  language:
7
- - en
8
  tags:
9
- - text-generation
10
- - conversational
11
- - lora
12
- - peft
13
- - transformers
14
- - safetensors
15
- - edge-deployment
16
- - base_model:adapter:Qwen/Qwen1.5-0.5B
 
17
  ---
18
 
19
  # edgeai-docs-embedding-qwen1.5-0.5b-instruct
20
 
 
21
 
22
- its still pretty terrible on performance but I hope to improve it with some training and am looking into an adaptor as an option too preview here:
23
-
24
-
25
- ![image](https://cdn-uploads.huggingface.co/production/uploads/65fdb7d09a6eb46bd3d66d91/taGfx3w8SngcRABinHqRV.png)
26
-
27
- ## Model Summary
28
-
29
- `edgeai-docs-embedding-qwen1.5-0.5b-instruct` is a lightweight, instruction-tuned LoRA adapter built on top of **Qwen1.5-0.5B**.
30
- It is optimized for:
31
-
32
- - Documentation summarization
33
- - Conversational responses
34
- - Lightweight embedding-style semantic generation
35
- - Edge and local deployment environments
36
 
37
- The model is designed to run efficiently in constrained environments and integrates cleanly with local inference stacks such as Ollama and llama.cpp.
38
 
39
  ---
40
 
41
- # Model Details
42
-
43
- ## Model Description
44
-
45
- This model applies Parameter-Efficient Fine-Tuning (LoRA) to the base `Qwen/Qwen1.5-0.5B` model using custom instruction-formatted documentation datasets.
46
-
47
- It is tuned for structured reasoning over API documentation, developer content, and technical text. The objective is to provide high-quality summarization and conversational assistance while maintaining a small deployment footprint.
48
-
49
- ### Developed by
50
- Eoin Jordan
51
- Hugging Face: https://huggingface.co/eoinedge
52
-
53
- ### Model Type
54
- Instruction-tuned causal language model (LoRA adapter)
55
-
56
- ### Base Model
57
- Qwen/Qwen1.5-0.5B
58
-
59
- ### Fine-Tuning Method
60
- LoRA (Low-Rank Adaptation) via PEFT
61
-
62
- ### Framework
63
- - Hugging Face Transformers
64
- - PEFT
65
- - Safetensors
66
-
67
- ### Language
68
- English
69
-
70
- ### License
71
- Apache 2.0
72
 
73
  ---
74
 
75
- # Intended Uses
76
-
77
- ## Direct Use
78
-
79
- - Developer documentation summarization
80
- - API explanation generation
81
- - Conversational assistant for technical workflows
82
- - Lightweight semantic generation for search/retrieval pipelines
83
-
84
- ## Downstream Use
85
-
86
- - Integrated into RAG (Retrieval-Augmented Generation) systems
87
- - Embedded inside edge devices
88
- - Wrapped within Ollama or llama.cpp inference environments
89
- - Developer tooling assistants
90
 
91
- ## Out-of-Scope Use
 
 
 
 
 
 
92
 
93
- - High-stakes decision-making systems
94
- - Legal or medical advisory systems
95
- - Large-scale multi-lingual production deployments
96
- - Safety-critical automation
97
 
98
  ---
99
 
100
- # Bias, Risks, and Limitations
101
 
102
- Because this model is derived from Qwen1.5 and fine-tuned on technical documentation:
103
 
104
- - It may inherit biases present in the base model.
105
- - It is optimized for technical content and may degrade on general creative tasks.
106
- - It may hallucinate undocumented APIs or incorrect implementation details.
107
- - It is not designed for factual verification tasks.
108
 
109
- Users should validate outputs before use in production systems.
 
110
 
111
- ---
 
112
 
113
- # Training Details
 
 
 
 
 
 
114
 
115
- ## Training Data
116
 
117
- - Custom documentation chunks
118
- - API references
119
- - Instruction-formatted JSON datasets
120
- - Manually validated prompt-response pairs
121
 
122
- No personally identifiable information (PII) was intentionally included.
 
 
 
123
 
124
- ## Training Procedure
 
125
 
126
- - LoRA fine-tuning via PEFT
127
- - Instruction tuning objective
128
- - Mixed precision training
129
 
130
- ### Training Regime
131
- bf16 mixed precision
 
 
 
 
132
 
133
- ---
 
 
 
134
 
135
- # Evaluation
136
-
137
- Evaluation was performed using:
138
-
139
- - Manual prompt benchmarking
140
- - Structured documentation summarization tests
141
- - API explanation accuracy review
142
-
143
- Quantitative benchmarks are limited due to domain-specific fine-tuning focus.
144
 
145
  ---
146
 
147
- # Technical Specifications
148
-
149
- ## Architecture
150
 
151
- - Transformer decoder-only model
152
- - 0.5B parameters (base model)
153
- - LoRA adapter layers applied to attention modules
 
 
 
 
154
 
155
- ## Adapter Type
156
-
157
- Low-Rank Adaptation (LoRA)
158
 
159
- ## Deployment Targets
160
 
161
- - Ollama
162
- - llama.cpp (via conversion)
163
- - Transformers runtime
164
- - Edge inference environments
 
165
 
166
  ---
167
 
168
- # Environmental Impact
169
 
170
- Base model reference:
171
- Qwen Technical Report (2023)
172
-
173
- Carbon emissions were not separately tracked for this adapter training run.
174
- For estimation guidance, see: https://mlco2.github.io/impact
 
175
 
176
  ---
177
 
178
- # Citation
179
-
180
- If you use this model, please cite:
181
 
182
  ```bibtex
183
  @misc{edgeai-docs-embedding-qwen1.5-0.5b-instruct,
184
- author = {Jordan, Eoin},
185
- title = {edgeai-docs-embedding-qwen1.5-0.5b-instruct},
186
- year = {2026},
 
187
  howpublished = {\url{https://huggingface.co/eoinedge/edgeai-docs-embedding-qwen1.5-0.5b-instruct}}
188
- }
 
 
1
  ---
2
+ license: apache-2.0
3
  base_model: Qwen/Qwen1.5-0.5B
4
  library_name: peft
 
 
5
  language:
6
+ - en
7
  tags:
8
+ - lora
9
+ - peft
10
+ - qwen
11
+ - edge-ai
12
+ - edge-impulse
13
+ - documentation
14
+ - code-generation
15
+ - conversational
16
+ pipeline_tag: text-generation
17
  ---
18
 
19
  # edgeai-docs-embedding-qwen1.5-0.5b-instruct
20
 
21
+ 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).
22
 
23
+ Optimized for:
24
+ - Answering developer questions about Edge Impulse Studio, SDK, and APIs
25
+ - Summarizing technical documentation
26
+ - Generating code snippets for edge ML workflows
27
+ - Lightweight local/edge deployment
 
 
 
 
 
 
 
 
 
28
 
29
+ > **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)
30
 
31
  ---
32
 
33
+ ## Model Details
34
+
35
+ | Property | Value |
36
+ |---|---|
37
+ | Base model | `Qwen/Qwen1.5-0.5B` |
38
+ | Adapter type | LoRA (PEFT) |
39
+ | LoRA rank (`r`) | 8 |
40
+ | LoRA alpha | 32 |
41
+ | Target modules | `q_proj`, `v_proj` |
42
+ | LoRA dropout | 0.05 |
43
+ | Trainable parameters | ~786K (0.17% of base) |
44
+ | Training epochs | 3 |
45
+ | Batch size | 4 (× grad accum 2 = effective 8) |
46
+ | Learning rate | 3e-4 (cosine decay) |
47
+ | Sequence length | 512 tokens |
48
+ | Training hardware | Apple M1 Pro (MPS, fp16) |
49
+ | Precision | float16 |
 
 
 
 
 
 
 
 
 
 
 
 
 
 
50
 
51
  ---
52
 
53
+ ## Training Data
 
 
 
 
 
 
 
 
 
 
 
 
 
 
54
 
55
+ | Stat | Value |
56
+ |---|---|
57
+ | Source | [Edge Impulse Mintlify documentation](https://docs.edgeimpulse.com) |
58
+ | File format | MDX (Markdown + JSX components) |
59
+ | Total files | 1,794 `.mdx` files |
60
+ | Preprocessing | Frontmatter, JSX tags, imports stripped; code fences unwrapped; links flattened |
61
+ | Chunks generated | ~3,500 × 512-token chunks |
62
 
63
+ Topics covered: Studio projects, datasets, DSP blocks, learning blocks, deployment targets, Python SDK, REST API, CLI tools, edge inference, model optimization, and more.
 
 
 
64
 
65
  ---
66
 
67
+ ## Usage
68
 
69
+ ### Load and chat
70
 
71
+ ```python
72
+ import torch
73
+ from transformers import AutoModelForCausalLM, AutoTokenizer
74
+ from peft import PeftModel
75
 
76
+ BASE_MODEL = "Qwen/Qwen1.5-0.5B"
77
+ ADAPTER = "eoinedge/edgeai-docs-embedding-qwen1.5-0.5b-instruct"
78
 
79
+ device = "cuda" if torch.cuda.is_available() else \
80
+ "mps" if torch.backends.mps.is_available() else "cpu"
81
 
82
+ tokenizer = AutoTokenizer.from_pretrained(BASE_MODEL)
83
+ base = AutoModelForCausalLM.from_pretrained(BASE_MODEL,
84
+ dtype=torch.float16 if device != "cpu" else torch.float32,
85
+ device_map=device)
86
+ model = PeftModel.from_pretrained(base, ADAPTER)
87
+ model.eval()
88
+ ```
89
 
90
+ ### Single question
91
 
92
+ ```python
93
+ prompt = "How do I collect sensor data using the Edge Impulse data forwarder?"
94
+ inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
 
95
 
96
+ with torch.no_grad():
97
+ out = model.generate(**inputs, max_new_tokens=512,
98
+ do_sample=True, temperature=0.7, top_p=0.95,
99
+ pad_token_id=tokenizer.eos_token_id)
100
 
101
+ print(tokenizer.decode(out[0], skip_special_tokens=True))
102
+ ```
103
 
104
+ ### Chat template (multi-turn)
 
 
105
 
106
+ ```python
107
+ messages = [
108
+ {"role": "user", "content": "What is an impulse in Edge Impulse?"}
109
+ ]
110
+ formatted = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
111
+ inputs = tokenizer(formatted, return_tensors="pt").to(model.device)
112
 
113
+ with torch.no_grad():
114
+ out = model.generate(**inputs, max_new_tokens=512,
115
+ do_sample=True, temperature=0.7,
116
+ pad_token_id=tokenizer.eos_token_id)
117
 
118
+ print(tokenizer.decode(out[0], skip_special_tokens=True))
119
+ ```
 
 
 
 
 
 
 
120
 
121
  ---
122
 
123
+ ## Example Prompts
 
 
124
 
125
+ | Task | Prompt |
126
+ |---|---|
127
+ | Concept explanation | `"What is a DSP block in Edge Impulse?"` |
128
+ | API usage | `"How do I use the Edge Impulse Python SDK to upload data?"` |
129
+ | Deployment | `"How do I deploy a model to an Arduino Nano 33 BLE Sense?"` |
130
+ | Code generation | `"Write Python code to collect IMU data and upload it to Edge Impulse."` |
131
+ | Troubleshooting | `"Why is my Edge Impulse model showing high latency on the Cortex-M4?"` |
132
 
133
+ ---
 
 
134
 
135
+ ## Limitations
136
 
137
+ - Based on a 0.5B parameter base model — may struggle with complex multi-step reasoning
138
+ - Training data covers documentation as of mid-2026; newer APIs may not be represented
139
+ - May hallucinate undocumented Edge Impulse features
140
+ - Not suitable for safety-critical or production decision-making systems
141
+ - Validate generated code before running on real hardware
142
 
143
  ---
144
 
145
+ ## Related Models
146
 
147
+ | Model | Base | Status |
148
+ |---|---|---|
149
+ | This model | Qwen1.5-0.5B | ✅ Available |
150
+ | [eoinedge/edgeai-qwen2.5coder-1.5b-lora](https://huggingface.co/eoinedge/edgeai-qwen2.5coder-1.5b-lora) | Qwen2.5-Coder-1.5B-Instruct | 🔄 Training |
151
+ | [eoinedge/edgeai-qwen2.5coder-7b-lora](https://huggingface.co/eoinedge/edgeai-qwen2.5coder-7b-lora) | Qwen2.5-Coder-7B-Instruct | 🔄 Training |
152
+ | [eoinedge/arduino-qwen0.5-lora](https://huggingface.co/eoinedge/arduino-qwen0.5-lora) | Qwen1.5-0.5B | ✅ Available (Arduino docs) |
153
 
154
  ---
155
 
156
+ ## Citation
 
 
157
 
158
  ```bibtex
159
  @misc{edgeai-docs-embedding-qwen1.5-0.5b-instruct,
160
+ author = {Jordan, Eoin},
161
+ title = {edgeai-docs-embedding-qwen1.5-0.5b-instruct},
162
+ year = {2026},
163
+ publisher = {Hugging Face},
164
  howpublished = {\url{https://huggingface.co/eoinedge/edgeai-docs-embedding-qwen1.5-0.5b-instruct}}
165
+ }
166
+ ```