Entity Extraction Model - Fine-tuned SmolLM-360M
This model is a fine-tuned version of HuggingFaceTB/SmolLM-360M for extracting structured entities from natural language calendar event descriptions.
Model Description
- Base Model: HuggingFaceTB/SmolLM-360M
- Task: Entity Extraction for Calendar Events
- Language: English
- License: Apache 2.0
Intended Use
This model extracts structured entities from natural language text describing calendar events. It outputs JSON with the following fields:
action
: Type of event (e.g., "meeting", "lunch")date
: Date in DD/MM/YYYY formattime
: Time in HH:MM AM/PM formatattendees
: Array of attendee names (or null)location
: Event location (or null)duration
: Duration description (or null)recurrence
: Recurrence pattern (or null)notes
: Additional notes (or null)
Usage
from transformers import AutoModelForCausalLM, AutoTokenizer
import torch
# Load model and tokenizer
model_name = "Shresth12345/entity-extraction-smollm"
model = AutoModelForCausalLM.from_pretrained(model_name)
tokenizer = AutoTokenizer.from_pretrained(model_name)
# Example usage
text = "Meeting with John tomorrow at 2pm for 1 hour at the office"
prompt = f"Extract entities from: {text}"
# Tokenize and generate
inputs = tokenizer(prompt, return_tensors="pt", truncation=True, max_length=512)
with torch.no_grad():
outputs = model.generate(
**inputs,
max_new_tokens=150,
temperature=0.1,
do_sample=True,
pad_token_id=tokenizer.eos_token_id
)
# Decode response
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
generated_text = response[len(prompt):].strip()
print(generated_text)
Expected Output Format
{
"action": "Meeting",
"date": "tomorrow",
"time": "2:00 PM",
"attendees": ["John"],
"location": "office",
"duration": "1 hour",
"recurrence": null,
"notes": null
}
Training Details
- Training Data: 793 calendar event samples
- Training Split: 70% train, 15% validation, 15% test
- Custom Loss Function: Entity-aware loss with weighted output portion
- Training Framework: PyTorch (custom trainer)
- Evaluation Metrics: Exact match accuracy, field-wise accuracy, JSON quality
Model Performance
The model demonstrates strong performance in:
- Accurate entity extraction from natural language
- Consistent JSON output format
- Handling of missing/null values
- Recognition of temporal expressions
- Identification of people and locations
Limitations
- Primarily trained on English calendar events
- May struggle with very complex or ambiguous temporal expressions
- Performance may vary with domain-specific terminology
- Requires specific input format: "Extract entities from: [text]"
Training Procedure
This model was fine-tuned using:
- Custom PyTorch trainer implementation
- Entity-weighted loss function (weight: 2.0)
- Cosine annealing learning rate schedule
- Gradient accumulation for effective larger batch sizes
- Early stopping based on validation performance
Citation
If you use this model, please cite:
@misc{entity-extraction-smollm,
title={Entity Extraction Fine-tuned SmolLM-360M},
author={Shresth Mishra},
year={2025},
howpublished={\url{https://huggingface.co/Shresth12345/entity-extraction-smollm}}
}
Contact
For questions about this model, please open an issue in the repository or contact the author.
- Downloads last month
- 5
Model tree for Shresth12345/entity-extraction-smollm
Base model
HuggingFaceTB/SmolLM-360M