Smart-Home Energy SLM (Qwen3 architecture, trained from scratch)
A 109M-parameter small language model that answers short questions about household electricity readings. It
has the Qwen3 architecture (grouped-query attention with per-head q/k RMSNorm, SwiGLU, RMSNorm, RoPE) and was
trained from random weights. No pretrained weights were used; only the Qwen/Qwen3-8B tokenizer was borrowed.
It was trained on the large configuration of
Design-Thinking-SLM/smart-home-energy-slm:
148,363 question–answer pairs built from one Belgian house (UCI Appliances Energy Prediction) and 20 UK homes (REFIT).
What it does:
- computes costs and unit conversions, classifies load levels, flags spikes, and gives next-step and next-hour forecasts from readings quoted in the question;
- says "cannot be determined" when the data cannot answer: occupancy, which appliance was running, faults, tariffs, missing sensors;
- rejects false premises ("the appliances peaked at 900 Wh" when no reading reached it).
It only understands questions phrased like the dataset's prompts. It has never seen general English, so free-form chat produces broken text.
Files
| File | What it is |
|---|---|
model.safetensors, config.json, tokenizer files | Standard Qwen3ForCausalLM (float32) for transformers |
energy-slm-f16.gguf, Modelfile | GGUF (float16, 379 MB) and recipe for Ollama / llama.cpp |
template, params | Prompt template and settings Ollama applies when running from hf.co/... |
original/ | The PyTorch checkpoint from the training notebook (qwen3_slm.pt), its config, and the executed notebook |
scripts/ | export_qwen3_to_hf.py (checkpoint → Hugging Face), export_hf_to_gguf.py (→ GGUF), check_ollama.py |
eval/ | results.json (all evaluation statistics), answers_v2.jsonl (3,956 test answers) |
The training notebook scales token embeddings by √512, which Hugging Face Qwen3 does not do. The conversion folds
that scale into an untied input embedding (tie_word_embeddings: false). Logits match the original model to
within 1.5 × 10⁻⁵.
Use
Ollama
From the Ollama library page:
ollama run ojaschaudhary20/energy-slm
Or directly from this repository:
ollama run hf.co/Design-Thinking-SLM/smart-home-energy-qwen3-scratch
Or build it yourself:
hf download Design-Thinking-SLM/smart-home-energy-qwen3-scratch energy-slm-f16.gguf Modelfile --local-dir energy-slm
cd energy-slm
ollama create energy-slm -f Modelfile
ollama run energy-slm
Then ask, for example:
Electricity costs €0.35 per kWh. At 2016-05-18 13:20 the appliances used 90 Wh in 10 minutes. What did that interval cost?
All three send only the latest message, because the model was trained on single questions, and use greedy decoding.
transformers
from transformers import AutoModelForCausalLM, AutoTokenizer
repo = "Design-Thinking-SLM/smart-home-energy-qwen3-scratch"
tok = AutoTokenizer.from_pretrained(repo)
model = AutoModelForCausalLM.from_pretrained(repo)
question = "Appliances: 250 Wh at 2016-05-18 19:10. Is that unusually high?"
text = tok.apply_chat_template([{"role": "user", "content": question}], tokenize=False, add_generation_prompt=True)
ids = tok(text, return_tensors="pt").input_ids
out = model.generate(ids, max_new_tokens=160, do_sample=False)
print(tok.decode(out[0, ids.shape[1]:], skip_special_tokens=True))
Prompt format (no system turn):
<|im_start|>user
{question}<|im_end|>
<|im_start|>assistant
Training
| Layers / width / FFN | 8 / 512 / 2,048 |
| Heads / KV groups / head dim | 8 / 4 / 64 |
| Context | 448 tokens |
| Parameters | 109.1M (77.7M are the 151,669-entry embedding table) |
| Loss | cross-entropy on answer tokens only |
| Optimiser | AdamW (β = 0.9, 0.95; weight decay 0.1), lr 3e-4, 300 warm-up updates, cosine to 3e-5 |
| Batch | 8 × 4 gradient-accumulation steps, 72,000 steps (3.9 epochs) |
| Hardware / time | one RTX 5060 Laptop GPU (8 GB), 96.8 min, peak 4.6 GiB |
| Best validation loss | 0.0611 (answer tokens), step 69,000 |

Training and validation loss stay close throughout (0.053 and 0.067 at the end). The checkpoint with the best validation loss (step 69,000) is the one published.
Evaluation
The evaluation used 3,956 held-out test questions: up to 200 per (task, source) group, with greedy decoding.
Exact match requires the whole answer to equal the reference. The table gives 95% Wilson intervals, and compares
against the first version of this model, which was trained on the UCI-only corpus (default config) and scored
on the same questions.
| Task | Source | n | v1 (UCI only) | This model | 95% CI |
|---|---|---|---|---|---|
| false_premise | UCI | 200 | 98.0% | 100.0% | 98.1–100 |
| level_classify | UCI | 156 | 100.0% | 100.0% | 97.6–100 |
| lights_activity | UCI | 200 | 100.0% | 100.0% | 98.1–100 |
| noise_features | UCI | 200 | 100.0% | 100.0% | 98.1–100 |
| unanswerable | UCI | 200 | 100.0% | 100.0% | 98.1–100 |
| units_cost | UCI | 200 | 95.0% | 95.5% | 91.7–97.6 |
| time_features | UCI | 200 | 50.5% | 87.5% | 82.2–91.4 |
| time_features | REFIT | 200 | 11.5% | 61.5% | 54.6–68.0 |
| window_stats | REFIT | 200 | 13.0% | 51.5% | 44.6–58.3 |
| room_compare | UCI | 200 | 45.0% | 46.5% | 39.7–53.4 |
| spike_check | REFIT | 200 | 5.0% | 45.0% | 38.3–51.9 |
| spike_check | UCI | 200 | 15.5% | 38.5% | 32.0–45.4 |
| window_stats | UCI | 200 | 18.0% | 37.0% | 30.6–43.9 |
| outdoor_weather | UCI | 200 | 21.5% | 25.0% | 19.5–31.4 |
| daily_profile | REFIT | 200 | 1.5% | 14.5% | 10.3–20.0 |
| daily_profile | UCI | 200 | 0.0% | 5.0% | 2.7–9.0 |
| pooled | UCI | 2,356 | 61.2% | 69.0% | 67.1–70.9 |
| pooled | REFIT | 800 | 7.8% | 43.1% | 39.7–46.6 |
Exact McNemar test, v1 vs this model: p < 10⁻³³ on UCI questions and p < 10⁻⁸⁰ on REFIT questions.
- No hallucinated answers: all 364 unanswerable test questions were refused, and none of the 3,592 answerable ones were (95% upper bounds of 1.0% and 0.1%).
- Errors are mostly arithmetic: 82% of wrong answers have the right wording with a wrong number. Accuracy
falls as more numbers appear in the prompt: on
window_stats, from 54% (fewer than 20 numbers) to 26% (40 or more). - Forecasts are no better than persistence. Mean absolute error in Wh, compared with repeating the last value:
| Task | Source | Model | Persistence | Window mean |
|---|---|---|---|---|
| next reading | UCI | 28.4 | 31.8 | 35.5 |
| next reading | REFIT | 39.4 | 33.4 | 46.9 |
| next hour (total) | UCI | 185.4 | 195.5 | 188.8 |
| next hour (total) | REFIT | 202.4 | 189.4 | 204.5 |
None of the differences from persistence has a bootstrap 95% interval that excludes zero, except REFIT next reading, where the model is worse (+6.0 Wh [+0.4, +12.1]).
Limitations
- Exact arithmetic over many numbers is unreliable; a deployment should compute sums in code.
- Room, weather and lighting questions come from one house over winter and spring only.
- It is not a forecaster you should rely on, and not a tool for billing or safety decisions. It is a course project.
Data and citation
- Candanedo, Feldheim & Deramaix (2017). Data driven prediction models of energy use of appliances in a low-energy house. Energy and Buildings 140, 81–97. CC BY 4.0.
- Murray, Stankovic & Stankovic (2017). An electrical load measurements dataset of United Kingdom households from
a two-year longitudinal study. Scientific Data 4, 160122. CC BY 4.0. Via
Jainam03/RESCAST-100k-REFIT.
Built by team Design-Thinking-SLM (Jain University) for the Design Thinking course: Ojas Chaudhary, Parameswar Sahoo, Omsai, Nandhakishore.