πŸ¦™ 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

  1. Temperature Settings: Use lower temperatures (0.1-0.3) for factual predictions
  2. Context Length: Keep prompts under 512 tokens for optimal performance
  3. Batch Processing: Process multiple addresses in batches for efficiency
  4. GPU Usage: Use half-precision (float16) for faster inference
  5. Format: Use Llama 3.2-1B-Instruct chat format for best results
  6. 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 hyperparameters
  • pytorch_model.bin / model.safetensors: Model weights
  • tokenizer.json: Tokenizer configuration
  • tokenizer_config.json: Tokenizer settings
  • special_tokens_map.json: Special tokens mapping
  • generation_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
Safetensors
Model size
1.24B params
Tensor type
F16
Β·
Inference Providers NEW
This model isn't deployed by any Inference Provider. πŸ™‹ Ask for provider support

Model tree for shiprocket-ai/open-llama-1b-address-completion

Finetuned
(1109)
this model
Quantizations
1 model

Space using shiprocket-ai/open-llama-1b-address-completion 1