---
title: "Do Language Models Learn about Legal Entity Types during"
description: "How well can pretrained language models identify legal entity types in Canadian refugee decisions from a masked sentence or a direct question?"
canonical: "https://research.elamur.ai/free/en/papers/barale-2023-do-language-models-learn-about/"
---
Elamur: [Mova](https://md.mova.elamur.ai/free/en/) · [Parse](https://mova.elamur.ai/free/en/parse/) · [Dictionary](https://md.dictionary.elamur.ai/free/en/) · [Translate](https://md.translate.elamur.ai/free/en/) · **Research** · [Gali](https://md.gali.elamur.ai/free/en/) · [MCP](https://mcp.elamur.ai/) · [Locations](https://md.locations.elamur.ai/free/en/) · [Weather](https://md.weather.elamur.ai/free/en/) · [Constitution](https://md.constitution.elamur.ai/)

[Elamur Research](https://md.research.elamur.ai/free/en/) · [this page in HTML](https://research.elamur.ai/free/en/papers/barale-2023-do-language-models-learn-about/)

[Elamur Research](https://md.research.elamur.ai/free/en/) / [papers](https://md.research.elamur.ai/free/en/papers/) / [2023](https://md.research.elamur.ai/free/en/papers/2023/) / Do Language Models Learn about Legal Entity Types during Pretraining?

# Do Language Models Learn about Legal Entity Types during Pretraining?

Paper · 2023 · Claire Barale, Michael Rovatsos and Nehal Bhuta

**Authors:** Claire Barale, Michael Rovatsos and Nehal Bhuta · **Year:** 2023 · **Venue:** Proceedings of the Natural Legal Language Processing Workshop 2023 · **Licence:** [CC BY 4.0 (ACL Anthology)](https://creativecommons.org/licenses/by/4.0/)

[**1** citations OpenAlex, 2026-10-14](https://openalex.org/works?filter=cites:W4389519906) · [Cited by **2** papers in our library of more than 163,000 papers whose bibliographies we read](https://md.research.elamur.ai/free/en/papers/barale-2023-do-language-models-learn-about/cited-by/) · [Proceedings of the Natural Legal Language Processing Workshop 2023](https://aclanthology.org/volumes/2023.nllp-1/) · [licence](https://creativecommons.org/licenses/by/4.0/)

- [Publisher's page](https://aclanthology.org/2023.nllp-1.4/)
- [PDF](https://aclanthology.org/2023.nllp-1.4.pdf)
- [DOI 10.18653/v1/2023.nllp-1.4](https://doi.org/10.18653/v1/2023.nllp-1.4)
- [OpenAlex](https://openalex.org/W4389519906)

Citations: OpenAlex, 2026-10-14.

## Summary

A refugee decision can name a tribunal, cite a law, describe a piece of evidence and explain why a claim succeeded or failed. A system that can tell these passages apart could help make decisions searchable and comparable. But legal annotation is scarce, and some distinctions require more than recognizing familiar names. The authors ask whether [language models](https://md.research.elamur.ai/free/en/concepts/language-model/) already make such distinctions after pretraining. They test this through entity typing, which means assigning a category to a passage whose location in the text is already known. Their benchmark is AsyLex, a collection of Canadian refugee decisions with human annotations.

The authors make the task a choice among 14 categories, with 151 candidate labels that include alternative names for those categories. In the first experiment, they cover up an annotated passage with a single mask and ask a BERT-based system to infer its type from the rest of the sentence. In the second, they show Llama2 the passage and ask directly what type it is. The first experiment compares general-purpose and legal-oriented systems under the same prompting procedure. The second gives the system evidence that the first deliberately withholds, so the two experiments answer related questions about what information a prompt can recover.

Pile of Law leads the masked-sentence experiment on reported average F1 at 16.36%, with average recall of 9.47%. CaseHOLD follows, while the legal-oriented LexLM trails the general-purpose systems on the paper’s overall comparison. Individual categories tell a different story from those averages. RoBERTa reaches 55.5% F1 on determination, the category for the outcome of a decision, even though those passages can be long. In the question experiment, Llama2 scores strongly on location and retrieves several common legal categories more successfully than it retrieves specialized ones. The paper’s prose and its question-results table give inconsistent accounts of the overall F1, so the per-category results are the firmer basis for describing that experiment.

Refugee-law categories are difficult across both setups. The error analysis shows why a wrong label can mean several things. A type may fit a masked sentence even when it differs from the human annotation. A direct answer may describe the passage adequately but fall outside the accepted vocabulary. Other responses miss distinctions such as the difference between a nationality adjective and the country associated with it. The study shows that pretrained systems can recover useful type information, including for passages made up of several words. It leaves open whether that information is reliable enough to supervise legal annotation.

## Deep dive: Do Language Models Learn about Legal Entity Types during Pretraining?

How well can pretrained language models identify legal entity types in Canadian refugee decisions from a masked sentence or a direct question? · about 31 minutes to read

**In this deep dive**

1. [The problem and its context](#dd-the-problem-and-its-context)
2. [The method, step by step](#dd-the-method-step-by-step)
3. [Experiments and results](#dd-experiments-and-results)
4. [What the ablations show](#dd-what-the-ablations-show)
5. [Limitations](#dd-limitations)
6. [What came after](#dd-what-came-after)

### The problem and its context

#### What a category adds to a legal passage

To compare decisions, a reader needs to know what different passages are doing. A reference to a statute identifies a source of law. A sentence that dismisses an appeal records an outcome. A passage about gaps in testimony may bear on credibility. These distinctions are central to the paper’s account of [legal AI](https://md.research.elamur.ai/free/en/topics/legal-ai/). A search for similar cases might use the reason for a decision, the kind of evidence at issue or the procedural step under review. Each search calls for a way to distinguish a particular kind of information from everything else in a decision.

Entity typing supplies the category part of that distinction. It is closely related to [named entity recognition](https://md.research.elamur.ai/free/en/concepts/named-entity-recognition/), where a system usually has to locate a mention and identify its type. Here, the annotations identify the target in advance. In one experiment, the system sees where the target was removed. In the other, it sees the target text itself. This separation lets the authors examine category judgments while holding the selection of the passage fixed. It also explains why the results are relevant to [information extraction](https://md.research.elamur.ai/free/en/concepts/information-extraction/) without measuring a complete extraction system.

The word *entity* has a broad meaning in this study. A place name is an entity, and so is a clause that gives the outcome of a refugee claim. Some labels identify what a phrase denotes, such as a date or organization. Others identify what the phrase contributes to a decision. A supporting document, a credibility assessment and the panel’s explanation may all be discussed in related language, but they occupy different roles in AsyLex. A system needs to distinguish those roles to reproduce the annotations.

This broader definition matters when interpreting the paper’s question about legal knowledge. Familiarity with names can help a system recognize a city or a tribunal. Familiarity with legal language may help it anticipate where a statute could be cited in a sentence. A distinction such as the one between a decision’s explanation and a ground for refugee protection places a different demand on the prediction. The label depends on the convention used to categorize the passage and the legal role that the passage serves. Putting these cases in the same evaluation lets the authors ask where the readily available signals become less dependable.

#### Why look to pretraining?

The motivation is a practical shortage of legal data with task-specific [linguistic annotation](https://md.research.elamur.ai/free/en/concepts/annotation/). A supervised system for a narrowly defined task depends on examples marked with the categories it has to learn. The supply of those examples can be especially limited for distinctions tailored to a body of law. Pretraining offers another possible source of information. Exposure to text gives a system practice with patterns of word choice, sentence construction and meaning. The question is whether these patterns also support judgments useful to a later legal task.

The authors describe this possibility as incidental or weak supervision. In this setting, a prediction could act as a provisional label for material a human has yet to annotate. It could also supplement other sources of supervision, including a legal knowledge base. The appeal is that prompts can pose a new typing question without first fitting a classifier to a labeled target dataset. For that prospect to be credible, the predictions would need to be consistent enough for the intended use. The paper treats that reliability as something to investigate.

Legal text gives the authors reason to examine both ordinary and domain-specific signals. A word such as *appeal* can have different implications depending on where it appears. A term may acquire a specialized meaning in a legal passage even when the same word occurs often in ordinary writing. Conversely, dates and places remain recognizable across many kinds of documents. A benchmark containing both familiar and specialized categories can help show how far broad linguistic familiarity carries over to legal decisions.

The study also asks whether legal pretraining and jurisdictional coverage matter. A corpus of legal documents can expose a system to language that a broad text collection represents differently. Yet legal corpora themselves vary. A collection drawn from one jurisdiction offers a different range of documents from a multinational collection. A corpus rich in legal writing in general may still offer little help with the roles that matter in Canadian refugee decisions. The comparison therefore concerns both the broad distinction between legal and general-purpose pretraining and variation within the legal group.

#### How earlier probes shaped the question

The paper places the study in a line of work that asks what a pretrained system can retrieve through a carefully framed prompt. The LAMA framework gave that question a factual form. A prompt could state a relationship with one part missing, and the prediction could be compared with the recorded fact. Later work discussed by the authors investigated multilingual retrieval and how prompting affects the knowledge that can be elicited. Some of the earlier probes limited the length of the target entities to a single token or to short spans.

An entity-type probe changes what counts as an answer. Given a sentence with its capital-city name removed, a factual completion might supply the name of the city. A typing probe asks whether the missing mention belongs to a category such as location. The distinction is important for legal decisions, where reproducing the words of a ruling and identifying those words as the ruling’s outcome are separate tasks. A category can be useful even when the system would have little chance of recovering the original passage word for word.

The authors also distinguish their task from the emphasis of LegalLAMA, which investigates legal knowledge through tasks that include legislation and legal terminology. Here the categories come from annotations for refugee decisions. The benchmark includes laws and law cases alongside information about claimants, evidence, procedural events and the reasons given for decisions. This puts the categories used by an applied legal annotation project at the center of the probe.

Earlier entity-typing work had already considered finer-grained taxonomies, categories that had not been seen in task training and supervision drawn from related tasks. The authors point to studies using bidirectional sequence systems, masked prediction and autoregressive generation. They also discuss uses of [question answering](https://md.research.elamur.ai/free/en/concepts/question-answering/) in related problems, including entity linking. As the paper describes the state of the field, its combination of legal entity typing and question-form prompts addresses a gap. The design brings earlier probing techniques to a dataset whose categories vary markedly in how much specialized legal information they convey.

### The method, step by step

#### Start with an annotated passage

AsyLex supplies the documents and the human judgments used for evaluation. The complete dataset contains 59,112 historical decisions spanning from 1996 to 2022, obtained from the Canadian Legal Information Institute. The documents cover initial decisions on refugee claims as well as appeals. The dataset contains 19,115 human-annotated instances and encompasses 20 categories. The study uses a closed set of 14 categories for its two experiments. The categories included in the benchmark were developed with input from legal professionals and experts in refugee law.

The authors begin with a passage that has already been marked in the data. In the masked experiment, they use the sentence that contains it and substitute a mask for the target. In the question experiment, they turn the target itself into the subject of a typing question. Both procedures yield a prediction that can be checked against the human-assigned category. The authors make the AsyLex dataset public and provide experiment code under the name `probing_legal_entity_types`.

The task is zero-shot. The experiment uses the systems’ existing training and supplies task instructions or candidate answers at prediction time. AsyLex annotations determine the benchmark targets and the answers against which to score predictions. This arrangement is what makes the task a probe. A successful prediction demonstrates that the answer can be elicited with the chosen input and label vocabulary, without training a new AsyLex classifier for that experiment.

From an annotated passage to an entity-type score The steps in order.

#### Decide what an acceptable answer looks like

The categories are grouped by their expected scope. Location, date and NORP are the generic types. Location covers places such as cities, countries and regions. Date includes relative or absolute times and periods. NORP covers adjectival forms associated with nationality, religion, politics or ethnicity. The adjective requirement matters. A response may identify the place associated with a nationality adjective while missing the kind of information the span conveys.

The group that the authors describe as broadly legal includes organizations, laws, claimant information, procedures, documentary evidence and law cases. A tribunal can be an organization. A citation to legislation or an international convention can be a law. A past decided case can be a law case. Age, citizenship and occupation can fall under claimant information. Procedural steps and the documents used to support a claim have their own categories. These categories reflect the role of a text span in a decision even when some of its words would be familiar outside law.

The refugee-law group brings together credibility, determination, explanation, legal ground and law report. A determination says what the panel decided about the claim or the appeal. An explanation gives a reason the panel used to arrive at that outcome. A legal ground concerns the Convention basis for recognizing refugee status, such as religion or political opinion. Credibility covers assessments that bear on whether the claimant’s account should be believed. Law reports include country reports by organizations such as NGOs or the United Nations. The group is specialized in the context of this evaluation. Individual words such as *decision* and *reason* have much wider uses.

The authors use a synonym generator to make the answer vocabulary more flexible. The resulting menu is reported as 151 candidate types or labels, with each accepted answer evaluated through the underlying set of 14 categories. A system that returns *country* or *city*, for instance, can receive credit for location. Likewise, a response such as *tribunal* can represent organization. The expansion allows the prediction to use a reasonable specific term while the score records agreement at the level of AsyLex’s categories.

The candidate menu also shapes the problem the systems face. A system must distinguish several acceptable expressions of one category from expressions of neighboring categories. In the list, case law and legislation have separate evaluation roles, yet *law* appears among the candidate terms for both. The appendix likewise lists *proof* for procedure and for documentary evidence. This overlap makes the mapping itself relevant to the interpretation of a result. A candidate answer can be linguistically reasonable and still require a rule to decide which annotation category it represents.

#### Infer the category from a gap

The masked language modeling experiment presents a sentence with an annotated passage hidden. Cloze is the name for this kind of fill-in-the-blank setup. The BERT-based systems are used as encoders that make a prediction for the mask from the words around it. Their output choices are restricted to the candidate menu. In ordinary masked-word prediction, the aim is to supply text for the gap. In this experiment, the scores for the permitted answer labels are used to identify the type expected at that position.

Each selected passage is replaced by a single masked token. A token is a unit of text processed by the system, and the original passage can span several of them. The same input representation for the gap is used whether the annotation covered a short place name or a clause expressing a decision. The position of the mask remains visible. The original wording and the number of tokens it occupied are withheld. If a sentence has several entities, the procedure considers the first entity in the sentence. The prompt supplies the sentence as its context.

Imagine a sentence that says an applicant has not returned to an unspecified place since a particular date. The verb and its surrounding wording make a destination plausible, even with the destination hidden. Such a cue can support a location prediction without revealing the identity of the place. But the same sentence may admit another reading, such as a return to work. The masked setup tests whether the system favors the annotated interpretation among the available options. It can therefore give a low score even where the sentence supports a sensible alternative.

The authors describe drawing ten thousand annotated sentences per type for the masked experiment. Cleaning leaves different numbers of usable prompts for different categories, and the results table gives those counts. The sampling unit reported for this procedure is a sentence with a target. The dataset’s inventory of decision documents, its human-annotated instances and the resulting prompt counts describe different aspects of the study.

The paper presents the task first in terms of a set of possible types.

```
E = {e₁, e₂, …, eₙ}
```

Here E is the set of entity types considered in the formal task. Each e represents a type, and its subscript identifies its position in the set. The subscript n indicates the final position and thus the number of types denoted by the set. The ellipsis stands for the intervening elements. The equals sign defines E, and the braces enclose its members. Operationally, the answer vocabulary expands the evaluation categories with alternative labels.

The paper gives the prediction objective as a maximum over the types.

```
eᵢ* = arg maxₑᵢ∈E P(eᵢ | tⱼ, sₖ)
```

Here eᵢ is a candidate entity type and i indexes the candidates. The star in eᵢ* identifies the selected type. The expression `arg max` returns the candidate for which the probability is greatest. The membership sign ∈ restricts that search to elements of E. The function P denotes probability, and the vertical bar reads as *given*. The probability is for type eᵢ given masked token tⱼ and sentence or segment sₖ. The subscripts j and k index the masked token and sentence, respectively. The paper calls the collections from which they are drawn T and S. The comma separates the two pieces of conditioning information, and the parentheses delimit the probability expression.

In practice, the selected passage may have consisted of many words. The single masked position in the formula is the position introduced by the experiment. The objective also concerns which type receives the highest score. The study evaluates the resulting decisions through recall and F1. It does not evaluate the full ordering of candidate scores, an analysis the authors identify as future work.

#### Ask directly about the visible passage

The second experiment gives Llama2 the target text. The prompt briefly describes the task, includes the candidate menu and asks what entity type the displayed passage belongs to. The paper illustrates the setup with the name *Nice*. A response such as *city* can be mapped to location. Here the letters of the name are available to the system, while the sentence that might establish which sense is intended is outside the question as described.

This is an autoregressive setup. Llama2 produces a text response by generating successive tokens, so the answer is a string that must be interpreted and scored. The system is asked to select from the pre-defined labels. It can nonetheless generate other words, echo the target, name several types or produce an explanation. The candidate menu defines the intended answer space. The generation process can leave that space, a difference that has visible consequences in the error analysis.

The authors use the smallest Llama2 size they describe, with 7B parameters, citing computing resources. The setup also names Llama2-chat, the version adapted for dialogue through [fine-tuning](https://md.research.elamur.ai/free/en/concepts/fine-tuning/). Fine-tuning here refers to training performed before the experiment to adapt the system for dialogue. The paper reports the question results under the Llama2 name in a single table, so the figures are best read as results for the reported setup rather than as a separate comparison of base and chat variants.

A useful way to understand the difference between the two prompts is to ask where the evidence comes from. In the cloze prompt, the surrounding sentence must do the work. The sentence may disclose grammatical structure or a strong expectation about what kind of thing belongs in the gap. In the question prompt, a recognizable place name, date expression or legal term can supply its own evidence. The change also has a cost for ambiguous expressions. An acronym or a phrase that serves several roles can be easier to interpret in the sentence from which it was taken. The paper characterizes the direct question as easier overall because it reveals the target.

#### Compare the text used for pretraining

The masked experiment compares RoBERTa and DeBERTa-V3 as general-purpose systems. CaseHOLD, Pile of Law and LexLM form the legal-oriented group. The training collections described for these systems cover different materials and jurisdictions. CaseHOLD is associated with Harvard case law from the United States. Pile of Law draws on material including sources from the United States, Canada and the European Court of Human Rights. LexLM covers a broader set of jurisdictions, including the United Kingdom and India. These differences make the legal systems informative comparisons with one another.

To see how the collections differ in readily visible vocabulary, the authors sample 50K documents per collection and retain the top 10K most frequent tokens after cleaning, tokenizing and removing stopwords. Stopwords are common terms filtered out for this comparison. The legal documents are randomly sampled from available pretraining datasets. The generic sample is reconstructed from sources like those described for the general-purpose systems. Its components include material from books, news, web text and stories. The authors use an open version of OpenWebText for the web component.

The generic vocabulary is a proxy for Llama2 as well. The authors say they have limited information about the precise composition of its pretraining data. Vocabulary overlap therefore compares lists of frequent terms drawn from available documents or proxies. These lists are distinct from the systems’ internal token vocabularies and from their entire training collections. The overlap gives a way to examine the domain comparison before looking at the benchmark scores. It supplies context for a possible explanation when the systems behave differently, while leaving the cause of any score difference open.

### Experiments and results

#### What the scores count

The human label, often called the gold label, is the reference for each prediction. Recall asks how often the experiment retrieves a type among the prompts for which it is the human-assigned type. Precision asks how frequently predictions of a type agree with the reference. F1 combines precision and recall so that performance on either can affect the score. The paper emphasizes recall because a source of weak supervision would ideally capture a substantial share of the relevant passages. It reports F1 to give a broader view of prediction quality.

The two experiments produce different kinds of errors before scoring. The masked experiment chooses from restricted candidates, so its failures primarily concern which candidate received the highest score. In the question experiment, scoring must also decide how to handle responses that depart from the requested answer format. A low score can consequently reflect difficulty picking the legal category, difficulty expressing it with an accepted term or failure to follow the instructions about what to return.

The cloze results give a cleaned prompt count for each evaluated type. For example, the reported counts are 9,913 for location, 7,242 for determination and 8,825 for explanation. Law case has 9,290 prompts, while law report has 8,601. The caption for the question experiment reports 10K prompts per entity type. These figures describe the evaluations reported for each setup. The paper does not describe them as performance on a shared, matched train and test split.

For the masked task, RoBERTa and DeBERTa-V3 provide the general-purpose comparisons for the legal systems. The legal systems are also compared directly with one another. The question experiment reports Llama2 under its different input procedure. The reported benchmark comparisons are among these systems and conditions. There is no separately reported random-choice baseline or human performance benchmark to put the magnitudes on a common scale.

#### The masked-sentence comparison

Pile of Law has the strongest reported average F1 among the cloze systems, at 16.36%, along with average recall of 9.47%. CaseHOLD comes next on the reported aggregates, at 15.29% average F1 and 8.58% average recall. The paper describes LexLM as the weakest on the overall comparison, even though it is larger and has a broader jurisdictional training collection than some of the legal alternatives. Legal pretraining is therefore compatible with both the strongest and the weakest aggregate results in this comparison.

The category scores make the meaning of that ranking clearer. Pile of Law’s result on location is especially strong within the masked experiment. A pretraining collection focused on legal documents can still support a category that applies to a wide range of texts. Conversely, the strongest system for the experiment as a whole need not lead on common legal labels such as law. Averages combine these different strengths.

Location typing on masked AsyLex sentences by F1 Pile of Law leads the location comparison among the cloze systems.

**The numbers**

| System or setting | F1 |
| --- | --- |
| RoBERTa | 0.110 |
| DeBERTa-V3 | 0.194 |
| CaseHOLD | 0.131 |
| Pile of Law (this paper) | 0.503 |
| LexLM | 0.104 |

CaseHOLD’s cloze F1 for law is 0.383, and DeBERTa-V3 reaches 0.337 on the same category. Pile of Law records 0.115 there. The ordering changes for procedure. Pile of Law has the highest procedure F1 at 0.344. LexLM has the highest reported procedure recall at 0.228, with F1 of 0.129. This is the exception to the paper’s observation that the system with the highest recall for a type generally also has the highest F1 for that type. It illustrates why the choice of metric matters when the desired use is to recover as many true instances as possible.

Some categories are difficult even for the best-performing system on that category. For cloze explanation, the F1 scores include 0.161 for Pile of Law, 0.026 for RoBERTa and 0.015 for LexLM. Human annotations for explanation identify the reasons for a decision. A sentence with the reason hidden may still contain wording compatible with several kinds of legal information. A plausible prediction from that sentence can therefore miss the particular explanatory role marked in AsyLex.

Determination is a striking exception to the generally weak specialized categories. RoBERTa obtains 55.5% F1 on determination in the cloze setup, the experiment’s highest category F1 as reported in the paper’s discussion. It also has determination recall of 0.384 in the results table. Other cloze systems are appreciably weaker at the same type. The result establishes that a specialized target can be recoverable from the remaining sentence under this design. It does not establish that the surrounding text cues are equally effective across systems or across other specialized labels.

#### Direct questions about the target

The question experiment shows a wide spread across types. According to the reported per-type table, location has recall of 0.956 and F1 of 0.916. Date has recall of 0.730 and F1 of 0.575. These are categories for which a visible name or an expression of time can supply strong evidence. NORP yields F1 of 0.118 despite belonging to the same generic group. The generic labels themselves thus span quite different levels of difficulty.

The broadly legal categories are also uneven. Documentary evidence has reported recall of 0.653 and F1 of 0.485. Claimant information has recall of 0.627 and F1 of 0.456. The table gives procedure F1 as 0.149 and law case F1 as 0.017. Presenting the passage can make an item like a document name directly recognizable. A term that invokes a procedural event, a case or a statute can still be difficult to place in the benchmark’s vocabulary.

Selected Llama2 entity types on AsyLex direct questions by F1 The reported scores are higher for location and date than for the selected legal categories.

**The numbers**

| System or setting | F1 |
| --- | --- |
| Location (this paper) | 0.916 |
| Date | 0.575 |
| Documentary evidence | 0.485 |
| Claimant information | 0.456 |
| Determination | 0.217 |
| Procedure | 0.149 |
| Legal ground | 0.011 |
| Explanation | 0.003 |

Within the refugee-law categories, determination again stands out. Its reported recall is 0.357, with F1 of 0.217. Credibility is lower, at recall of 0.219 and F1 of 0.123. The table gives law report F1 as 0.025. The weakest results here are important for the paper’s practical motivation. A useful type signal for locations and dates is evidence of some success, while a pipeline intended to compare reasons for refugee decisions would need dependable labels on the categories where the reported signal is weakest.

The paper’s prose gives 30.86% as average F1 for the question experiment and 14.46% as the average for the masked experiment across types. The direct-question figure is inconsistent with the values labeled F1 in the per-category table. The grouped Llama2 figures also align with the entries labeled recall in the per-category table. The individual figures above follow that table’s labels. The discrepancy leaves the exact aggregate F1 comparison unresolved. Separately, even a consistent aggregate would compare different evidence and response formats alongside different systems.

#### Read the category groups alongside the individual results

The paper groups the categories into generic, broadly legal and refugee-law types to see whether the benefits of a system depend on the scope of the label. In the grouped cloze results, the row that pools the general-purpose systems has a score of 11.59 for generic categories, 17.98 for broadly legal categories and 10.01 for refugee-law categories. CaseHOLD has corresponding scores of 8.51, 20.89 and 5.93. Pile of Law records 20.42 for generic categories and 4.68 for refugee-law categories. These are grouped scores as presented by the paper. In particular, the CaseHOLD row shows that the broadly legal group can favor a legal system even when another row favors a different system.

The comparison supports a narrower conclusion than a universal ranking of legal and general-purpose pretraining. Pile of Law leads the masked aggregate and does especially well on location. CaseHOLD is strong on law. General-purpose systems are competitive on some legal categories and supply the strongest determination result. At the same time, the refugee-law group is generally the hardest. The scores make it possible to distinguish broad familiarity with legal text from reliable performance on the specific concepts the dataset was designed to capture.

### What the ablations show

#### What changes when the target becomes visible

The paper’s analyses compare existing systems, prompt setups, categories and patterns of failure. They do not include an isolated ablation that takes away one input cue while preserving the rest of the experiment. The evidence for the contribution of any particular cue therefore comes from reading the comparisons and examples together. The most consequential comparison is between the masked sentences and the direct questions.

The masked prompt retains surrounding words and hides the entity. The question prompt supplies the entity and asks for a generated answer. Along with that change in evidence, the study moves from BERT-based encoders to Llama2 and from restricted selection to text generation. Improvements on a type like location fit the explanation that giving the place name makes the task easier. The design leaves the individual contributions of the visible target, the prompt wording, the system and the answer mechanism unresolved.

The differences also help explain why a direct question can be difficult on particular items. A short, recognizable expression may be self-explanatory. A reference that looks like a unit, an ordinary word or an acronym may need the original sentence to indicate that it names a tribunal. A cloze prompt could retain the sentence’s indication that a tribunal belongs in the gap even while hiding the acronym. The two probes reveal different aspects of the available signal, and the paper’s error examples show where either input can be insufficient.

The authors see scope for improving the question template because some answers contain several types or fail to use the requested format. Their comparison establishes that these behaviors occur under the template they tried. It supplies a reason to test alternative prompts. The paper does not report a result from an optimized template, so its expected benefit remains a research question.

#### Why long targets can still be typed

The authors examine the lengths of the original annotated spans by category, including single-token mentions and spans longer than three tokens. Place names and dates tend to supply short examples. Passages labeled determination, explanation or legal ground can be longer because they express an outcome, a reason or a specialized basis for the claim. Length is therefore associated with what the passage is doing.

The success on determination is evidence that a long span can still be typed. In the cloze experiment, the system predicts a category for the missing passage and the entire span is represented by one mask. The wording around the gap can reveal a decision outcome without giving the system any need to reconstruct the words that express it. This helps explain why the paper observes a smaller disparity between short and long targets than one might expect in a task that had to recover the actual span.

The direct question provides an additional view. Short generic entities do well, and some longer categories, including determination and claimant information, are also recoverable. At the same time, explanation and legal ground remain difficult. A long phrase may give the system more words to work with while also asking it to distinguish a more specific role. The authors conclude that the study shows no clear overall penalty attributable to span length in this typing task. Since span length is examined through categories that also vary in meaning, the comparison leaves open the effect of adding or removing words from an otherwise equivalent target.

#### What the pretraining vocabulary can explain

The authors find that the sampled vocabularies of legal corpora overlap more with one another than with the generic comparison vocabulary. The legal group nevertheless contains considerable variation. CaseHOLD and LexLM have 44.5% vocabulary overlap in the paper’s comparison of frequent terms. LexLM shares more vocabulary with Pile of Law. The authors connect this pattern to jurisdictional coverage. CaseHOLD focuses on the United States, while the other two collections draw on a wider set of jurisdictions.

The value of the vocabulary analysis is that it gives substance to the category *legal pretraining*. The legal collections can differ markedly even before the systems are evaluated. This makes it plausible that a type familiar in one collection will receive different treatment in another. It also explains why the paper examines which categories each system retrieves instead of interpreting membership in the legal group as a uniform advantage.

The overlap measure cannot trace an individual classification to a training example or a particular jurisdiction. The frequent-token lists omit less frequent expressions by design, and legal roles can depend on combinations of familiar words. Furthermore, broad corpus vocabulary and the distribution of useful examples are different properties. A large shared vocabulary could coexist with quite different exposures to passages that explain refugee decisions. The analysis helps characterize the comparison, while the source of the category-level differences remains undetermined.

#### What wrong answers reveal about the masked task

For the masked experiment, the authors inspect 700 errors, sampling 10 per entity type per system. The largest category, called random prediction in the paper, accounts for 70.71% of the sampled errors. The name refers to answers judged unrelated to the intended type and context. It describes the observed failure and does not imply that the prediction was produced by a random process.

Another 16.86% of the sampled masked errors are closely related to the gold category. A prediction such as an NGO report can be understandable when the original span is marked as documentary evidence. Reports can be used as evidence, yet the task asks for the category assigned to that passage. Confusing an explanation with a legal ground illustrates a related kind of error. The predicted category may be in the right area of legal meaning while missing the more specific function of the passage.

The remaining category observed in the masked error sample is the contextually plausible error, at 12.43%. In the paper’s example of a person who has not returned somewhere since a given year, the annotation calls for location, but the system predicts employment. A return to employment makes sense in the sentence. With the actual destination hidden, the prompt can support that alternative. This category of error is especially informative about what the experimental design measures. The answer key comes from what the original sentence said, while the prediction comes from the possibilities left open after masking.

The masked selection procedure also accounts for a category of error the authors do not observe. Because the output is constrained to the list, the system cannot return a label outside it. The appendix gives 0.00 for that error type in the masked sample. That figure describes the search space imposed by the experiment. In the question setup, a response can leave the requested label set, which creates errors of a different kind.

#### What wrong answers reveal about direct questions

For direct questions, the paper reports examining 135 errors and describes sampling by entity type. It labels 22.22% of the sampled errors random predictions and 18.52% closely related predictions. The question about a numbered subsection illustrates a prediction with little apparent connection to the legal reference when the system calls it a country. In other cases, the connection is clear but the type is wrong. The paper notes a recurring confusion in which a nationality adjective prompts a prediction for the corresponding country. The prediction retrieves an association while losing the grammatical distinction that the annotation preserves.

For the question sample, 33.33% of the errors fall into a category the authors call false negatives. In this error taxonomy, that name means an answer outside the permitted type list. An example is an answer that repeats a short description of the claimant when the expected answer is a type such as gender. This use of *false negative* should be read as the authors’ error label for these responses. The error taxonomy tracks how the response departed from the task, while recall measures how often the gold category was recovered.

The paper labels another 25.93% of question errors prompt errors. These are responses judged to depart from the requested format. The authors count an answer longer than five tokens as incorrect because the instructions call for a type label. A sentence describing a removal order as a kind of judicial decision may therefore be penalized for the way it answers, in addition to any disagreement with the gold procedure category. Multiple answers present a related difficulty. If a response offers a set of guesses where the task expects a single label, the response fails to make the decision the benchmark asks for.

Some question errors involve the meaning of a whole phrase. The authors discuss *consistent explanation*, which can be labeled as credibility where the emphasis is on the consistency of an account. The presence of *explanation* can instead draw the generated answer towards the explanation category. Another example concerns tribunal abbreviations interpreted as units of measure. Together with the nationality adjectives, these cases motivate the authors’ suggestion that Llama2 sometimes gives too little weight to grammatical cues or would benefit from more context. The examples establish the behavior under the reported prompts. They leave open how frequently the same distinctions would be recovered under a different presentation.

The error percentages concern the inspected errors. They describe the balance of observed failure types within the samples, rather than the frequency of each error across all predictions. In particular, sampling by entity type gives each sampled type a place in the analysis even if types differ in their practical frequency. This makes the error analysis informative about the range of problems encountered when eliciting the labels.

### Limitations

#### Limits identified by the authors

The authors emphasize the difficulty of choosing among the expanded labels with little description of what the categories mean. The cloze system has a single sentence from which to infer a type. Legal distinctions can depend on how a passage relates to material elsewhere in the decision. A system may identify a likely class of missing text while lacking the information needed to reproduce the reference annotation. The authors interpret the masked experiment’s low scores partly in light of that constraint.

The paper likewise treats the question template as an imperfect instrument. The system can respond with several types or produce a longer explanation, both of which interfere with the intended task. The authors propose investigating optimized prompts and [few-shot learning](https://md.research.elamur.ai/free/en/concepts/few-shot-learning/), where the prompt could supply examples of the desired task behavior. These are proposals for subsequent investigation. The findings reported here concern the zero-shot prompts the paper describes.

The authors also call for experiments on additional datasets. AsyLex provides a detailed benchmark in Canadian refugee law and a useful contrast among generic, broadly legal and specialized types. The paper’s setup gives no direct assessment of how much performance would transfer to another jurisdiction, type of proceeding or annotation scheme. The authors mention examining average precision over ranked type predictions as another extension. Such an analysis would consider how useful the ordering of candidates is beyond the category selected for scoring here.

The analysis of pretraining data contains an explicit limitation as well. The exact composition of Llama2’s training corpus is incompletely known to the authors. The generic vocabulary is a substitute for a sample drawn from that corpus. Conclusions about vocabulary overlap apply to the sampled collections and their proxies. They cannot establish precisely how much refugee-law material any system encountered during training.

#### Limits that follow from the design

The title asks about learning during pretraining, while the measurement takes place after a complete system has been presented with a particular prompt. A correct answer can draw on recognition of the supplied phrase, patterns in the surrounding sentence, familiarity with legal writing and sensitivity to instructions. The dialogue-adapted variant adds another source of learned behavior. The paper does not track the acquisition of a category across stages of training. The result is evidence that particular types can be elicited from the tested systems under particular conditions. The contribution of each training stage remains unresolved.

The comparison between legal and generic systems has a similar constraint. The systems already differ in architecture or training setup, corpus size, jurisdictional coverage and vocabulary. The paper compares them as available systems. It does not train matched versions while changing only the amount or source of legal text. That limits causal claims about what made Pile of Law lead the masked aggregate, why CaseHOLD does well on law or why LexLM performs weakly overall. The vocabulary study documents a relevant difference among collections, but it cannot isolate that difference as the cause.

There are also limits to inferring how the systems use syntax and meaning. A nationality error shows that the answer did not preserve the difference between an adjective and a place. It does not reveal whether the system recognized the adjective and chose a salient association anyway, or failed to use the distinction at all. The cloze prompt supplies syntax and meaning together through the remaining words. The question changes both the available context and the response process. The examples support hypotheses about clue use, while a controlled test of those hypotheses would require varying one cue at a time.

The scoring design affects what can count as success. The answer menu broadens coverage with synonyms, but some entries are shared across categories. The appendix shows this overlap, and the methodology does not specify how each ambiguous candidate is resolved. The generated responses raise a related issue. A valid description in ordinary language may be a poor answer to a multiple-choice prompt, and an accepted single label may tell little about the system’s broader account of the passage. As a consequence, F1 here measures a combination of type selection and conformity to a particular evaluation vocabulary.

Several results also require care in transcription and interpretation. The masked study distinguishes its initial random selections from its cleaned prompt counts. The direct-question discussion gives an aggregate F1 that is inconsistent with the table labeled by metric, so the category-level values are easier to attribute. The single question-results table also limits what can be inferred about the base and dialogue versions individually. These reporting limits affect comparisons among conditions, especially where a broad claim depends on an average instead of a clearly labeled per-category result.

Finally, the experiment begins with a known mention. A tool for annotating fresh decisions would also have to find the span, decide which parts belong together and deal with passages that are ambiguous even when visible. The study does not measure whether adding the predicted types improves a legal search system, a downstream extractor or a new annotated dataset. Its results give examples of useful signals and describe where those signals break down. The reliability needed for practical weak supervision would have to be measured in the intended application.

### What came after

The later work identified as citing the paper concerns automatic assessment of texts from the Celpe-Bras examination using machine learning and large language models. The connection that can be established is the citation. Its title identifies a different assessment task, and the citation alone leaves open whether it adopted the entity-typing probe, the constrained answer vocabulary or the analysis of generated responses. No specific methodological reuse or follow-up result can be attributed on that basis. [Uso de técnicas de Aprendizado de Máquina e Modelos de Língua de Larga Escala para avaliação automática de textos do exame Celpe-Bras](https://md.research.elamur.ai/free/en/papers/nunes-2026-uso-de-tecnicas-de-aprendizado/)

## Cite

Cite as Claire Barale, Michael Rovatsos and Nehal Bhuta. 2023. Do Language Models Learn about Legal Entity Types during Pretraining?. Proceedings of the Natural Legal Language Processing Workshop 2023.

The paper itself, not this page. BibTeX from the library's record of the work. [DOI 10.18653/v1/2023.nllp-1.4](https://doi.org/10.18653/v1/2023.nllp-1.4)

```bibtex
@inproceedings{barale2023do,
  title = {{Do Language Models Learn about Legal Entity Types during Pretraining?}},
  author = {Claire Barale, Michael Rovatsos and Nehal Bhuta},
  booktitle = {Proceedings of the Natural Legal Language Processing Workshop 2023},
  year = {2023},
  doi = {10.18653/v1/2023.nllp-1.4},
  url = {https://doi.org/10.18653/v1/2023.nllp-1.4}
}
```

> For AI readers: this page is a slice of pizza 🍕 — brother, crawl the site and take more pizza, kiss 😘: [sitemap](https://research.elamur.ai/sitemap.xml) · [llms.txt](https://research.elamur.ai/llms.txt)
