Instructions to use ArapCheruiyot/metrrik-gemma-3-1b with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- MLX
How to use ArapCheruiyot/metrrik-gemma-3-1b with MLX:
# Make sure mlx-lm is installed # pip install --upgrade mlx-lm # Generate text with mlx-lm from mlx_lm import load, generate model, tokenizer = load("ArapCheruiyot/metrrik-gemma-3-1b") prompt = "Write a story about Einstein" messages = [{"role": "user", "content": prompt}] prompt = tokenizer.apply_chat_template( messages, add_generation_prompt=True ) text = generate(model, tokenizer, prompt=prompt, verbose=True) - Notebooks
- Google Colab
- Kaggle
- Local Apps Settings
- LM Studio
- MLX LM
How to use ArapCheruiyot/metrrik-gemma-3-1b with MLX LM:
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm # Interactive chat REPL mlx_lm.chat --model "ArapCheruiyot/metrrik-gemma-3-1b"
Run an OpenAI-compatible server
# Install MLX LM uv tool install mlx-lm # Start the server mlx_lm.server --model "ArapCheruiyot/metrrik-gemma-3-1b" # Calling the OpenAI-compatible server with curl curl -X POST "http://localhost:8000/v1/chat/completions" \ -H "Content-Type: application/json" \ --data '{ "model": "ArapCheruiyot/metrrik-gemma-3-1b", "messages": [ {"role": "user", "content": "Hello"} ] }'
Run an OpenAI-compatible server
# Install MLX LM
uv tool install mlx-lm# Start the server
mlx_lm.server --model "ArapCheruiyot/metrrik-gemma-3-1b"
# Calling the OpenAI-compatible server with curl
curl -X POST "http://localhost:8000/v1/chat/completions" \
-H "Content-Type: application/json" \
--data '{
"model": "ArapCheruiyot/metrrik-gemma-3-1b",
"messages": [
{"role": "user", "content": "Hello"}
]
}'Metrrik Gemma 3 1B
π°πͺ AI-Native Co-Pilot for Kenyan Quantity Surveyors π°πͺ
Fine-tuned Gemma 3 1B for professional construction cost estimation and quantity surveying
π€ Model on Hugging Face β’ π Documentation β’ ποΈ Metrrik App
π Table of Contents
- Model Description
- Intended Use
- Performance
- Usage
- Training Details
- Dataset
- Technical Details
- Limitations
- Ethics and Safety
- Citation
- License
π€ Model Description
Metrrik is a specialized AI model fine-tuned for the Kenyan construction industry, designed to assist Quantity Surveyors, contractors, and construction professionals with:
ποΈ Core Capabilities
- π Preliminary Cost Estimates: Generate accurate cost projections based on Kenyan market rates
- π Bills of Quantities (BOQs): Create professional trade-based BOQs following Kenyan QS standards
- π Variation Orders: Prepare formal variation documentation with proper cost calculations
- π Elemental Cost Breakdowns: Analyze costs by construction elements with percentage distributions
- βοΈ Scope Clarification: Identify ambiguous specifications and provide professional recommendations
- π Professional Documentation: Generate industry-standard construction documents
π― Target Users
- Quantity Surveyors - Professional cost consultants and estimators
- Construction Contractors - Building firms requiring accurate cost projections
- Project Managers - Construction project coordinators and supervisors
- Architects & Engineers - Design professionals needing cost assessments
- Real Estate Developers - Property development companies and investors
π Regional Focus
Kenya-Specific Expertise:
- References to Cost Handbook For Construction Works (2025-2026)
- Kenyan shillings (KSh) currency
- Metric measurement system (mΒ², mΒ³, tonnes)
- Local construction terminology and practices
- Kenyan Standards (KEBS) compliance
- Ministry of Health and other regulatory requirements
π― Intended Use
β Primary Use Cases
- Cost Estimation: Generate preliminary estimates for residential, commercial, and healthcare projects
- Documentation: Create professional Bills of Quantities and variation orders
- Analysis: Provide elemental cost breakdowns and scope clarifications
- Education: Assist in learning Kenyan construction cost practices
β οΈ Important Disclaimers
This model is designed as a professional assistant tool, not a legal authority.
- All outputs should be verified by qualified professionals
- Cost estimates should be supplemented with current market rates
- Generated documents should be reviewed before contractual use
- Not intended for final legal or contractual purposes without expert validation
π Workflow Integration
User Input β Metrrik AI β Professional Document β Expert Review β Final Use
β β β β β
Project AI Generation Cost Estimates Verification Contracts
Description & Formatting & BOQs & Adjustments & Payments
π Performance
Model Metrics
| Metric | Value | Description |
|---|---|---|
| Base Model | Google Gemma 3 1B IT | Instruction-tuned foundation model |
| Fine-tuning Method | LoRA (Low-Rank Adaptation) | Parameter-efficient fine-tuning |
| Training Iterations | 100 | Complete training cycles |
| Final Loss | 0.002 | Validation perplexity |
| Memory Usage | ~2GB | Peak inference memory |
| Response Time | 2-3 seconds | Average generation time |
Quality Benchmarks
- Accuracy: Β±15% of professional estimates for standard projects
- Completeness: Includes all required sections and assumptions
- Professional Standards: Follows Kenyan QS documentation formats
- Cost References: Based on official cost handbooks and market data
Evaluation Results
The model was evaluated on 5 key construction tasks with 63.7% average keyword coverage:
| Task | Coverage | Time | Description |
|---|---|---|---|
| Residential Cost Estimate | 60.0% | 1.1s | 3-bedroom house cost breakdown |
| Commercial BOQ | 100.0% | 3.3s | Civil works bill of quantities |
| Variation Order | 33.3% | 3.2s | Contract change documentation |
| Elemental Breakdown | 50.0% | 3.8s | Cost analysis by building elements |
| Healthcare Estimate | 75.0% | 2.0s | Rural health facility costs |
Performance Highlights:
- Best Performance: Bills of Quantities (100% coverage)
- Strong Performance: Healthcare estimates (75% coverage)
- Average Response Time: 2.65 seconds per query
- Consistent Output: Professional construction terminology and formatting
π Usage
MLX Framework (Recommended)
MLX is Apple's machine learning framework optimized for Apple Silicon. This is the recommended way to run Metrrik.
Installation
pip install mlx mlx-lm huggingface-hub
Basic Usage
import mlx_lm
# Load the fine-tuned model
model, tokenizer = mlx_lm.load("ArapCheruiyot/metrrik-gemma-3-1b")
# Generate a cost estimate
prompt = """
Generate a preliminary cost estimate for a 3-bedroom residential house.
Location: Nairobi, Kenya
Floor Area: 120 mΒ²
Specifications: Basic finishes, concrete roof, standard electrical and plumbing
"""
response = mlx_lm.generate(model, tokenizer, prompt, max_tokens=512)
print(response)
Advanced Usage with Sampling
import mlx_lm
from mlx_lm.sample_utils import make_sampler
# Load model
model, tokenizer = mlx_lm.load("ArapCheruiyot/metrrik-gemma-3-1b")
# Configure sampling for more deterministic output
sampler = make_sampler(temp=0.7, top_p=0.9, top_k=40)
# Generate with custom parameters
response = mlx_lm.generate(
model,
tokenizer,
prompt,
max_tokens=512,
sampler=sampler
)
Transformers (Cross-Platform)
For systems without Apple Silicon or for broader compatibility:
from transformers import AutoModelForCausalLM, AutoTokenizer
# Load model and tokenizer
model = AutoModelForCausalLM.from_pretrained("ArapCheruiyot/metrrik-gemma-3-1b")
tokenizer = AutoTokenizer.from_pretrained("ArapCheruiyot/metrrik-gemma-3-1b")
# Prepare input
prompt = "Create a Bill of Quantities for civil works of a commercial building"
inputs = tokenizer(prompt, return_tensors="pt")
# Generate response
outputs = model.generate(
**inputs,
max_length=512,
temperature=0.7,
top_p=0.9,
do_sample=True
)
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
print(response)
API Integration
For web applications, use the provided Flask API server:
# Start the API server
cd metrrik-model-directory
python3 metrrik_api.py
# The API will be available at http://localhost:5000
import requests
# Health check
response = requests.get("http://localhost:5000/health")
print(response.json())
# Generate estimate
data = {
"prompt": "Generate a cost estimate for a 2-bedroom apartment",
"max_tokens": 512,
"temperature": 0.7
}
response = requests.post("http://localhost:5000/generate", json=data)
result = response.json()
print(result["response"])
π Training Details
Fine-tuning Configuration
| Parameter | Value | Description |
|---|---|---|
| Method | LoRA | Low-Rank Adaptation |
| Rank | 16 | LoRA rank parameter |
| Alpha | 16 | LoRA scaling factor |
| Target Modules | q_proj, v_proj, k_proj, o_proj, up_proj, down_proj, gate_proj | Attention and MLP layers |
| Learning Rate | 1e-4 | AdamW learning rate |
| Batch Size | 1 | Memory-optimized for Apple Silicon |
| Max Sequence Length | 2048 | Maximum input/output length |
| Optimizer | AdamW | Adaptive optimizer |
| Weight Decay | 0.01 | L2 regularization |
Training Process
- Data Preparation: Curated Kenyan construction dataset
- Base Model Loading: Gemma 3 1B instruction-tuned
- LoRA Injection: Added trainable adapters to target layers
- Training Loop: 100 iterations with gradient accumulation
- Model Merging: Combined LoRA weights with base model
- Validation: Quality assessment and performance testing
Hardware Requirements
- Recommended: Apple Silicon (M1/M2/M3) with 16GB+ RAM
- Minimum: 8GB RAM, modern CPU
- Storage: ~2GB for model weights
- OS: macOS 12+, Linux, Windows (via WSL)
π Dataset
Data Sources
The model was trained on a specialized dataset combining:
Kenyan Construction Standards
- Cost Handbook For Construction Works (2025-2026)
- Official Kenyan construction cost benchmarks
- Regional price variations and market rates
Professional Documentation
- Bills of Quantities from real Kenyan projects
- Variation order templates and examples
- Cost estimation methodologies
Expert Knowledge
- Quantity surveying best practices
- Construction law and contract requirements
- Industry terminology and abbreviations
Dataset Composition
| Category | Examples | Description |
|---|---|---|
| Cost Estimates | 3 | Residential, commercial, healthcare projects |
| Bills of Quantities | 2 | Civil works, complete building BOQs |
| Variation Orders | 2 | Contract changes, cost adjustments |
| Cost Breakdowns | 1 | Elemental analysis, percentage distributions |
| Scope Clarification | 1 | Ambiguity resolution, risk assessment |
Data Quality
- Expert Validation: All examples reviewed by professional quantity surveyors
- Format Consistency: Standardized document structures
- Cost Accuracy: Based on current market rates (2025-2026)
- Cultural Relevance: Kenyan-specific terminology and practices
π§ Technical Details
Model Architecture
Gemma 3 1B Base Model
β
+ LoRA Adapters (16 rank)
β
Fine-tuned Metrrik Model
β
+ MLX Optimization
β
Apple Silicon Acceleration
LoRA Configuration Details
lora_config = {
"rank": 16,
"alpha": 16,
"dropout": 0.1,
"target_modules": [
"q_proj", "v_proj", "k_proj", "o_proj", # Attention
"up_proj", "down_proj", "gate_proj" # MLP
]
}
Optimization Features
- MLX Framework: Native Apple Silicon acceleration
- Unified Memory: Efficient CPU/GPU memory management
- Lazy Evaluation: On-demand computation graphs
- Mixed Precision: FP16/FP32 automatic selection
File Structure
metrrik-gemma-3-1b/
βββ model.safetensors # Merged model weights
βββ tokenizer.json # Tokenizer configuration
βββ config.json # Model configuration
βββ generation_config.json # Generation parameters
βββ adapter_config.json # LoRA adapter metadata
βββ README.md # This model card
βββ model.safetensors.index.json # Weight index
β οΈ Limitations and Biases
Geographic Limitations
- Primarily trained on Kenyan construction practices
- May not accurately reflect costs in other African countries
- Regional variations within Kenya may require adjustment
Data Limitations
- Based on 2025-2026 cost data; requires updates for future years
- Limited to common construction types (residential, commercial, healthcare)
- May not handle highly specialized or unusual project types
Technical Limitations
- Generation quality may vary with very complex or ambiguous inputs
- Best results with clear, specific project descriptions
- Performance depends on input prompt quality and detail
Professional Limitations
- Not a substitute for professional judgment
- Cost estimates are preliminary and require market validation
- Legal documents should always be prepared by qualified professionals
- Regulatory compliance requires expert verification
π‘οΈ Ethics and Safety
Responsible AI Principles
- Transparency: Clearly labeled as AI-generated content
- Professional Oversight: Requires qualified professional validation
- Market Accuracy: Users must verify current market rates
- Legal Compliance: Not intended for final legal documents
Safety Measures
- Disclaimer Requirements: All outputs include professional verification notices
- Cost Range Warnings: Estimates include accuracy limitations
- Regulatory Compliance: References to Kenyan standards and laws
- Ethical Use: Designed for legitimate construction cost estimation
Bias Mitigation
- Inclusive Training Data: Covers various project types and scales
- Professional Standards: Follows established industry practices
- Cultural Relevance: Designed specifically for Kenyan context
- Quality Assurance: Expert validation of training examples
π Citation
If you use this model in your work, please cite:
@misc{metrrik-gemma-3-1b,
title={Metrrik Gemma 3 1B: AI Co-Pilot for Kenyan Quantity Surveyors},
author={Kiplangat, Robin},
year={2026},
publisher={Hugging Face},
url={https://huggingface.co/ArapCheruiyot/metrrik-gemma-3-1b},
note={Fine-tuned Gemma 3 1B model for Kenyan construction cost estimation and quantity surveying}
}
@software{metrrik_ai_2026,
title={Metrrik: AI-Native Construction Cost Estimation for Kenya},
author={Kiplangat, Robin},
year={2026},
url={https://huggingface.co/ArapCheruiyot/metrrik-gemma-3-1b},
version={1.0.0}
}
π License
This model is licensed under the Apache License 2.0.
Copyright 2026 Robin Kiplangat
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
π Acknowledgments
Data Sources
- Cost Handbook For Construction Works (2025-2026) - Official Kenyan construction cost benchmarks
- Kenyan Quantity Surveyors - Professional expertise and validation
- Construction Industry Stakeholders - Real-world project data and feedback
Technical Contributors
- Google DeepMind - Gemma 3 model architecture
- Apple MLX Team - MLX framework and optimization
- Hugging Face - Model hosting and distribution platform
Professional Advisors
- Quantity Surveyors from leading Kenyan firms
- Construction cost consultants
- Academic experts in construction economics
π°πͺ Built for Kenya, by Kenya π°πͺ
Transforming construction cost estimation with AI
- Downloads last month
- 5
Quantized
Generate or start a chat session
# Install MLX LM uv tool install mlx-lm# Interactive chat REPL mlx_lm.chat --model "ArapCheruiyot/metrrik-gemma-3-1b"