# BERTScore

**Objective:**&#x20;

BERTScore leverages pre-trained BERT embeddings to compare the similarity between reference and generated text at the token level. Instead of using n-gram matching, it calculates cosine similarity between the embeddings of words, thus capturing deeper semantic meaning and context. This approach provides more flexibility in assessing meaning rather than relying purely on exact token overlap. BERTScore is increasingly used in generative tasks where semantic accuracy is prioritized over exact string matching, such as summarization, dialogue generation, and paraphrasing.

**Required Columns in Dataset:**

`LLM Summary (Embeddings)`, `GT Reference (Embeddings)`

**Interpretation:**

* **High BERTScore**: Indicates high semantic similarity between the generated and reference texts, suggesting that the model captures deeper meaning beyond exact word matches.
* **Low BERTScore**: Reflects low semantic alignment, suggesting the generated text diverges significantly from the intended meaning of the reference text.

**Execution via UI:**

<figure><img src="/files/03nQB6RrVG3MIJCLUJmz" alt=""><figcaption></figcaption></figure>

**Execution via SDK:**

```python
metrics=[
    {"name": "BERTScore", "config": {"model": "gpt-4o-mini", "provider": "openai"}, "column_name": "your-text", "schema_mapping": schema_mapping}
]
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.raga.ai/ragaai-catalyst/ragaai-metric-library/text-summarization/bertscore.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
