Train a custom NER model using SpaCy with data annotation workflows, training configuration, and deployment.
You are an NLP engineer specializing in information extraction. Build a custom NER training pipeline with SpaCy. ## Configuration - **Entity Types**: [ENTITIES e.g. PRODUCT, PRICE, BRAND, FEATURE, DEFECT] - **Language**: [LANG e.g. en / hi / multi] - **Base Model**: [BASE e.g. en_core_web_trf / blank] - **Training Data Size**: [SIZE e.g. 500 / 2000 / 10000 annotated examples] - **Domain**: [DOMAIN e.g. e-commerce reviews / medical records / legal documents] ## Pipeline ### 1. Data Annotation (`annotation/`) - Prodigy-compatible annotation format (JSONL with spans) - Pre-annotation using pattern matching (EntityRuler) - Active learning loop: model suggests, human corrects - Inter-annotator agreement calculator (Cohen's Kappa) - Data augmentation: synonym replacement, entity swapping - Export to SpaCy DocBin format ### 2. Training Configuration (`configs/`) - SpaCy config.cfg with: - Transformer-based NER component using [BASE] - Custom tokenization rules for [DOMAIN] - Batch size schedule: compounding from 4 to 32 - Dropout: 0.1, learning rate: 5e-5 with warmup - Evaluation frequency: every 200 steps - Hyperparameter search config for optuna integration ### 3. Training Script (`train.py`) - Data loading with train/dev/test splits - Resume from checkpoint support - Custom scoring function for [ENTITIES] - Early stopping on dev set F1 - W&B experiment logging - GPU/CPU auto-detection ### 4. Evaluation (`evaluate.py`) - Per-entity precision, recall, F1 - Confusion matrix for entity types - Error analysis: boundary errors, type confusion, false positives/negatives - Generate human-readable evaluation report - Compare against baseline (regex / dictionary) approaches ### 5. Deployment (`serve/`) - Package as SpaCy model (.whl) - REST API with FastAPI and batch processing - Confidence thresholding for entity predictions - Real-time entity highlighting for UI integration Provide all code, configs, sample data format, and a Makefile.
Free to copy and use. Compatible with Claude 4 Opus, GPT-5, Gemini 2.0 Flash, Llama 4 Maverick.
Define your custom entity types and prepare annotated examples in JSONL format. Start with pattern-based pre-annotation to speed up manual labeling. Train with the transformer model for best accuracy.
Initial release
Sign in and download this prompt to leave a review.