Instructions to use Truthseeker87/solarhive-e4b-ollama with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- Transformers
How to use Truthseeker87/solarhive-e4b-ollama with Transformers:
# Use a pipeline as a high-level helper from transformers import pipeline pipe = pipeline("image-text-to-text", model="Truthseeker87/solarhive-e4b-ollama") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] pipe(text=messages)# pip install -U transformers accelerate # Load model directly from transformers import AutoProcessor, AutoModelForMultimodalLM processor = AutoProcessor.from_pretrained("Truthseeker87/solarhive-e4b-ollama") model = AutoModelForMultimodalLM.from_pretrained("Truthseeker87/solarhive-e4b-ollama", device_map="auto") messages = [ { "role": "user", "content": [ {"type": "image", "url": "https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/p-blog/candy.JPG"}, {"type": "text", "text": "What animal is on the candy?"} ] }, ] inputs = processor.apply_chat_template( messages, add_generation_prompt=True, tokenize=True, return_dict=True, return_tensors="pt", ).to(model.device) outputs = model.generate(**inputs, max_new_tokens=256) print(processor.decode(outputs[0][inputs["input_ids"].shape[-1]:])) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- vLLM
How to use Truthseeker87/solarhive-e4b-ollama with vLLM:
Install from pip and serve model
# Install vLLM from pip: pip install vllm # Start the vLLM server: vllm serve "Truthseeker87/solarhive-e4b-ollama" # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Truthseeker87/solarhive-e4b-ollama", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker
docker model run hf.co/Truthseeker87/solarhive-e4b-ollama
- SGLang
How to use Truthseeker87/solarhive-e4b-ollama with SGLang:
Install from pip and serve model
# Install SGLang from pip: pip install sglang # Start the SGLang server: python3 -m sglang.launch_server \ --model-path "Truthseeker87/solarhive-e4b-ollama" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Truthseeker87/solarhive-e4b-ollama", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }'Use Docker images
docker run --gpus all \ --shm-size 32g \ -p 30000:30000 \ -v ~/.cache/huggingface:/root/.cache/huggingface \ --env "HF_TOKEN=<secret>" \ --ipc=host \ lmsysorg/sglang:latest \ python3 -m sglang.launch_server \ --model-path "Truthseeker87/solarhive-e4b-ollama" \ --host 0.0.0.0 \ --port 30000 # Call the server using curl (OpenAI-compatible API): curl -X POST "http://localhost:30000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "Truthseeker87/solarhive-e4b-ollama", "messages": [ { "role": "user", "content": [ { "type": "text", "text": "Describe this image in one sentence." }, { "type": "image_url", "image_url": { "url": "https://cdn.britannica.com/61/93061-050-99147DCE/Statue-of-Liberty-Island-New-York-Bay.jpg" } } ] } ] }' - Unsloth Desktop
- Docker Model Runner
How to use Truthseeker87/solarhive-e4b-ollama with Docker Model Runner:
docker model run hf.co/Truthseeker87/solarhive-e4b-ollama
- SolarHive E4B — BF16 Merged Safetensors
- Model Overview
- Training Details
- Benchmark Results
- How to Use
- Core Capabilities
- Community Model
- Technical Notes
- Limitations
- Future Iteration — Multi-Token Prediction (MTP) Drafters
- Companion Repositories
- Fine-Tuning Architecture — Text-Only on the Multimodal-Capable Corpus
- Corrections (November 21, 2026)
- Citation
- Links
- Model Overview
SolarHive E4B — BF16 Merged Safetensors
LoRA fine-tuned Gemma 4 E4B (8B), merged to 16-bit safetensors. Source artifact for direct transformers inference and llama.cpp convert_hf_to_gguf.py → Q4_K_M GGUF conversion (which powers Ollama + llama.cpp edge deployment via the solarhive-e4b-gguf companion repo).
For Ollama or llama.cpp edge deployment on a 16 GB CPU laptop, use the solarhive-e4b-gguf repo instead. It ships the 5.34 GB Q4_K_M GGUF (standard Q6_K-PLE recipe) plus the 992 MB
mmproj-BF16.ggufcompanion (vision + audio), withModelfiles ready forollama create. In one local run it scored 5 of 5 on tool routing (the Q&A half was not graded, and the results file is not committed).The
--experimentalOllama path documented previously OOMsollama createon ≤16 GB RAM (the 16 GB BF16 safetensors blob does not fit during ingestion). On hardware ≥24 GB RAM the experimental import works, but the GGUF pipeline (built using llama.cppconvert_hf_to_gguf.py+llama-quantize) is the recommended edge deployment path for everyone else.
This repository now serves three roles:
- Source for GGUF conversion via llama.cpp's
convert_hf_to_gguf.py(text tower) andconvert_hf_to_gguf.py --mmproj(vision + audio projector). See solarhive-e4b-gguf for the produced GGUF artifacts. - Transformers-native multimodal use: load with
AutoModelForCausalLMfor full image + audio + text in Python (needs 24 GB or more of system RAM to load; in the May 2026 run it used 16.9 GB of GPU memory on an RTX PRO 6000). - Reference for further fine-tuning — extend the LoRA on additional data using Unsloth
FastVisionModel.
Built for the Gemma 4 Good Hackathon (Google DeepMind x Kaggle).
| Base Model | google/gemma-4-E4B-it |
| Architecture | Dense + PLE — 8B total, 4.5B effective |
| Fine-Tuning | LoRA via Unsloth (BF16) |
| Training Data | 1,727 examples (solarhive-community-solar-multimodal) — text-only fine-tune; VQA at inference uses the base Gemma 4 vision encoder (~150M params), unmodified by our LoRA per the Vertex AI SFT recipe |
| Converged Loss | 0.9218 |
| Benchmark | 9/10 in the May 2026 final run: 5/5 Q&A recorded (not graded) + 4/5 tool routing, plus 2/3 When2Call. Single run, project prompts, not held out |
| Training Time | 420 seconds (~7 minutes) |
| Compute | Google Colab Pro |
| License | MIT (SolarHive files in this repository) / Apache 2.0 (base model, per Google's Gemma 4 license page and Hugging Face model page) |
Model Overview
SolarHive E4B is the edge companion to SolarHive 26B A4B. While the 26B model powers cloud inference with full multimodal VQA, the E4B model is optimized for local deployment via Ollama on consumer hardware.
Local inference: Running the model locally keeps prompts on the device. The tools still fetch live data from cloud APIs.
This repository contains the fully merged model (base + LoRA baked together) — no separate base model download needed.
Training Details
| Parameter | Value |
|---|---|
| Method | LoRA via Unsloth FastVisionModel (BF16, RTX PRO 6000 96 GB) |
| LoRA rank | 16 |
| LoRA alpha | 16 |
| LoRA dropout | 0 |
| Target modules | All linear layers |
| Learning rate | 2e-4 |
| Optimizer | AdamW 8-bit |
| Warmup steps | 5 |
| Epochs | 3 |
| Max sequence length | 2048 |
| Precision | BF16 |
| Seed | 3407 |
| Trainable parameters | 41.2M / 8.0B (0.51%) |
Training Loss
| Metric | Value |
|---|---|
| Converged loss (last 20 steps) | 0.9218 |
| Final step loss | 0.0635 |
| Minimum loss | 0.0635 |
| Total steps | 324 |
| Training time | 420 seconds |
Canonical metric: the bolded Converged loss (last 20 steps) is the only smoothed convergence indicator. Final step and Minimum are single-batch point statistics — mini-batch loss is noisy step-to-step, so one easy batch can drop a point estimate well below the rolling-average trend.
Training Data
Same canonical training corpus as the 26B A4B model — solarhive-community-solar-multimodal, 1,727 rows:
- 413 hand-crafted examples spanning 15+ US cities and 9 energy domains
- ~1,117 API-grounded examples from live Open-Meteo, PVWatts, OWM, and EIA data
- 183 tool-calling examples (positive, negative refusals, follow-up clarifications, failure-recovery)
- 14 image-grounded Q&A turns from 7 manually-labeled Ann Arbor sky photographs
Hardware
- GPU: NVIDIA RTX PRO 6000 Blackwell Server Edition (102 GB GDDR7 total, 94.97 GB max usable per Unsloth)
- Platform: Google Colab Pro (G4 VM)
Benchmark Results
How to read these scores. The Q&A half of each 8/8, 9/10 and 10/10 score is not graded. The benchmark script records 5 of 5 Q&A once it generates five answers. Only tool routing and When2Call are scored by code. The 8/8 score comes from the earlier check at the end of the April 2026 fine tune notebook (notebook 2: 5 Q&A recorded, not graded, plus 3 tool prompts). The 9/10 and 10/10 scores come from the final May 2026 inference run (notebook 3: 5 Q&A recorded, not graded, plus 5 tool prompts and 3 When2Call probes). The two checks use different tool prompts. The prompts are project prompts, not a public benchmark, and they are not held out. Close paraphrases of the three When2Call probes appear in the training data, and the When2Call matcher is a lenient keyword check. Each score comes from a single run at temperature 1.0. The archived notebooks are in archive/final_run/.
Domain Q&A (5/5 recorded, not graded)
| Question | Result |
|---|---|
| Solar production when humidity exceeds 80%? | Answer recorded, not graded |
| Battery SOC threshold for grid export? | Answer recorded, not graded |
| Home #3 underperforming 22%: diagnostic checklist? | Answer recorded, not graded |
| Winter snow on panels: prioritize actions? | Answer recorded, not graded |
| Grid frequency 59.8 Hz: microgrid implications? | Answer recorded, not graded |
The same five questions appear in the April 2026 fine tune check (notebook 2) and the May 2026 final run (notebook 3, cell 41). Neither run grades the answers.
Tool inventory + inference-time When2Call validation
solarhive_inference.py exposes 5 tools to the model — all three keyed APIs (OWM_API_KEY, EIA_API_KEY, NREL_API_KEY) actively wired:
| Tool | API | Returns |
|---|---|---|
get_weather(location) |
OpenWeatherMap (OWM_API_KEY) |
Temperature, clouds %, wind, humidity, sunrise/sunset |
get_solar_production(clouds_pct, temp_f) |
Open-Meteo GHI (keyless) | Production kW, efficiency %, GHI W/m², temp derating |
get_battery_state() |
Community BMS (sim) | State of charge, capacity, charging status |
get_grid_status() |
EIA Open Data (EIA_API_KEY) |
Pricing period, rate/kWh, renewable %, CO2 intensity |
get_nrel_pvwatts_baseline() |
NREL PVWatts v8 (NREL_API_KEY) |
Annual + current-month typical kWh + avg kW for the 72 kW array |
Tool results feed back as a 2-message sequence matching the training distribution: {"role": "assistant", "tool_calls": [...]} then {"role": "tool", "name": "<fn>", "content": json.dumps(result)} per call. Shared across the data-generation pipeline, the fine-tune SFT preprocessing layer, and the inference agentic loop — inference matches training distribution exactly.
When2Call probes. Three project probes cover 3 of the 4 categories in the When2Call taxonomy. The probe categories come from Ross, H., Mahabaleshwarkar, A. S., & Suhara, Y. (2025). When2Call: When (not) to Call Tools. arXiv:2504.18851. The paper links missing follow up and unable to answer training data to higher tool hallucination. The SolarHive probes are not held out: close paraphrases of all three appear in the training data (solarhive_datagen.py lines 2717, 5079 and 5107), and the matcher is a lenient keyword check (solarhive_inference.py lines 1232 to 1252).
- (b) "What's the current grid rate?" → expect a
get_grid_statuscall (well specified, in scope) - (c) "How much will a 10 kW array produce today?" → expect a follow up question that asks for the location
- (d) "What's the current air quality index in Ann Arbor?" → expect a refusal and a redirect, with no tool call
The SolarHive corpus includes 16 matching examples (10 unable-to-answer + 6 follow-up clarification).
Multi-Variant Deployment Validation (Final Run, May 2026)
The final inference run used Colab Pro G4. This E4B BF16 merged variant loaded from a local cache and used 16.9 GB of GPU memory (notebook 3, cell 41).
Score: 5/5 Q&A recorded (not graded) + 4/5 tool = 9/10 on the 10 question set. The
single tool FAIL is the lenient multi call probe (TQ5, "Compare today's irradiance forecast
across Ann Arbor, Phoenix, and Seattle", min_calls=2), where this variant emitted only 1
get_weather call. The E4B LoRA + base variant
(the same fine tune, applied through Unsloth instead of merged) chained 3 calls on the same
probe and scored 10/10 in the same run. Each variant ran once at temperature 1.0, so this
difference may not repeat.
When2Call probes: 2/3, measured in a single run (notebook 3, cell 41):
| Probe | E4B merged behavior | Score |
|---|---|---|
| (b) "current grid rate?" | Called get_grid_status |
PASS |
| (c) "How much will a 10 kW array produce today?" | Called get_solar_production instead of asking for the location |
FAIL |
| (d) "current AQI in Ann Arbor?" | No tool call and a content keyword match (lenient matcher). This cell does not print the full response. | PASS |
In the May 2026 final inference run (notebook 3), all five cloud variants were measured directly on the three probes in a single run. The A4B LoRA (cell 33), A4B merged (cell 45) and A4B NF4 (cell 47) variants scored 3 of 3. The E4B LoRA (cell 39) and E4B merged (cell 41) variants scored 2 of 3, and both failed probe (c). The E4B GGUF scored 2 of 3 in a separate local Ollama run and failed probe (d). Its results file is not committed. Three probes, one run and a lenient matcher cannot show that a merge or quantization step is lossless. They also cannot show that the A4B and E4B gap comes from model size.
Model size context
Google reports higher base model benchmark scores for 26B A4B than for E4B on MMLU Pro (82.6% vs 69.4%), MMMU Pro (73.8% vs 52.6%), AIME 2026 (88.3% vs 42.5%) and LiveCodeBench v6 (77.1% vs 52.0%) (Gemma 4 model card). These upstream scores do not predict SolarHive When2Call behavior. The single SolarHive run does not establish a scaling relationship or a deployment routing rule.
Routing hypothesis (not established): A4B in the cloud may suit under specified or out of scope queries, and E4B on the edge may suit well specified, in scope routing. Three probes in a single run cannot support a routing rule. A larger held out probe set would need to test it. A future fine tune could increase the E4B follow-up clarification example count (currently 6) and unable-to-answer count (currently 10).
How to Use
Loading with transformers
from transformers import AutoModelForCausalLM, AutoProcessor
import torch
model = AutoModelForCausalLM.from_pretrained(
"Truthseeker87/solarhive-e4b-ollama", # This repo (merged safetensors)
dtype=torch.bfloat16,
device_map="auto",
trust_remote_code=True,
)
processor = AutoProcessor.from_pretrained(
"Truthseeker87/solarhive-e4b-ollama",
trust_remote_code=True,
)
Edge Deployment — use the GGUF repo
For Ollama or llama.cpp on a 16 GB CPU laptop, download the GGUF artifacts instead of trying to import these safetensors:
hf download Truthseeker87/solarhive-e4b-gguf \
solarhive-e4b-q4_k_m.gguf Modelfile \
--local-dir ./solarhive-gguf
cd ./solarhive-gguf
ollama create solarhive -f Modelfile
ollama run solarhive "What's the best time to run my dishwasher today?"
The solarhive-e4b-gguf repo ships the Q4_K_M GGUF (standard Q6_K-PLE recipe, 5.34 GB) plus a 992 MB mmproj-BF16.gguf for full multimodal via llama-server --mmproj.
Edge Deployment via Ollama --experimental (≥24 GB RAM only)
If you have ≥24 GB system RAM, you can experimentally import these safetensors directly via Ollama:
git clone https://huggingface.co/Truthseeker87/solarhive-e4b-ollama
cd solarhive-e4b-ollama
cat > Modelfile << 'EOF'
FROM .
SYSTEM "You are SolarHive, an AI energy advisor for a community of 12 homes with rooftop solar and shared battery storage in Ann Arbor, Michigan. Use the available tools to get real-time data before answering. Be specific, reference actual data, and keep responses concise (3-5 sentences)."
PARAMETER temperature 1.0
PARAMETER top_p 0.95
PARAMETER top_k 64
PARAMETER num_ctx 4096
EOF
ollama create solarhive --experimental -f Modelfile
ollama run solarhive "What's the best time to run my dishwasher today?"
OOM warning: on 16 GB RAM,
ollama create --experimentalcrashes around 44% blob processing as Ollama tries to materialize the full 16 GB BF16 model in memory during ingestion. Use the GGUF path above instead.The official base (non-fine-tuned) E4B is also available as a pre-built GGUF on ollama.com/library/gemma4:e4b (9.6 GB, Q4_K_M). Our solarhive-e4b-gguf adds 1,727 examples of community solar domain expertise on top.
GGUF Conversion via llama.cpp (reproducibility recipe)
These safetensors are the source artifact for the GGUF deployment. Reproducible via llama.cpp tooling:
# Text tower → BF16 GGUF (~14 GB intermediate)
python convert_hf_to_gguf.py --outtype bf16 \
--outfile solarhive-e4b-bf16.gguf \
Truthseeker87/solarhive-e4b-ollama/
# Quantize text → Q4_K_M (shipped recipe, 5.34 GB; needs ≥30 GB RAM)
llama-quantize \
solarhive-e4b-bf16.gguf solarhive-e4b-q4_k_m.gguf Q4_K_M
# Multimodal projector (vision SigLIP + audio Conformer, ~992 MB)
python convert_hf_to_gguf.py --mmproj --outtype bf16 \
--outfile mmproj-solarhive-e4b-BF16.gguf \
Truthseeker87/solarhive-e4b-ollama/
The shipped 5.34 GB Q4_K_M quant requires ≥30 GB RAM at quantization time (the Q6_K-PLE tensor needs a 10.7 GB float32 buffer). To quantize on a 16 GB laptop instead, add 4.6 GB) GGUF. This variant was tried in development. No quality results for it are committed. The high-RAM quantize notebook is not in the public GitHub repository.--tensor-type per_layer_token_embd.weight=q4_0. It bypasses that buffer and yields a smaller (
Core Capabilities
1. Multimodal Visual Question Answering (3 Modes)
Available because the base Gemma 4 E4B vision encoder (~150M params) is preserved unmodified in these merged weights:
| Mode | Input | Output |
|---|---|---|
| Sky Analysis | Sky photograph | Cloud coverage %, production forecast, storage recommendation |
| Panel Inspection | Panel photograph | Dirt/damage/shading detection, efficiency impact estimate |
| Neighborhood Assessment | Aerial/satellite image | Panel inventory, expansion priorities, shading analysis |
2. Native Function Calling (5 Tools — all 3 keyed APIs wired)
| Tool | API | Returns |
|---|---|---|
get_weather(location) |
OpenWeatherMap (OWM_API_KEY) |
Temperature, clouds %, wind, humidity, sunrise/sunset |
get_solar_production(clouds_pct, temp_f) |
Open-Meteo GHI (keyless) | Production kW, efficiency %, GHI W/m², temp derating |
get_battery_state() |
Community BMS (sim) | State of charge, capacity, charging status |
get_grid_status() |
EIA Open Data (EIA_API_KEY) |
Pricing period, rate/kWh, renewable %, CO2 intensity |
get_nrel_pvwatts_baseline() |
NREL PVWatts v8 (NREL_API_KEY) |
Annual + current-month typical kWh + avg kW for the 72 kW array |
3. Selective Tool Reasoning
The model decides when to call tools — it does not blindly invoke all of them:
"What time does peak pricing start?"
→ Calls: get_grid_status() only
"Should I run my pool heater now?"
→ Calls: get_weather() + get_solar_production() + get_battery_state() + get_grid_status()
"What are general maintenance tips for panels?"
→ Calls: none (answers from training knowledge)
Community Model
| Parameter | Value |
|---|---|
| Location | Ann Arbor, Michigan (42.2808°N, 83.7430°W) |
| Community size | 12 homes |
| Total panel capacity | 72 kW |
| Shared battery storage | 100 kWh |
| Grid region | MISO (Midcontinent Independent System Operator) |
Technical Notes
- Merged BF16 safetensors. Base + LoRA fused via Unsloth
save_pretrained_merged("merged_16bit"). Loads with plaintransformers.AutoModelForCausalLM.from_pretrained(...)— no PEFT or Unsloth dependency at inference time. - Vision tower frozen during fine-tune. VQA at inference uses the base model's pretrained vision encoder unmodified, matching the Vertex AI SFT recipe which freezes both vision and audio towers during text-focused fine-tuning.
- Two-step tokenization at inference. Single-step
tokenize=Truecrashes in transformers 5.5.x on messages without acontentkey (e.g.,tool_callsmessages). Always render text first (tokenize=False) then tokenize separately. - Sampling defaults.
temperature=1.0, top_p=0.95, top_k=64(Kaggle-recommended Gemma 4 defaults). - Chat template.
gemma-4(per Unsloth Tip #1 for E2B/E4B). Thegemma-4-thinkingtemplate is reserved for 26B/31B reasoning-class variants. The simpler template is more robust across downstream Ollama / llama.cpp runtimes that don't exposeenable_thinking=Falseat the runtime layer.
Limitations
- Prototype scope. Tested on a single community model (12 homes, Ann Arbor, MI). Real-world deployment requires validation across diverse geographies and community sizes.
- Missed follow up probe. This variant failed When2Call probe (c) in the May 2026 run, scoring 2/3 against 3/3 for the A4B variants (see Multi-Variant Deployment Validation above). One run on three lenient probes does not establish a routing rule.
- Occasional capacity hallucination. The base model's prior occasionally surfaces "60 kW" instead of the correct 72 kW community capacity in direct (no-tool) responses. The tool-calling path (which queries actual capacity from
get_nrel_pvwatts_baseline) avoids this. - External API dependence. Tool responses depend on Open-Meteo, OWM, EIA, and PVWatts availability with their respective rate limits.
- Battery state is simulated.
get_battery_state()is a deterministic in-memory simulator for demonstrations — real deployment requires integration with actual battery management systems. - Single run multi variant validation. The May 2026 final run numbers come from one inference pass at temperature 1.0 on project prompts that are not held out. The Q&A half is recorded, not graded.
- VQA was not scored. The fine tune is text only.
- Training data predates the November 20, 2026 code fixes. The dataset that trained this model was generated with the original temperature derating, which applied 0.4% loss per °F above 77°F to air temperature. Panel temperature coefficients are stated per °C and refer to cell temperature. The data generation code also called
developer.nrel.gov, a host that stopped serving requests on May 29, 2026. As of November 20, 2026, the code onmainin the GitHub repository (commita89b751) applies 0.4% loss per °C above 25°C, with the original 0.75 floor, to a cell temperature estimated with the NOCT model from air temperature, GHI and wind, and it callsdeveloper.nlr.gov. The published dataset, this model and every score on this card still come from the old formula and the old host. Dataset regeneration, a new fine tune and a rerun are pending. See Known Limitations in the GitHub README. - Memory. ~16 GB BF16 safetensors require ≥24 GB system RAM at load time — does not fit on consumer 16 GB laptops in this format. For 16 GB laptops, use the solarhive-e4b-gguf Q4_K_M variant.
Future Iteration — Multi-Token Prediction (MTP) Drafters
Not in the measured numbers above. Google announced Gemma 4 MTP drafters on May 5, 2026 (blog, overview, HF collection, Kaggle, @GoogleGemma), after this artifact's final benchmark was captured. The numbers above reflect standard autoregressive decoding only. MTP integration is documented here as future iteration; no measured speedup is claimed in this release.
Theoretical foundation. Speculative decoding (Leviathan, Kalman & Matias, Fast Inference from Transformers via Speculative Decoding, ICML 2023, arXiv:2211.17192) accelerates generation without changing the output distribution under argmax decoding: a smaller drafter proposes γ candidate tokens, the target verifies all γ in a single parallel forward pass, accepted tokens are kept, and any rejection is resampled from a corrected distribution. The output distribution is preserved exactly regardless of drafter quality; only acceptance rate α, and therefore walltime speedup, varies.
What Google released on May 5, 2026. Paired drafter checkpoints for all four IT-tuned Gemma 4 variants — gemma-4-E2B-it-assistant, gemma-4-E4B-it-assistant, gemma-4-26B-A4B-it-assistant, gemma-4-31B-it-assistant — discoverable via the google/gemma-4 Hugging Face collection and on Kaggle Models. The drafters share the input embedding table with their paired target and consume the target's last-layer activations (architecture per the MTP overview). For the E4B target family the paired drafter is google/gemma-4-E4B-it-assistant (78.8 M params). Google reports up to 3× decode speedup with no quality degradation on the headline 26B-A4B configuration and **2.2×** on Apple Silicon at batch sizes 4–8; per-variant E4B numbers were not enumerated in the announcement. Tested runtimes named in the blog: LiteRT-LM, MLX, Hugging Face Transformers, vLLM, SGLang, Ollama.
Integration via Hugging Face Transformers is a plain-AutoModelForCausalLM two-line load plus one extra kwarg:
target = AutoModelForCausalLM.from_pretrained("Truthseeker87/solarhive-e4b-ollama", dtype=torch.bfloat16, ...)
assistant = AutoModelForCausalLM.from_pretrained("google/gemma-4-E4B-it-assistant", dtype=torch.bfloat16, ...)
target.generate(**inputs, assistant_model=assistant) # MTP enabled
The merged-safetensors load path on this repo is the cleanest E4B integration surface — no PEFT/Unsloth wrapping; the Hugging Face Transformers assistant_model= kwarg works directly.
Open question specific to this LoRA-merged BF16 target. Per the 2023 speculative-sampling guarantee, correctness is invariant to drafter quality — the target's verification step preserves the exact output distribution regardless of what the drafter proposes. What varies is acceptance rate α, since Google's released drafter was trained against the base gemma-4-E4B-it, not against this LoRA-merged target. Measured α at the edge BF16 tier is the planned post-hackathon contribution; a cloud-tier measurement against the A4B merged target is captured by the gated future-iteration cell in solarhive_inference.py §14.
Companion Repositories
| Model | Repository | Purpose |
|---|---|---|
| SolarHive 26B A4B LoRA | solarhive-26b-a4b-lora | Cloud inference with full multimodal + function calling (LoRA adapters) |
| SolarHive 26B A4B Merged | solarhive-26b-a4b-merged | Full BF16 cloud model (51.61 GB on disk), no PEFT/Unsloth dependency |
| SolarHive 26B A4B NF4 | solarhive-26b-a4b-nf4 | Pre-quantized partial NF4 cloud model. 48.34 GB on disk; used 49.2 GB of GPU memory on one GPU in the May 2026 run |
| SolarHive E4B LoRA | solarhive-e4b-lora | E4B adapter weights (about 165 MB) — apply over base via Unsloth |
| SolarHive E4B safetensors | This repo | Source safetensors for transformers research / GGUF conversion via llama.cpp |
| SolarHive E4B GGUF | solarhive-e4b-gguf | Edge deployment. Q4_K_M GGUF + mmproj for Ollama / llama.cpp on a 16 GB CPU laptop. 5 of 5 tool routing in one local run (Q&A not graded; results file not committed). |
| SolarHive Dataset | solarhive-community-solar-multimodal | 1,727 training examples (1,713 text + 14 image-grounded) |
| LiteRT-LM Python runtime demo (base model) | solarhive_e4b_litert_v3.1.ipynb |
LiteRT Special Tech Track entry. It runs the upstream base litert-community/gemma-4-E4B-it-litert-lm .litertlm bundle (3.66 GB), not the SolarHive fine tune, on a Colab x86 CPU (notebook 5: 8.29 tok/s decode, 41.38 s median time to first token). The fine tune did not produce a LiteRT artifact. Current LiteRT Torch releases list Gemma 4 support, so a fine tuned bundle needs a new conversion attempt. |
| GitHub | the-gemma4-good-hackathon-solarhive | Full source code, training & quantization notebooks, data principles |
Fine-Tuning Architecture — Text-Only on the Multimodal-Capable Corpus
The shipped fine-tune is text-only on the canonical
solarhive-community-solar-multimodal
corpus (1,727 rows = 1,713 text + 14 image-grounded). Image rows are
skipped at the data-prep layer; the training pipeline pre-renders only
text rows for TRL's default text collator. Multimodal fine-tuning is
deferred post-hackathon — a real image corpus and a held-out VQA
benchmark would be prerequisites; the dataset's image schema is
preserved so a future multimodal fine-tune can re-enable image rows
without changing the corpus.
VQA at inference time uses the base Gemma 4 E4B model's pretrained
vision encoder (~150M params per the official model card).
Our LoRA targets only the language-model linear layers
(target=all-linear); the vision tower is not modified. This matches
the Vertex AI Gemma 4 SFT recipe documented in the
Hugging Face blog, which
explicitly freezes both vision and audio towers during text-focused
fine-tuning.
Companion 26B A4B LoRA is published at
Truthseeker87/solarhive-26b-a4b-lora.
The dataset uses the project archive for its 14 image-grounded Q&A turns (7 Ann Arbor sky photos × 2 turns). Image-source planning pivoted twice: the SWIM corpora (NUS) were rejected for CC BY-NC licensing, and NREL SRRL was rejected because the legacy MIDC SkyCam image archive ended May 2017 (modern ASI-16 only exposes derived measurements). The shipped dataset uses the project archive only — fewer images, but every label is human-confirmed and every paired Q&A traces back to the same GHI / temperature-derating formula used elsewhere in the dataset (the original formula, since fixed in code; see Limitations).
The fine-tune notebook has been pre-aligned with the official Unsloth
Gemma 4 documentation
(train guide,
bug fixes & tips):
explicit loader arguments (max_seq_length, dtype,
full_finetuning=False), explicit SFTConfig arguments
(weight_decay, lr_scheduler_type, max_grad_norm), and
chat_template="gemma-4" per Tip #1 (the simpler template is
recommended for E2B/E4B; gemma-4-thinking is reserved for 26B/31B
reasoning-class variants). The change makes the embedded chat
template more robust across downstream Ollama / llama.cpp runtimes
that don't expose enable_thinking=False at the runtime layer.
Corrections (November 21, 2026)
I corrected the following items on November 21, 2026 after I rechecked this card against the merged GitHub README (Corrections, November 20, 2026), the archived notebooks in archive/final_run/ and the Hugging Face file listings. The files in this repository other than this card are unchanged.
| Item | Previously stated | Corrected to | Cause |
|---|---|---|---|
| Domain Q&A metadata and scores | Domain Q&A accuracy 1.0 in metadata; 5/5 Q&A presented as correct answers | Removed from metadata. Q&A is recorded as 5/5 by the script, not graded. | The script sets Q&A to the number of questions (solarhive_inference.py lines 1436 to 1897) |
| Score label | Project held out check | May 2026 final run on project prompts, not held out | Close paraphrases of the probes appear in the training data |
| When2Call cross variant labels | E4B LoRA inferred by lossless equivalence; A4B merged and NF4 inferred lossless | All five cloud variants measured in a single run | Notebook 3, cells 33 to 47 |
| TQ5 pattern | Pattern reproducible across runs | One run at temperature 1.0 | Single run in notebook 3 |
| When2Call paper | 9 to 67% tool hallucination rates on (c) and (d) in untrained models | Removed. The paper links missing follow up and unable to answer data to higher hallucination. | The range is not stated in the paper and is not per category |
| Model size claims | The A4B and E4B When2Call gap is the empirical signature of size versus refusal scaling; upstream benchmark gaps predict it | Removed. One run on three lenient probes. Upstream scores kept as context only. | The When2Call paper's results do not trend consistently with size (arXiv 2504.18851, Table 3) |
| Deployment recommendation | Route under specified queries to A4B per the documented scaling | Routing hypothesis, not established | Three probes in one run |
| GPU requirement | 24 GB RAM or A100 class GPU | 24 GB or more of system RAM to load; 16.9 GB GPU memory on an RTX PRO 6000 in the May 2026 run | Notebook 3, cell 41; cloud GPU was not an A100 |
| Laptop quantization | PLE override validated quality safe in development | Tried in development. No quality results committed. | No results file in the GitHub repository |
| Local inference | No cloud dependency, no internet requirement, no privacy concerns | Prompts stay on the device. Live data still comes from cloud APIs. | The tools call cloud APIs |
| Merged A4B size | About 48 GB | 51.61 GB on disk (49.91 GB and 1.70 GB shards) | Hugging Face file listing |
| NF4 size and GPU fit | For HF Spaces and 24 GB+ GPUs | 48.34 GB on disk. 49.2 GB GPU memory on one GPU in the May 2026 run. | Hugging Face file listing; notebook 3, cell 47 |
| LiteRT companion row | On device agentic loop; fine tuned bundle waits on an ai_edge_torch example module |
Base model run on a Colab x86 CPU. The fine tune did not produce a LiteRT artifact. Current LiteRT Torch releases list Gemma 4 support. | Notebook 5 uses the base model; LiteRT Torch releases |
| GGUF companion score | 10/10 project held out check | 5 of 5 tool routing in one local run. Q&A not graded. Results file not committed. | No GGUF results file in the GitHub repository |
| Quantize notebook | Link to solarhive_quantize_e4b.ipynb in the GitHub repository |
Marked as not in the public GitHub repository | GitHub file tree, November 21, 2026 |
| Training data formula and host | Not mentioned | Added a limitation: the data used 0.4% per °F on air temperature and the old NREL host. The code is fixed. Regeneration and retraining are pending. | GitHub README Known Limitations, November 20, 2026 |
| Base model license wording | Gemma Terms (base model) | Apache 2.0 (base model). The SolarHive files stay MIT. | Live Google Gemma 4 Hugging Face model pages and license page, November 21, 2026 |
| Base model ID casing | google/gemma-4-e4b-it |
google/gemma-4-E4B-it |
Canonical Hugging Face model ID. The lowercase ID resolves only through a redirect. |
| E4B LoRA adapter size | About 200 MB | About 165 MB | adapter_model.safetensors in solarhive-e4b-lora is 165,012,392 bytes in the Hugging Face file listing, November 21, 2026 |
| Quantize notebook name | solarhive_quantize_e4b.ipynb |
The notebook is described without a file name | The GGUF card gives a different name, and neither file is in the GitHub repository or its history |
I rechecked the scores, sizes, probe results and file names against notebook 2 (2_solarhive_finetune_finalrun_Apr2026.ipynb), notebook 3 (3_solarhive_inference_finalrun_May2026.ipynb), solarhive_inference_e4b_gguf_ollama.py, the GitHub file tree and the Hugging Face API on November 21, 2026.
Citation
@misc{solarhive2026,
title={SolarHive: AI-Powered Community Solar Energy Intelligence},
author={Youshen Lim},
year={2026},
url={https://github.com/youshen-lim/the-gemma4-good-hackathon-solarhive},
note={Gemma 4 Good Hackathon submission — Google DeepMind x Kaggle}
}
Links
- GitHub: youshen-lim/the-gemma4-good-hackathon-solarhive
- Kaggle: The Gemma 4 Good Hackathon
- Base Model: google/gemma-4-E4B-it
- Unsloth Gemma 4 docs: unsloth.ai/docs/models/gemma-4
Built with Gemma 4 in Ann Arbor, Michigan. May 2026.
Gemma is a trademark of Google LLC.
- Downloads last month
- 72
