π¦ Llama 3.2-1B Address Completion Model
This model is a fine-tuned version of Meta's Llama 3.2-1B-Instruct specialized for address completion and standardization. It's a lightweight, efficient model perfect for address intelligence tasks with reduced computational requirements.
π― Model Description
Llama 3.2-1B-Instruct model fine-tuned for address completion and standardization
Key Capabilities
- Address Component Extraction: Parse addresses into structured components (building, locality, pincode, etc.)
- Address Completion: Complete partial or incomplete addresses
- Address Standardization: Convert informal addresses to structured format
- Multi-format Support: Handle various address formats and styles
- Lightweight Performance: Optimized for speed and efficiency
- Contextual Understanding: Leverage relationships between address components
π Model Architecture
- Base Model: meta-llama/Llama-3.2-1B-Instruct
- Model Type: Causal Language Model (Autoregressive)
- Vocabulary Size: 128,256 tokens
- Hidden Size: 2048
- Number of Layers: 16
- Attention Heads: 32
- Max Sequence Length: 131072 tokens
- Model Size: ~2374MB
- Checkpoint: 4390
π Usage Examples
import torch
from transformers import AutoTokenizer, AutoModelForCausalLM
# Load model and tokenizer
model_name = "shiprocket-ai/open-llama-1b-address-completion"
tokenizer = AutoTokenizer.from_pretrained(model_name)
# Load the merged model (no need for PEFT since weights are already merged)
model = AutoModelForCausalLM.from_pretrained(
model_name,
torch_dtype=torch.float16,
device_map="auto"
)
def extract_address_components(address, max_new_tokens=150):
"""Extract address components using the model"""
# Format prompt for Llama 3.2-1B-Instruct
prompt = f"""<|begin_of_text|><|start_header_id|>user<|end_header_id|>
Extract address components from: {address}<|eot_id|><|start_header_id|>assistant<|end_header_id|>
"""
# Tokenize
inputs = tokenizer(prompt, return_tensors="pt", truncation=True, max_length=512)
# FIX: Move inputs to the same device as the model
device = next(model.parameters()).device
inputs = {k: v.to(device) for k, v in inputs.items()}
# Generate
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=max_new_tokens,
temperature=0.1,
top_p=0.9,
do_sample=True,
pad_token_id=tokenizer.eos_token_id,
repetition_penalty=1.05
)
# Decode only the new tokens
input_length = inputs['input_ids'].shape[1]
generated_tokens = outputs[0][input_length:]
response = tokenizer.decode(generated_tokens, skip_special_tokens=True)
return response.strip()
# Example usage
test_addresses = [
"C-704, Gayatri Shivam, Thakur Complex, Kandivali East, 400101",
"Villa 141, Geown Oasis, V Kallahalli, Off Sarjapur, Bengaluru, Karnataka, 562125",
"E401 Supertech Icon Indrapam 201301 UP"
]
print("π ADDRESS EXTRACTION EXAMPLES")
print("=" * 50)
for i, address in enumerate(test_addresses, 1):
print(f"\nπ Example {i}: {address}")
result = extract_address_components(address)
print(f"π€ Extracted: {result}")
π Performance Highlights
- Lightweight: 1B parameter model for fast inference
- Address Intelligence: Specialized for Indian address patterns
- Component Extraction: High accuracy in parsing address components
- Format Flexibility: Handles various address formats and abbreviations
- Speed Optimized: Ultra-fast inference for real-time applications
- Memory Efficient: Lower GPU memory requirements
- Contextual Awareness: Understands relationships between address components
π Supported Address Components
The model can extract and complete the following address components:
- Building Names: Apartments, complexes, towers, malls
- Localities: Areas, neighborhoods, sectors
- Pincodes: 6-digit Indian postal codes
- Cities: Major and minor Indian cities
- States: All Indian states and union territories
- Sub-localities: Sectors, phases, blocks
- Road Names: Streets, lanes, main roads
- Landmarks: Notable reference points
π§ Training Details
- Dataset: Custom address dataset
- Training Strategy: Fine-tuned from pre-trained Llama 3.2-1B-Instruct
- Specialization: Address parsing and completion
- Context Length: 2048 tokens
- Version: 1.0
- Framework: PyTorch + Transformers + PEFT
π‘ Use Cases
1. E-commerce & Delivery
- Auto-complete customer addresses during checkout
- Standardize delivery addresses for logistics
- Validate address completeness before shipping
2. Form Auto-filling
- Intelligent address suggestions in web forms
- Mobile app address completion
- Reduce user typing effort
3. Data Cleaning & Migration
- Clean legacy address databases
- Standardize address formats across systems
- Fill missing address components in existing data
4. Edge Deployment
- Lightweight model for mobile/edge devices
- On-device address processing
- Real-time address validation
5. High-throughput Processing
- Batch processing of large address datasets
- Real-time API endpoints
- Cost-effective inference
π― Prompt Templates
The model works best with Llama 3.2-1B-Instruct chat format:
Address Extraction
<|begin_of_text|><|start_header_id|>user<|end_header_id|>
Extract address components from: [address_text]<|eot_id|><|start_header_id|>assistant<|end_header_id|>
Address Completion
<|begin_of_text|><|start_header_id|>user<|end_header_id|>
Complete this partial address: [partial_address]<|eot_id|><|start_header_id|>assistant<|end_header_id|>
β‘ Performance Tips
- Temperature Settings: Use lower temperatures (0.1-0.3) for factual predictions
- Context Length: Keep prompts under 512 tokens for optimal performance
- Batch Processing: Process multiple addresses in batches for efficiency
- GPU Usage: Use half-precision (float16) for faster inference
- Format: Use Llama 3.2-1B-Instruct chat format for best results
- Edge Deployment: Perfect for mobile and edge deployment scenarios
β οΈ Limitations
- Model Size: Smaller model may have reduced capability vs larger models
- Training Data: Performance depends on training data coverage
- Regional Variations: May work better on certain address formats
- Informal Addresses: May struggle with highly colloquial formats
- Language: Primarily English; limited regional language support
- Context: Works best with complete address context
π Model Files
config.json
: Model configuration and hyperparameterspytorch_model.bin
/model.safetensors
: Model weightstokenizer.json
: Tokenizer configurationtokenizer_config.json
: Tokenizer settingsspecial_tokens_map.json
: Special tokens mappinggeneration_config.json
: Generation parameters
π Model Updates
- Version: 1.0 (Checkpoint 4390)
- Last Updated: 2025-06-19
- Base Model: meta-llama/Llama-3.2-1B-Instruct
π Citation
If you use this model in your research or applications, please cite:
@misc{llama-1b-address-completion,
title={Llama 3.2-1B Address Completion Model},
year={2025},
publisher={Hugging Face},
url={https://huggingface.co/shiprocket-ai/open-llama-1b-address-completion}
}
π Support & Contact
For questions, issues, or feature requests:
- Open an issue in this repository
- Contact: shiprocket-ai team
- Documentation: See usage examples above
π License
This model is released under the Llama 2 Community License. See LICENSE file for details.
Lightweight address intelligence - Powered by Llama 3.2-1B-Instruct π¦
- Downloads last month
- 32
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
π
Ask for provider support