模型概述
模型特點
模型能力
使用案例
🚀 LEGAL-BERT:剛從法學院畢業的布偶們
LEGAL-BERT 是一系列適用於法律領域的 BERT 模型,旨在助力法律自然語言處理研究、計算法學以及法律科技應用。為了預訓練不同版本的 LEGAL-BERT,我們從多個領域(如立法、法院判例、合同等)的公開資源中收集了 12GB 多樣的英文法律文本。子領域變體模型(如 CONTRACTS-、EURLEX-、ECHR-)和/或通用的 LEGAL-BERT 在特定領域任務中的表現優於直接使用 BERT 模型。
這是在歐盟立法文本上進行預訓練的子領域變體模型。
引用信息
I. Chalkidis、M. Fergadiotis、P. Malakasiotis、N. Aletras 和 I. Androutsopoulos 所著的 “LEGAL-BERT: The Muppets straight out of Law School”,發表於 2020 年線上舉辦的自然語言處理經驗方法研討會(EMNLP 2020)的研究成果(短篇論文)。(https://aclanthology.org/2020.findings-emnlp.261)
✨ 主要特性
- 專為法律領域定製,基於豐富多樣的英文法律文本進行預訓練。
- 不同子領域變體模型在特定法律任務中表現出色。
📦 安裝指南
文檔未提及安裝步驟,若有需求可參考 Hugging Face Transformers 庫的安裝方式。
💻 使用示例
基礎用法
from transformers import AutoTokenizer, AutoModel
tokenizer = AutoTokenizer.from_pretrained("nlpaueb/bert-base-uncased-eurlex")
model = AutoModel.from_pretrained("nlpaueb/bert-base-uncased-eurlex")
📚 詳細文檔
預訓練語料
LEGAL-BERT 的預訓練語料包括:
- 116,062 份歐盟立法文檔,可從 EURLEX(http://eur-lex.europa.eu )獲取,該平臺由歐盟出版局運營,是歐盟法律的存儲庫。
- 61,826 份英國立法文檔,可從英國立法門戶網站(http://www.legislation.gov.uk )獲取。
- 19,867 份歐洲法院(ECJ)的判例,同樣可從 EURLEX 獲取。
- 12,554 份歐洲人權法院(ECHR)的判例,可從 HUDOC(http://hudoc.echr.coe.int/eng )獲取。
- 164,141 份美國各地法院的判例,可從判例法訪問項目門戶網站(https://case.law )獲取。
- 76,366 份美國合同文檔,來自美國證券交易委員會(SECOM)的 EDGAR 數據庫(https://www.sec.gov/edgar.shtml )。
預訓練詳情
- 使用 Google BERT 的 GitHub 倉庫(https://github.com/google-research/bert )提供的官方代碼進行訓練。
- 發佈的模型類似於英文 BERT-BASE 模型(12 層、768 隱藏層、12 頭注意力機制、1.1 億參數)。
- 採用相同的訓練設置:100 萬訓練步驟,批次大小為 256 個長度為 512 的序列,初始學習率為 1e - 4。
- 使用了由 TensorFlow 研究雲(TFRC) 免費提供的單個 Google Cloud TPU v3 - 8,並利用了 GCP 研究信用額度。非常感謝 Google 的這兩個項目提供的支持!
模型列表
模型名稱 | 模型路徑 | 訓練語料 |
---|---|---|
CONTRACTS - BERT - BASE | nlpaueb/bert-base-uncased-contracts |
美國合同 |
EURLEX - BERT - BASE | nlpaueb/bert-base-uncased-eurlex |
歐盟立法 |
ECHR - BERT - BASE | nlpaueb/bert-base-uncased-echr |
歐洲人權法院判例 |
LEGAL - BERT - BASE * | nlpaueb/legal-bert-base-uncased |
所有語料 |
LEGAL - BERT - SMALL | nlpaueb/legal-bert-small-uncased |
所有語料 |
* LEGAL - BERT - BASE 即 Chalkidis 等人(2020 年)中提到的 LEGAL - BERT - SC 模型;該模型在下面提到的法律語料庫上從頭開始訓練,使用由在相同語料庫上訓練的 sentence - piece 分詞器創建的新詞彙表。
** 由於很多人對 LEGAL - BERT - FP 模型(基於原始 BERT - BASE 檢查點的模型)感興趣,這些模型已發佈在 Archive.org(https://archive.org/details/legal_bert_fp )上,因為這些模型是次要的,可能僅對那些希望深入研究 Chalkidis 等人(2020 年)提出的開放性問題的人有吸引力。
將 LEGAL - BERT 變體用作語言模型
語料 | 模型 | 掩碼標記 | 預測結果 |
---|---|---|---|
BERT - BASE - UNCASED | |||
(合同) | This [MASK] Agreement is between General Motors and John Murray . | employment | ('new', '0.09'), ('current', '0.04'), ('proposed', '0.03'), ('marketing', '0.03'), ('joint', '0.02') |
(歐洲人權法院) | The applicant submitted that her husband was subjected to treatment amounting to [MASK] whilst in the custody of Adana Security Directorate | torture | ('torture', '0.32'), ('rape', '0.22'), ('abuse', '0.14'), ('death', '0.04'), ('violence', '0.03') |
(歐盟立法) | Establishing a system for the identification and registration of [MASK] animals and regarding the labelling of beef and beef products . | bovine | ('farm', '0.25'), ('livestock', '0.08'), ('draft', '0.06'), ('domestic', '0.05'), ('wild', '0.05') |
CONTRACTS - BERT - BASE | |||
(合同) | This [MASK] Agreement is between General Motors and John Murray . | employment | ('letter', '0.38'), ('dealer', '0.04'), ('employment', '0.03'), ('award', '0.03'), ('contribution', '0.02') |
(歐洲人權法院) | The applicant submitted that her husband was subjected to treatment amounting to [MASK] whilst in the custody of Adana Security Directorate | torture | ('death', '0.39'), ('imprisonment', '0.07'), ('contempt', '0.05'), ('being', '0.03'), ('crime', '0.02') |
(歐盟立法) | Establishing a system for the identification and registration of [MASK] animals and regarding the labelling of beef and beef products . | bovine | (('domestic', '0.18'), ('laboratory', '0.07'), ('household', '0.06'), ('personal', '0.06'), ('the', '0.04') |
EURLEX - BERT - BASE | |||
(合同) | This [MASK] Agreement is between General Motors and John Murray . | employment | ('supply', '0.11'), ('cooperation', '0.08'), ('service', '0.07'), ('licence', '0.07'), ('distribution', '0.05') |
(歐洲人權法院) | The applicant submitted that her husband was subjected to treatment amounting to [MASK] whilst in the custody of Adana Security Directorate | torture | ('torture', '0.66'), ('death', '0.07'), ('imprisonment', '0.07'), ('murder', '0.04'), ('rape', '0.02') |
(歐盟立法) | Establishing a system for the identification and registration of [MASK] animals and regarding the labelling of beef and beef products . | bovine | ('live', '0.43'), ('pet', '0.28'), ('certain', '0.05'), ('fur', '0.03'), ('the', '0.02') |
ECHR - BERT - BASE | |||
(合同) | This [MASK] Agreement is between General Motors and John Murray . | employment | ('second', '0.24'), ('latter', '0.10'), ('draft', '0.05'), ('bilateral', '0.05'), ('arbitration', '0.04') |
(歐洲人權法院) | The applicant submitted that her husband was subjected to treatment amounting to [MASK] whilst in the custody of Adana Security Directorate | torture | ('torture', '0.99'), ('death', '0.01'), ('inhuman', '0.00'), ('beating', '0.00'), ('rape', '0.00') |
(歐盟立法) | Establishing a system for the identification and registration of [MASK] animals and regarding the labelling of beef and beef products . | bovine | ('pet', '0.17'), ('all', '0.12'), ('slaughtered', '0.10'), ('domestic', '0.07'), ('individual', '0.05') |
LEGAL - BERT - BASE | |||
(合同) | This [MASK] Agreement is between General Motors and John Murray . | employment | ('settlement', '0.26'), ('letter', '0.23'), ('dealer', '0.04'), ('master', '0.02'), ('supplemental', '0.02') |
(歐洲人權法院) | The applicant submitted that her husband was subjected to treatment amounting to [MASK] whilst in the custody of Adana Security Directorate | torture | ('torture', '1.00'), ('detention', '0.00'), ('arrest', '0.00'), ('rape', '0.00'), ('death', '0.00') |
(歐盟立法) | Establishing a system for the identification and registration of [MASK] animals and regarding the labelling of beef and beef products . | bovine | ('live', '0.67'), ('beef', '0.17'), ('farm', '0.03'), ('pet', '0.02'), ('dairy', '0.01') |
LEGAL - BERT - SMALL | |||
(合同) | This [MASK] Agreement is between General Motors and John Murray . | employment | ('license', '0.09'), ('transition', '0.08'), ('settlement', '0.04'), ('consent', '0.03'), ('letter', '0.03') |
(歐洲人權法院) | The applicant submitted that her husband was subjected to treatment amounting to [MASK] whilst in the custody of Adana Security Directorate | torture | ('torture', '0.59'), ('pain', '0.05'), ('ptsd', '0.05'), ('death', '0.02'), ('tuberculosis', '0.02') |
(歐盟立法) | Establishing a system for the identification and registration of [MASK] animals and regarding the labelling of beef and beef products . | bovine | ('all', '0.08'), ('live', '0.07'), ('certain', '0.07'), ('the', '0.07'), ('farm', '0.05') |
下游任務評估
可參考論文 “LEGAL - BERT: The Muppets straight out of Law School” 中的實驗。Chalkidis 等人,2020 年,(https://aclanthology.org/2020.findings-emnlp.261)
作者與出版物
@inproceedings{chalkidis-etal-2020-legal,
title = "{LEGAL}-{BERT}: The Muppets straight out of Law School",
author = "Chalkidis, Ilias and
Fergadiotis, Manos and
Malakasiotis, Prodromos and
Aletras, Nikolaos and
Androutsopoulos, Ion",
booktitle = "Findings of the Association for Computational Linguistics: EMNLP 2020",
month = nov,
year = "2020",
address = "Online",
publisher = "Association for Computational Linguistics",
doi = "10.18653/v1/2020.findings-emnlp.261",
pages = "2898--2904"
}
關於我們
雅典經濟與商業大學自然語言處理小組 致力於開發讓計算機處理和生成自然語言文本的算法、模型和系統。
該小組目前的研究興趣包括:
- 用於數據庫、本體、文檔集合和網絡的問答系統,特別是生物醫學問答。
- 從數據庫和本體(特別是語義網絡本體)生成自然語言。
- 文本分類,包括過濾垃圾郵件和不良內容。
- 信息提取和觀點挖掘,包括法律文本分析和情感分析。
- 希臘語自然語言處理工具,如解析器和命名實體識別器。
- 自然語言處理中的機器學習,特別是深度學習。
該小組隸屬於雅典經濟與商業大學信息學系信息處理實驗室。
Ilias Chalkidis 代表 雅典經濟與商業大學自然語言處理小組
| GitHub: @ilias.chalkidis | Twitter: @KiddoThe2B |
📄 許可證
本項目採用 CC - BY - SA - 4.0 許可證。



