/ Модель

Характеристики

Контекст
514 токенов
Параметры
138 млн
Лицензия
cc
Архитектура
roberta · dense
Опубликована
13 фев 2023

legal-portuguese-roberta-base

Заполнение пропусковТекст → текст3 профессии

Португалоязычная RoBERTa, предварительно обученная на юридических текстах для заполнения масок и дообучения на задачах обработки юридических документов.

106скачиваний за 30 дней2лайкавеса обновлены6 авг 2023

Бенчмарки

Как модель справилась с задачами пользователей ailist и что о ней публикуют открытые лидерборды

Публичные оценки

Из открытых лидербордов. Сравнивайте результаты одного теста при одинаковых условиях — отсутствие оценки не значит, что модель хуже.

В подключённых источниках результатов для этой модели пока нет.

Что умеет модель

Описание составлено по карточке модели и метаданным Hugging Face

joelniklaus/legal-portuguese-roberta-base — языковая модель RoBERTa, разработанная Джоэлом Никлаусом и предварительно обученная на юридических текстах на португальском языке. Модель содержит 137,8 млн параметров, принимает текст с маскированными токенами и предсказывает пропущенные токены; максимальный контекст составляет 514 токенов. В репозитории представлены веса PyTorch.

Модель предназначена прежде всего для дообучения на юридических задачах, зависящих от контекста предложения: классификации последовательностей, разметки токенов и ответов на вопросы. Она также подходит для прямого заполнения масок. Лицензия указана в метаданных как CC, а в README — как CC BY-SA; перед использованием следует сверить точные условия лицензии в карточке модели.

Сценарии применения

  • предсказание пропущенных слов в португалоязычных юридических текстах
  • дообучение классификатора юридических документов
  • разметка сущностей и терминов в юридических текстах
  • дообучение модели для ответов на вопросы по юридическим текстам

Ограничения

Предназначена в первую очередь для юридических текстов; на текстах других областей качество может снижаться. Возможны предвзятые и вредные стереотипные предсказания; для генерации текста модель не предназначена.

Для каких профессий подходит3

Разделы каталога профессий, в задачах которых используется эта модель

Все профессии

Карточка модели

README от автора на Hugging Face, как он его опубликовал

Открыть на Hugging Face

Model Card for joelito/legal-portuguese-roberta-base

This model is a monolingual model pretrained on legal data. It is based on XLM-R (base and large). For pretraining we used the Portuguese portion of Multi Legal Pile (Niklaus et al. 2023), a multilingual dataset from various legal sources covering 24 languages.

Model Details

Model Description

  • Developed by: Joel Niklaus: huggingface; email
  • Model type: Transformer-based language model (RoBERTa)
  • Language(s) (NLP): Portuguese
  • License: CC BY-SA

Uses

Direct Use and Downstream Use

You can utilize the raw model for masked language modeling since we did not perform next sentence prediction. However, its main purpose is to be fine-tuned for downstream tasks.

It's important to note that this model is primarily designed for fine-tuning on tasks that rely on the entire sentence, potentially with masked elements, to make decisions. Examples of such tasks include sequence classification, token classification, or question answering. For text generation tasks, models like GPT-2 are more suitable.

Additionally, the model is specifically trained on legal data, aiming to deliver strong performance in that domain. Its performance may vary when applied to non-legal data.

Out-of-Scope Use

For tasks such as text generation you should look at model like GPT2.

The model should not be used to intentionally create hostile or alienating environments for people. The model was not trained to be factual or true representations of people or events, and therefore using the models to generate such content is out-of-scope for the abilities of this model.

Bias, Risks, and Limitations

Significant research has explored bias and fairness issues with language models (see, e.g., Sheng et al. (2021) and Bender et al. (2021)). Predictions generated by the model may include disturbing and harmful stereotypes across protected classes; identity characteristics; and sensitive, social, and occupational groups.

Recommendations

Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model.

How to Get Started with the Model

See huggingface tutorials. For masked word prediction see this tutorial.

Training Details

This model was pretrained on Multi Legal Pile (Niklaus et al. 2023).

Our pretraining procedure includes the following key steps:

(a) Warm-starting: We initialize our models from the original XLM-R checkpoints (base and large) of Conneau et al. (2019) to benefit from a well-trained base.

(b) Tokenization: We train a new tokenizer of 128K BPEs to cover legal language better. However, we reuse the original XLM-R embeddings for lexically overlapping tokens and use random embeddings for the rest.

(c) Pretraining: We continue pretraining on Multi Legal Pile with batches of 512 samples for an additional 1M/500K steps for the base/large model. We use warm-up steps, a linearly increasing learning rate, and cosine decay scheduling. During the warm-up phase, only the embeddings are updated, and a higher masking rate and percentage of predictions based on masked tokens are used compared to Devlin et al. (2019).

(d) Sentence Sampling: We employ a sentence sampler with exponential smoothing to handle disparate token proportions across cantons and languages, preserving per-canton and language capacity.

(e) Mixed Cased Models: Our models cover both upper- and lowercase letters, similar to recently developed large PLMs.

Training Data

This model was pretrained on the Portuguese portion of Multi Legal Pile (Niklaus et al. 2023).

Preprocessing

For further details see Niklaus et al. 2023

Training Hyperparameters

  • batche size: 512 samples
  • Number of steps: 1M/500K for the base/large model
  • Warm-up steps for the first 5% of the total training steps
  • Learning rate: (linearly increasing up to) 1e-4
  • Word masking: increased 20/30% masking rate for base/large models respectively

Evaluation

For more detailed insights into the performance on downstream tasks, such as LEXTREME (Niklaus et al. 2023) or LEXGLUE (Chalkidis et al. 2021), we refer to the results presented in Niklaus et al. (2023) 1, 2.

For further insights into the evaluation, we refer to the trainer state. Additional information is available in the tensorboard.

Model Architecture and Objective

It is a RoBERTa-based model. Run the following code to view the architecture:

from transformers import AutoModel
model = AutoModel.from_pretrained('joelito/legal-portuguese-roberta-base')
print(model)

RobertaModel(
  (embeddings): RobertaEmbeddings(
    (word_embeddings): Embedding(32000, 768, padding_idx=0)
    (position_embeddings): Embedding(514, 768, padding_idx=0)
    (token_type_embeddings): Embedding(1, 768)
    (LayerNorm): LayerNorm((768,), eps=1e-05, elementwise_affine=True)
    (dropout): Dropout(p=0.1, inplace=False)
  )
  (encoder): RobertaEncoder(
    (layer): ModuleList(
      (0-11): 12 x RobertaLayer(
        (attention): RobertaAttention(
          (self): RobertaSelfAttention(
            (query): Linear(in_features=768, out_features=768, bias=True)
            (key): Linear(in_features=768, out_features=768, bias=True)
            (value): Linear(in_features=768, out_features=768, bias=True)
            (dropout): Dropout(p=0.1, inplace=False)
          )
          (output): RobertaSelfOutput(
            (dense): Linear(in_features=768, out_features=768, bias=True)
            (LayerNorm): LayerNorm((768,), eps=1e-05, elementwise_affine=True)
            (dropout): Dropout(p=0.1, inplace=False)
          )
        )
        (intermediate): RobertaIntermediate(
          (dense): Linear(in_features=768, out_features=3072, bias=True)
          (intermediate_act_fn): GELUActivation()
        )
        (output): RobertaOutput(
          (dense): Linear(in_features=3072, out_features=768, bias=True)
          (LayerNorm): LayerNorm((768,), eps=1e-05, elementwise_affine=True)
          (dropout): Dropout(p=0.1, inplace=False)
        )
      )
    )
  )
  (pooler): RobertaPooler(
    (dense): Linear(in_features=768, out_features=768, bias=True)
    (activation): Tanh()
  )
)

Compute Infrastructure

Google TPU.

Hardware

Google TPU v3-8

Software

pytorch, transformers.

Citation


@article{Niklaus2023MultiLegalPileA6,
  title={MultiLegalPile: A 689GB Multilingual Legal Corpus},
  author={Joel Niklaus and Veton Matoshi and Matthias Sturmer and Ilias Chalkidis and Daniel E. Ho},
  journal={ArXiv},
  year={2023},
  volume={abs/2306.02069}
}

Model Card Authors

Joel Niklaus: huggingface; email

Veton Matoshi: huggingface; email

Model Card Contact

Joel Niklaus: huggingface; email

Veton Matoshi: huggingface; email

Как запустить

На своей GPU в ailist. Цена — по текущим предложениям провайдеров

GPU в ailist

Универсальный рантайм · fill-mask

Можно запустить

Подбираем GPU…

Класс архитектуры
RobertaForMaskedLM
Ревизия весов
5ec51d7

0 моделей