XiaoChuNeng: A Pocket-Sized Energy Expert That Lives in Your GarageWhy I Built ThisLast winter, my parents paid ¥3,200 on electricity. The number shocked me. Our rooftop had been sitting empty for three years. I started Googling "how much does solar save" and got buried in ads, fake calculators, and conflicting forum posts. Every site wanted my phone number. That's when I realized: the people who need this advice most are the people who can't tell a good answer from a paid promotion. So I built XiaoChuNeng — a 3B-parameter language model, fine-tuned on real energy storage data, that runs entirely on a laptop in my parents' house. No cloud. No subscription. No salesperson. What It DoesAsk it a question. Get an expert answer. Offline. "100 度电配多大储能?" — 3 seconds later, a calculation. "峰时 0.8 元谷时 0.3 元,五年能回本吗?" — 3 seconds later, a payback analysis. "今天绵阳天气怎么样?" — Connected to live sensors, the system tells you whether to charge or discharge your battery. The agent talks like an engineer because it was trained on engineer conversations — 565 Q&A pairs I curated from real installer workflows, regulatory documents, and technical reports. How I Built ItThe architecture is deliberately small. I have constraints: a single RTX 5070 laptop (8GB VRAM), 9 LiFePO4 batteries, an inverter, and one solar panel. Everything has to fit in my garage. The Stack

┌─────────────────────────────────────────────────────────┐ │ Layer Tech Why │ ├─────────────────────────────────────────────────────────┤ │ LLM Qwen2.5-3B Local, free │ │ Fine-tuning QLoRA (4-bit) Fits in 8GB │ │ LoRA rank 16 Balanced │ │ Training data 565 Q&A pairs Curated, real │ │ Inference transformers Native PyTorch │ │ Vector DB ChromaDB RAG for Kb │ │ Embeddings BGE-small-zh-v1.5 Chinese-tuned │ │ Hardware bridge ESP32 + MQTT Real control │ │ Hardware 8× LiFePO4 cells 25.6V pack │ │ Inverter Pure sine wave AC output │ │ Solar Mono-Si panel DC input │ └─────────────────────────────────────────────────────────┘

The Math Behind the Payback CalculationThe core formula the model learned to apply: [ \text{Annual Savings} = E_{daily} \times 365 \times (P_{peak} - P_{valley}) \times \eta ]Where: $E_{daily}$ = daily energy throughput (kWh) $P_{peak}, P_{valley}$ = peak and valley electricity prices (¥/kWh) $\eta$ = round-trip efficiency (typical $\eta = 0.85$ for home systems) The static payback period: [ T_{payback} = \frac{C_{invest}}{S_{annual} - C_{O&M}} ]Where $C_{invest}$ is upfront cost and $C_{O&M}$ is annual maintenance. For my parents' house: $E_{daily} = 10$ kWh, $P_{peak} = 0.8$, $P_{valley} = 0.3$, $\eta = 0.85$: [ S_{annual} = 10 \times 365 \times (0.8 - 0.3) \times 0.85 = ¥1{,}551.25 ]If $C_{invest} = ¥12{,}000$ and $C_{O&M} = ¥200$: [ T_{payback} = \frac{12{,}000}{1{,}551.25 - 200} \approx 8.9 \text{ years} ]The model learned to walk users through these numbers in plain Chinese, not just dump formulas. What I Learned1. Small models can be experts, not just know-it-allsThe base Qwen2.5-3B is a generalist. It can talk about cooking, history, and quantum mechanics. But it gave vague answers about battery sizing. After fine-tuning on 565 Q&As, it doesn't know more — it knows exactly the right things for energy storage. Training loss dropped from 2.1 → 1.3 over 3 epochs, but more importantly, the model stopped hallucinating technical specs.

  1. Privacy is a feature, not a constraintWhen I told my dad the system runs entirely on our laptop, he asked: "So when we lose internet, it still works?" Yes. That single property — offline-first — is what made the project real, not just a demo. During a typhoon last year, our neighborhood lost power for 6 hours. The batteries kept the fridge running. The AI agent, queried over local WiFi, told us how much runtime we had left.
  2. Hardware is where software gets honestA 3B model giving wrong ROI advice is annoying. A 3B model telling you to overcharge a LiFePO4 pack is dangerous. Connecting the agent to real batteries via ESP32 and MQTT forced me to add safety constraints, SOC limits, and fail-safes. The result: the AI doesn't just talk about energy — it has to respect the physical limits of the system it controls. The ChallengesChallenge 1: My laptop kept crashing during trainingFine-tuning pushed the GPU to 100%. After 20 minutes, the laptop would thermal-throttle and crash. Solution: I moved training to a cloud GPU. The first cloud attempt failed — pip couldn't resolve version conflicts between PyTorch 2.1 and the latest transformers. I tried three different mirrors, hit timeouts, switched instances. What I learned: version pinning isn't optional. Document everything. Challenge 2: The model got "stupid" after fine-tuningFirst version: I over-trained. 5 epochs on 565 samples → the model forgot how to say "hello." Solution: dropped to 3 epochs, added a small general-purpose dataset, monitored loss vs. perplexity trade-off. The lesson: fine-tuning a small model is like tutoring a student — too much drilling and they lose the joy of learning. Challenge 3: Making the Agent useful offlineMost LLM apps assume internet. Mine can't. The agent had to handle tool calling, knowledge retrieval, and number crunching — all without external services. I built a local RAG pipeline over 34 industry documents, plus direct API calls to 5 calculation functions. When a question arrives, the agent plans, retrieves, calculates, and answers in one local inference pass. What's NextThis is the start. Three more things I'm building: A real-time dashboard showing battery SOC, solar generation, and grid flow on a small screen in the kitchen Voice interface so my parents can ask questions without typing A community knowledge base where installers can contribute Q&As to improve the next generation of the model The dream is simple: every home with solar should have its own expert, on its own hardware, in its own language. Built with one developer, one laptop, one cloud GPU rental, and 565 carefully written training examples.

Built With

  • bge
  • chromadb
  • esp32
  • fastapi
  • huggingface
  • lora
  • mqtt
  • peft
  • python
  • pytorch
  • qlora
  • qwen2.5-3b
  • streamlit
  • transformers
Share this project:

Updates