CLOUD CONCEPT

BERTScore

BERTScore is a reference-based text evaluation metric that measures similarity between generated and reference text using contextual token embeddings.

Cloud Concepts Hub →

What is BERTScore

BERTScore compares the meaning represented by individual tokens rather than relying only on matching words or phrases. It is useful for evaluating foundation model outputs that can express an acceptable answer in different ways, but it does not independently establish factual correctness, safety, or instruction compliance.

BERTScore evaluates generated text by comparing it with human-written or otherwise trusted reference text. It uses a pretrained contextual language encoder to represent tokens as vectors, then compares those vectors using cosine similarity. Because the representations incorporate surrounding context, BERTScore can recognize some semantic similarities even when the generated response uses different wording from the reference. It is commonly used for translation, summarization, and reference-based answer evaluation.

The calculation starts with a similarity matrix between candidate and reference tokens. For precision, each candidate token is matched to its most similar reference token, and those similarities are averaged. For recall, each reference token is matched to its most similar candidate token. F1 combines precision and recall through their harmonic mean. These are soft similarity measures, not counts of exactly correct words or classifications. Matching is greedy rather than a strict one-to-one alignment, and optional inverse document frequency weighting can give less weight to common tokens.

For example, a reference answer might say, “The application automatically increases capacity when demand rises,” while a generated answer says, “The system scales out as traffic grows.” Word-overlap metrics may give limited credit because several words differ. BERTScore can give credit for related meanings. However, an answer that changes “increases” to “decreases” may still share substantial contextual similarity. Engineers must therefore check whether the metric detects the particular errors that matter for their application.

In a cloud evaluation workflow, teams store versioned prompts and reference answers, generate responses from candidate foundation models, and run BERTScore in a batch processing job. For example, a team comparing two customer-support models can score both against the same held-out reference set, report average F1, and inspect results separately for billing, troubleshooting, and account-access questions. The generation model and the encoder used for BERTScore are separate components. The scorer need not use the same model family as the application.

Reproducibility requires recording the encoder checkpoint, tokenizer, selected encoder layer, package version, weighting settings, and baseline-rescaling configuration. BERTScore is not restricted to the original BERT model; implementations can use other supported contextual encoders. Raw and baseline-rescaled scores are not interchangeable, and scores should not be interpreted as percentages of correctness. Avoid assuming a universal zero-to-one range across configurations, particularly when baseline rescaling is enabled. Long inputs also require an explicit truncation or chunking policy because encoders have input-length limits.

The main trade-offs are compute cost, dependence on reference quality, and sensitivity to the chosen encoder and domain. Running an encoder is generally more expensive than calculating lexical overlap, although batching and appropriate hardware can improve throughput. A valid answer may score poorly if the reference captures only one acceptable response. Conversely, a fluent answer containing an incorrect date, number, negation, or unsupported claim can still score well. BERTScore does not verify claims against retrieved documents or external evidence.

For evaluation questions, distinguish BERTScore from BLEU, ROUGE, and LLM-as-a-judge. BLEU emphasizes modified n-gram precision with a brevity penalty, while common ROUGE variants measure word-sequence overlap and often emphasize reference coverage. BERTScore instead uses contextual token similarity. LLM-as-a-judge asks a generative model to apply an evaluation rubric and can assess broader criteria, but introduces its own biases and variability. A practical evaluation suite combines complementary metrics with factuality checks, task-specific validation, and human review rather than treating any single score as a complete quality assessment.

Key aspects of BERTScore

BERTScore provides reference-based semantic similarity through contextual token matching, with results that depend on scoring configuration and require complementary quality checks.

Contextual semantic matching

BERTScore compares token embeddings produced by a contextual encoder rather than requiring exact word matches. This helps recognize paraphrases, although subtle meaning changes can still receive high similarity.

Precision, recall, and F1

Precision measures how well candidate tokens match reference tokens, while recall measures how well reference tokens match candidate tokens. F1 combines these two directions; none of these values is a direct factual-accuracy percentage.

Reference-dependent evaluation

Scoring requires reference text that represents an acceptable output. Incomplete, incorrect, or overly restrictive references can distort comparisons between otherwise useful model responses.

Configurable encoder and weighting

The encoder, selected layer, optional inverse document frequency weighting, and baseline rescaling affect the result. Keep these settings fixed and recorded when comparing models or tracking regressions.

Batch-oriented cloud execution

Teams can calculate scores in custom processing jobs after collecting foundation model outputs. Batch inference, encoder reuse, and suitable CPU or GPU resources help control evaluation time and cost.

Complementary quality signal

BERTScore measures similarity to references, not grounding, safety, or complete instruction compliance. Pair it with task-specific checks and human or rubric-based evaluation for consequential applications.

Cloud services for BERTScore

A practical AWS workflow uses Amazon S3 to hold a versioned evaluation dataset and Amazon Bedrock to produce responses from candidate foundation models. A custom Amazon SageMaker AI Processing job reads the response-reference pairs, loads a fixed contextual encoder, and calculates BERTScore precision, recall, and F1. The job writes per-example results, aggregate statistics, and configuration metadata back to S3. Engineers can then inspect low-scoring examples and compare model versions under identical conditions. Keep generation costs separate from scoring costs, and supplement semantic similarity results with factuality, safety, and task-specific evaluations before selecting a model.

Amazon Bedrock

Generate candidate responses from foundation models through Amazon Bedrock, then evaluate those responses against references in a separate custom BERTScore workflow. This does not require assuming that BERTScore is a built-in metric for a particular Bedrock evaluation mode.

Open Amazon Bedrock →
Amazon Simple Storage Service image Amazon S3

Store reference datasets, generated responses, scoring configurations, and evaluation reports in Amazon S3. Object versioning can help preserve the exact evaluation artifacts used for a model comparison.

Open Amazon S3 →