GutSignal Food NER Model (CoreML)
Named Entity Recognition model for extracting food-related entities from text. Optimized for iOS devices in CoreML format.
Model Description
This model extracts structured entities from natural language food descriptions:
| Entity | Description | Examples |
|---|---|---|
| FOOD | Food items | chicken, rice, apple |
| QUANTITY | Amounts | 2, half, large |
| UNIT | Measurements | cups, oz, tbsp |
| COOKING_METHOD | Preparation | grilled, fried, baked |
| DESCRIPTOR | Modifiers | fresh, organic, raw |
Example
Input: "Chicken breast pan fried with avocado oil and mashed potatoes"
Output:
- FOOD: chicken breast
- COOKING_METHOD: pan fried
- FOOD: avocado oil
- FOOD: mashed potatoes
Model Variants
| Variant | Size | Recommended For |
|---|---|---|
FoodNER_float32.mlpackage |
~253 MB | Development/testing |
FoodNER_float16.mlpackage |
~253 MB | Production (iPhone 15+) |
Performance Metrics
| Entity | F1 Score |
|---|---|
| FOOD | 0.9402 |
| QUANTITY | 0.9891 |
| UNIT | 0.9720 |
| COOKING_METHOD | 0.9950 |
| DESCRIPTOR | 0.9547 |
| Overall | 0.9533 |
iOS Integration
Requirements
- iOS 16.0+ (iOS 18.0+ recommended)
- iPhone 15 or newer
- Xcode 15+
Quick Start
- Download
FoodNER_float16.mlpackageand supporting files - Add to your Xcode project
- Use the provided Swift integration code
Swift Usage
import CoreML
class FoodNERService {
private var model: MLModel?
private var tokenizer: DistilBERTTokenizer?
init() throws {
let config = MLModelConfiguration()
config.computeUnits = .all // Use Neural Engine
guard let modelURL = Bundle.main.url(
forResource: "FoodNER_float16",
withExtension: "mlpackage"
) else { throw NERError.modelNotFound }
self.model = try MLModel(contentsOf: modelURL, configuration: config)
self.tokenizer = try DistilBERTTokenizer(vocabPath: vocabURL)
}
func extractEntities(from text: String) throws -> [FoodEntity] {
// Tokenize input
let (inputIds, attentionMask, tokens) = tokenizer.encode(text)
// Run inference
let output = try model.prediction(from: input)
// Parse entities from output
return parseEntities(logits: output.logits, tokens: tokens)
}
}
See INTEGRATION_GUIDE.md for complete implementation details.
Files Included
FoodNER_float32.mlpackage- Full precision modelFoodNER_float16.mlpackage- Recommended for productionvocab.txt- Tokenizer vocabulary (30,522 tokens)tokenizer.json- Full tokenizer configurationlabels.json- Entity label mapping (11 labels)ios_metadata.json- Model metadata for integrationINTEGRATION_GUIDE.md- Complete Swift integration guide
Training Details
- Base Model: DistilBERT (distilbert-base-uncased)
- Parameters: ~67 million
- Max Sequence Length: 128 tokens
- Training Framework: PyTorch + Transformers
- Conversion: ONNX -> PyTorch -> CoreML (via coremltools 9.0)
Inference Performance
- Latency: 50-150ms on iPhone 15 Pro
- Compute Units: CPU + GPU + Neural Engine (ALL)
- Memory: ~300 MB peak during inference
Limitations
- Best performance on common Western foods
- May struggle with very regional or specialized cuisine terms
- Maximum input length of 128 tokens
- Designed for English text only
Privacy
This model runs entirely on-device with no network calls required. All food parsing happens locally, ensuring user privacy.
License
CC BY-NC 4.0 (Creative Commons Attribution-NonCommercial 4.0)
You are free to:
- Share โ copy and redistribute the material
- Adapt โ remix, transform, and build upon the material
Under the following terms:
- Attribution โ You must give appropriate credit
- NonCommercial โ You may not use the material for commercial purposes
For commercial licensing inquiries, contact the author.
Citation
@misc{gutsignal-food-ner,
author = {GutSignal},
title = {GutSignal Food NER Model},
year = {2026},
publisher = {Hugging Face},
howpublished = {\url{https://huggingface.co/ndlanier/gutsignal-food-ner-coreml}}
}
Related Models
- gutsignal-food-parser-llama-3.2-3b-mlx - Full LLM for complex food parsing
- gutsignal-food-parser-tinyllama-1.1b-mlx - Lightweight LLM option
- Downloads last month
- 5
Model tree for ndlanier/gutsignal-food-ner-coreml
Base model
distilbert/distilbert-base-uncased