--- library_name: transformers license: apache-2.0 pipeline_tag: token-classification base_model: google-bert/bert-base-cased datasets: - eriktks/conll2003 language: - en tags: - bert - named-entity-recognition - ner - token-classification - conll2003 - transformers - educational - huggingface-course metrics: - precision - recall - f1 - accuracy model-index: - name: bert-conll2003-ner results: - task: name: Token Classification type: token-classification dataset: name: CoNLL-2003 type: conll2003 split: validation metrics: - name: Precision type: precision value: 0.9369309716934282 - name: Recall type: recall value: 0.9525412319084483 - name: F1 type: f1 value: 0.9446716181256781 - name: Accuracy type: accuracy value: 0.9869458998057338 --- # BERT CoNLL-2003 — Named Entity Recognition A **BERT-based Named Entity Recognition (NER) model** fine-tuned from `bert-base-cased` on the **CoNLL-2003** dataset. The model identifies and classifies named entities in English text into four entity categories: **Person • Organization • Location • Miscellaneous** > This checkpoint is preserved as a complete educational token-classification experiment from my hands-on study of the Hugging Face Transformers ecosystem. ## Performance The completed fine-tuning run achieved: | Metric | Validation Result | |---|---:| | **F1** | **94.47%** | | **Precision** | **93.69%** | | **Recall** | **95.25%** | | **Accuracy** | **98.69%** | | Evaluation loss | 0.0662 | These are the evaluation results preserved with the original training run. ## Model Details | Property | Value | |---|---| | Architecture | `BertForTokenClassification` | | Base model | `bert-base-cased` | | Task | Named Entity Recognition | | Dataset | CoNLL-2003 | | Language | English | | Transformer layers | 12 | | Hidden size | 768 | | Attention heads | 12 | | FFN dimension | 3,072 | | Maximum sequence length | 512 | | Vocabulary size | 28,996 | | Output labels | 9 | | Weight precision | FP32 | The saved configuration explicitly identifies the architecture as `BertForTokenClassification`. ## Entity Labels The checkpoint uses the standard BIO-style CoNLL-2003 label scheme: | ID | Label | Meaning | |---:|---|---| | 0 | `O` | Outside an entity | | 1 | `B-PER` | Beginning of person | | 2 | `I-PER` | Inside person | | 3 | `B-ORG` | Beginning of organization | | 4 | `I-ORG` | Inside organization | | 5 | `B-LOC` | Beginning of location | | 6 | `I-LOC` | Inside location | | 7 | `B-MISC` | Beginning of miscellaneous entity | | 8 | `I-MISC` | Inside miscellaneous entity | These mappings are stored directly in the model configuration. ## How It Works ```text Input sentence ↓ BERT WordPiece tokenizer ↓ BERT encoder ↓ token-level classifier ↓ BIO entity labels ↓ PER / ORG / LOC / MISC ``` Unlike sequence classification, NER makes a prediction for individual tokens in the input. ## Quick Start ```python from transformers import pipeline MODEL_ID = "rIsHu009/bert-conll2003-ner" ner = pipeline( "token-classification", model=MODEL_ID, aggregation_strategy="simple", ) text = ( "Satya Nadella works at Microsoft " "and visited London." ) entities = ner(text) for entity in entities: print( entity["entity_group"], entity["word"], round(entity["score"], 4), ) ``` A typical output structure is: ```text PER Satya Nadella ORG Microsoft LOC London ``` Actual predictions and confidence scores depend on the input and checkpoint. ## Direct Model Usage ```python from transformers import ( AutoTokenizer, AutoModelForTokenClassification, ) MODEL_ID = "rIsHu009/bert-conll2003-ner" tokenizer = AutoTokenizer.from_pretrained(MODEL_ID) model = AutoModelForTokenClassification.from_pretrained( MODEL_ID ) ``` ## Training Configuration The preserved Trainer metadata records: | Hyperparameter | Value | |---|---:| | Learning rate | `2e-5` | | Train batch size | `16` | | Evaluation batch size | `16` | | Seed | `42` | | Optimizer | AdamW | | LR scheduler | Linear | | Epochs | `3` | ## Training Progress Performance improved across the three epochs: | Epoch | Validation Loss | Precision | Recall | F1 | Accuracy | |---:|---:|---:|---:|---:|---:| | 1 | 0.0650 | 0.9241 | 0.9428 | 0.9334 | 0.9853 | | 2 | 0.0698 | 0.9363 | 0.9472 | 0.9417 | 0.9860 | | 3 | 0.0662 | **0.9369** | **0.9525** | **0.9447** | **0.9869** | The strongest preserved F1 score is **0.9447 at epoch 3**. ### Historical software environment - Transformers `4.51.3` - PyTorch `2.6.0+cu124` - Datasets `3.6.0` - Tokenizers `0.21.1` ## Tokenization The checkpoint uses the **cased BERT WordPiece tokenizer**. Important properties: ```text Tokenizer: BertTokenizer Maximum length: 512 Lowercasing: disabled ``` Preserving capitalization is particularly useful for NER because capitalization can provide information about names, organizations and locations. The saved tokenizer confirms a 512-token limit and that lowercasing is disabled. ## Dataset The model was fine-tuned on **CoNLL-2003**, a standard benchmark for English named entity recognition. The checkpoint predicts four entity types: - **PER** — people - **ORG** — organizations - **LOC** — locations - **MISC** — miscellaneous named entities The original training metadata explicitly records CoNLL-2003 as the dataset and validation split used for the reported metrics. ## Intended Use This checkpoint is useful for: - named entity recognition; - token-classification experiments; - extracting people, organizations and locations from English text; - learning BERT fine-tuning; - studying BIO tagging; - learning Hugging Face token-classification workflows; - educational NLP applications. ## Limitations The model may: - miss entities not well represented by CoNLL-2003; - confuse entity categories; - perform worse on modern slang or informal text; - struggle with domain-specific terminology; - produce fragmented entities because of subword tokenization; - perform differently on text distributions unlike the benchmark data. The reported **94.47% F1** is specific to the preserved CoNLL-2003 validation evaluation and should not be interpreted as universal NER performance. Human review is recommended for consequential extraction tasks. ## Learning Context This model represents the **Named Entity Recognition / token-classification stage** of my Hugging Face learning progression. The broader collection includes experiments with: ```text BERT / DistilBERT ↓ token classification ↓ question answering ↓ masked language modeling ↓ machine translation ↓ causal language modeling ↓ Trainer / Accelerate workflows ``` The repositories are preserved as reproducible learning artifacts rather than presented as production systems. ## Repository Contents The repository includes: - `model.safetensors` - `config.json` - `tokenizer.json` - `tokenizer_config.json` - `vocab.txt` - special-token configuration - historical Trainer arguments - TensorBoard training artifacts ## Author **Naman Chanana** - Hugging Face: `rIsHu009` - GitHub: `Rishy-09` --- *Educational named-entity-recognition artifact preserved as part of an ongoing study of NLP, LLMs, and the Hugging Face ecosystem.*