bert-base-cased

The bert‑base‑cased model is the original BERT architecture released by Google Research, trained on English text with a case‑sensitive tokenizer. It is a 12‑layer bidirectional transformer encoder containing

google-bert 2.4M downloads apache-2.0 Fill Mask
Frameworkstransformerspytorchtfjaxsafetensors
Languagesen
Datasetsbookcorpuswikipedia
Tagsbertfill-maskexbert
Downloads
2.4M
License
apache-2.0
Pipeline
Fill Mask
Author
google-bert

Run bert-base-cased locally on a Q4KM hard drive

Accelerate your AI workloads with Q4KM high‑performance hard drives pre‑loaded with the bert‑base‑cased model. Enjoy instant access, zero‑setup time, and optimized I/O for large‑scale inference. Get...

Shop Q4KM Drives

Technical Overview

The bert‑base‑cased model is the original BERT architecture released by Google Research, trained on English text with a case‑sensitive tokenizer. It is a 12‑layer bidirectional transformer encoder containing 110 million parameters (768 hidden size, 12 attention heads). The model is pre‑trained on a masked language modeling (MLM) objective and a next‑sentence prediction (NSP) objective, allowing it to develop deep contextual representations of language.

Key capabilities include:

  • Masked Language Modeling (MLM) – predicts randomly masked tokens, enabling fill‑in‑the‑blank tasks.
  • Next Sentence Prediction (NSP) – learns relationships between sentence pairs, useful for tasks such as natural language inference.
  • Bidirectional Context – unlike autoregressive models, BERT attends to both left and right context simultaneously.
  • Fine‑tuning Flexibility – can be adapted to sequence classification, token classification, question answering, and more with minimal architectural changes.

The architecture follows the original “base” configuration:

  • 12 Transformer encoder layers (also called “blocks”).
  • Hidden size = 768.
  • 12 self‑attention heads per layer.
  • Feed‑forward intermediate size = 3072.
  • Positional embeddings + segment (sentence) embeddings.

Intended use cases focus on tasks that require a full‑sentence understanding, such as sentiment analysis, named‑entity recognition, and extractive question answering. For generative tasks (e.g., free‑form text generation) a decoder‑only model like GPT‑2 is recommended instead.

Benchmark Performance

BERT Base‑Cased was evaluated on the GLUE benchmark, Stanford Sentiment Treebank (SST‑2), and SQuAD v1.1. The original paper reported the following scores (averaged over multiple seeds):

  • GLUE average: 80.5 % (accuracy / F1 depending on task).
  • SST‑2 accuracy: 93.5 %.
  • SQuAD v1.1 F1: 90.9 %.

These benchmarks matter because they test the model’s ability to understand sentence‑level semantics (GLUE), sentiment nuance (SST‑2), and reading comprehension (SQuAD). Compared with the smaller bert‑base‑uncased variant, the cased version typically yields a 0.5‑1 % boost on case‑sensitive tasks such as NER or coreference resolution, while remaining competitive with other 110 M‑parameter models like RoBERTa‑base.

Hardware Requirements

Running inference with bert‑base‑cased is modest compared with larger models, but still benefits from GPU acceleration.

  • VRAM for inference: ~4 GB (FP32) or ~2 GB (FP16) per batch of 1‑2 sentences.
  • Recommended GPU: NVIDIA RTX 3060 (12 GB) or higher; for production workloads, a Tesla T4 (16 GB) or A100 (40 GB) provides ample headroom.
  • CPU: Modern multi‑core CPUs (e.g., Intel i7‑12700K) can serve low‑throughput use cases; however, latency will increase to >200 ms per request without a GPU.
  • Storage: Model files (config, tokenizer, weights) total ~420 MB. Using safetensors reduces memory overhead and speeds loading.
  • Performance: On an RTX 3060, batch size 8 yields ~150 tokens / ms (FP16). On CPU, expect ~10 tokens / ms.

Use Cases

Because it is case‑sensitive, bert‑base‑cased shines on tasks where capitalization carries meaning.

  • Named‑Entity Recognition (NER): Distinguishes “Apple” (company) from “apple” (fruit).
  • Sentiment & Intent Classification: Fine‑tune on customer‑support tickets where proper nouns affect sentiment.
  • Question Answering (extractive): Power QA systems that need to locate answers in long passages.
  • Legal & Medical Document Analysis: Preserve case‑specific terminology such as “DNA” vs “dna”.

Industries ranging from finance (risk‑report parsing) to healthcare (clinical note tagging) benefit from the model’s ability to capture nuanced contextual cues. Integration is straightforward via the Hugging Face pipeline API, or by loading the model directly in PyTorch or TensorFlow for custom pipelines.

Training Details

Training followed the original BERT recipe:

  • Objectives: Masked Language Modeling (15 % token masking) + Next Sentence Prediction.
  • Datasets: BookCorpus (≈800 M words) and English Wikipedia (≈2.5 B words).
  • Tokenization: WordPiece vocabulary of 30 k tokens, case‑preserving.
  • Compute: Trained on 4 × TPU v3 pods for 1 M steps (≈1 M seconds of wall‑clock time), equivalent to ~256 GPU‑hours on an NVIDIA V100.
  • Fine‑tuning: The model can be fine‑tuned on downstream datasets with a learning‑rate range of 2e‑5 – 5e‑5, batch sizes of 16‑32, and 3‑5 epochs for most classification tasks.

The resulting checkpoint is compatible with both PyTorch and TensorFlow, and can be loaded via transformers with the from_pretrained method.

Licensing Information

The model is released under the Apache 2.0 license (the README lists this explicitly, while the tag “unknown” reflects a missing metadata field). Apache 2.0 is a permissive open‑source license that:

  • Allows commercial and non‑commercial use, modification, and distribution.
  • Requires preservation of the original copyright notice and license text.
  • Provides an explicit patent grant, protecting downstream users from patent litigation.

No additional restrictions are imposed beyond the standard Apache 2.0 terms. Users should include the license file when redistributing the model or a derivative work, and they may add their own attribution if they wish.

Pre-loaded AI models. Ready to run.

Skip the downloads. Get a Q4KM hard drive with hundreds of models pre-configured and optimized.

Shop Q4KM Hard Drives