Agricultural B2B Intelligence - Llama 3.1 8B (Merged Weights)
This is the MERGED version - LoRA weights are baked into the base model for faster inference. No PEFT library needed!
Quick Comparison
| Version | This Repo (Merged) | LoRA Adapters |
|---|---|---|
| Size | ~16GB | ~500MB |
| Requires PEFT | No | Yes |
| Inference Speed | Faster (2-3x) | Slower |
| Quality | 100% identical | 100% identical |
| Best For | Production, Ollama | Development, storage-limited |
Quick Start
from transformers import AutoTokenizer, AutoModelForCausalLM
import torch
# Load directly - no PEFT needed!
model_id = "sarathi-balakrishnan/llama-agri-b2b-intelligence-merged"
tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
model_id,
torch_dtype=torch.bfloat16,
device_map="auto"
)
# Generate
messages = [
{"role": "system", "content": "You are an expert agricultural business intelligence analyst."},
{"role": "user", "content": "Analyze corn market opportunities in Iowa for a seed company."}
]
text = tokenizer.apply_chat_template(messages, tokenize=False, add_generation_prompt=True)
inputs = tokenizer(text, return_tensors="pt").to(model.device)
outputs = model.generate(**inputs, max_new_tokens=1000, temperature=0.7, do_sample=True)
print(tokenizer.decode(outputs[0], skip_special_tokens=True))
Convert to GGUF for Ollama
This merged model is perfect for converting to GGUF format:
# Clone llama.cpp
git clone https://github.com/ggerganov/llama.cpp
cd llama.cpp
pip install -r requirements.txt
# Download this model
huggingface-cli download sarathi-balakrishnan/llama-agri-b2b-intelligence-merged \
--local-dir ./agri-b2b-merged
# Convert to GGUF (Q8 for best quality)
python convert_hf_to_gguf.py ./agri-b2b-merged \
--outfile agri-b2b-q8.gguf \
--outtype q8_0
# Create Ollama model
echo 'FROM ./agri-b2b-q8.gguf
SYSTEM "You are an expert agricultural business intelligence analyst."' > Modelfile
ollama create agri-b2b -f Modelfile
ollama run agri-b2b
Model Details
What This Model Does
Specialized for B2B agricultural business intelligence:
- Market analysis for agricultural regions (states, counties)
- Go-to-market strategies for ag businesses
- Competitive landscape analysis
- Risk assessment for agricultural investments
- Equipment, insurance, lending, and input recommendations
Training Details
| Aspect | Details |
|---|---|
| Base Model | meta-llama/Llama-3.1-8B-Instruct |
| Method | Multi-teacher knowledge distillation |
| Teachers | Claude Sonnet 4 (50%) + GPT-4.1 (50%) |
| Training Data | 10,000 agricultural B2B examples |
| Training Time | 55+ hours |
| Hardware | NVIDIA DGX Spark (Blackwell GB10, 128GB) |
| Original LoRA | r=128, alpha=256 |
| Final Loss | 0.70 |
Why Merged?
LoRA (Low-Rank Adaptation) training keeps adapter weights separate from the base model. This merged version combines them:
BEFORE (LoRA): output = base_model(x) + lora_adapter(x)
AFTER (Merged): output = merged_model(x) # Same result, faster!
The mathematical output is 100% identical - merging just eliminates the overhead of running two forward passes.
Example Queries
"I sell farm equipment in the Midwest. Where should I expand next?"
"Analyze crop insurance opportunities in California's Central Valley"
"Compare agricultural lending risks across corn belt states"
"Develop a precision ag technology sales strategy for Texas"
"What counties have the highest potential for irrigation equipment sales?"
Performance on Apple Silicon
Expected performance on Mac with Apple Silicon:
| Chip | GGUF Q8 | GGUF Q4 |
|---|---|---|
| M1 Pro | ~15 tok/s | ~25 tok/s |
| M2 Max | ~25 tok/s | ~40 tok/s |
| M3 Max Ultra | ~40 tok/s | ~60 tok/s |
Links
- LoRA Version (smaller): sarathi-balakrishnan/llama-agri-b2b-intelligence
- Base Model: meta-llama/Llama-3.1-8B-Instruct
License
This model inherits the Llama 3.1 Community License.
Citation
@misc{agri-b2b-intelligence-2024,
title={Agricultural B2B Intelligence: Multi-Teacher Knowledge Distillation},
author={Sarathi Balakrishnan},
year={2024},
publisher={HuggingFace},
url={https://huggingface.co/sarathi-balakrishnan/llama-agri-b2b-intelligence-merged}
}
- Downloads last month
- -
Model tree for sarathi-balakrishnan/llama-agri-b2b-intelligence-merged
Base model
meta-llama/Llama-3.1-8B
Finetuned
meta-llama/Llama-3.1-8B-Instruct Evaluation results
- Final Training Loss on Agricultural B2B Intelligence Datasetself-reported0.700