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

License: Apache 2.0 Model Size Framework Fine-tuning

πŸ€— Model on Hugging Face β€’ πŸ“– Documentation β€’ πŸ—οΈ Metrrik App

πŸ“‹ Table of Contents

πŸ€– 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

  1. Cost Estimation: Generate preliminary estimates for residential, commercial, and healthcare projects
  2. Documentation: Create professional Bills of Quantities and variation orders
  3. Analysis: Provide elemental cost breakdowns and scope clarifications
  4. 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

  1. Data Preparation: Curated Kenyan construction dataset
  2. Base Model Loading: Gemma 3 1B instruction-tuned
  3. LoRA Injection: Added trainable adapters to target layers
  4. Training Loop: 100 iterations with gradient accumulation
  5. Model Merging: Combined LoRA weights with base model
  6. 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:

  1. Kenyan Construction Standards

    • Cost Handbook For Construction Works (2025-2026)
    • Official Kenyan construction cost benchmarks
    • Regional price variations and market rates
  2. Professional Documentation

    • Bills of Quantities from real Kenyan projects
    • Variation order templates and examples
    • Cost estimation methodologies
  3. 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

  1. Transparency: Clearly labeled as AI-generated content
  2. Professional Oversight: Requires qualified professional validation
  3. Market Accuracy: Users must verify current market rates
  4. 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

πŸ—οΈ Try Metrrik β€’ πŸ“§ Contact β€’ 🌐 Website

Downloads last month
5
Safetensors
Model size
1.0B params
Tensor type
BF16
Β·
MLX
Hardware compatibility
Log In to add your hardware

Quantized

Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support