/ Модель

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

Контекст
131 072 токена
Параметры
494 млн
Архитектура
qwen2 · dense
Библиотека
transformers
Опубликована
4 авг 2024

PII_DETECTION_MODEL

Генерация текстаТекст → текст8 профессий

Компактная многоязычная модель Betterdata.ai для поиска и разметки персональных данных в тексте перед его передачей внешним сервисам.

81скачиваний за 30 дней6лайковвеса обновлены8 авг 2024

Бенчмарки

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

Тесты пользователейпока нет

Никто ещё не опубликовал тест этой модели. Соберите бенчмарк из своих задач — результат появится здесь.

  1. Добавьте модель в бенчмарк

    Вместе с другими моделями категории «Текст» — сравнение идёт внутри одной категории.

  2. Опишите свои задачи

    Напишите запросы, при необходимости приложите файлы и эталонные ответы.

  3. Запустите и опубликуйте

    Модели ответят на каждую задачу, судья оценит ответы. Опубликованный результат появится на этой странице.

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

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

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

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

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

Модель PII_DETECTION_MODEL разработана Betterdata.ai для обнаружения и разметки персональных и конфиденциальных данных в тексте. Это дообученная версия декодерного трансформера Qwen2-0.5B с 494 млн параметров; модель принимает текст и выдаёт текст с метками классов для найденных данных. Заявлены 29 классов PII и поддержка английского, испанского, шведского, немецкого, итальянского, нидерландского и французского языков. Контекст модели составляет до 131 072 токенов.

Модель предназначена для маскирования PII перед отправкой текста во внешние языковые сервисы, а также для защиты данных в документах и приложениях. Разработчик отмечает, что модель компактна и рассчитана на работу с длинными документами, в том числе на CPU. Лицензия — Apache-2.0.

Точность не гарантируется: по данным карточки, модель лучше справляется с именами, адресами электронной почты и телефонами, а распознавание API-ключей, CVV и банковских счетов требует улучшения. Результаты следует проверять перед использованием в критичных сценариях.

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

  • поиск имён, адресов электронной почты и телефонов в документах
  • разметка персональных данных перед отправкой запросов во внешние LLM
  • обнаружение конфиденциальных данных в длинных текстах
  • поиск API-ключей и платёжных реквизитов для проверки утечек

Ограничения

Карточка отмечает, что модель может ошибаться: она лучше распознаёт имена, электронную почту и телефоны, чем API-ключи, CVV и номера банковских счетов. Перед применением в критичных сценариях результаты нужно проверять.

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

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

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

Также подходит для

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

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

Открыть на Hugging Face

Model Card

This model is used for PII detection. It covers 29 classes across 7 languages (English , Spanish, Swedish, German, Italian, Dutch, French)

Model Details

The model is built on top of the decoder transformer model (Qwen2-0.5B). We used publicly available datasets with a permissible license as well as synthetic data to train the model.

Model Description

  • Developed by: Betterdata.ai
  • Model type: Decoder Transformer
  • License: apache-2.0
  • Finetuned from model : Qwen2-0.5B

Uses

With the advent of chatGPT , professionals and organizations use public chat interfaces for various applications. This often leads to leakage of PII data which causes privacy issues as users enter names , dates or even API keys etc to give the model better context. With the PII class tags, these confidential information can be masked out as class tags which enable the end models to understand context without data leaving the server. Even developers or teams building applications with the help of third party API's can use these models for better privacy. The image below illustrates this:

Use Case

The PII model shouldn't add too much latency and be able to take in long documents, therefore we used the Qwen 0.5B as the base model. Another consideration for the model size was that we felt a model for privacy should be easy to run even on CPUs. We do have larger models in house with better performance. We have coverage for south east asian langauges as well as giving the user the ability to define custom user classes as part of our plans.

We will constantly be improving this model so always pull the latest version of the model.

Out-of-Scope Use

  1. We currently are trying to replace the PII text with the respective class tags. In the future we plan to replace the data with synthetic class values.

Bias, Risks, and Limitations

  1. Model may not be 100% accurate always but we are working on it.
  2. In our 'vibe test' where we fed the model with out of distribution data , the model does very well on classes like names , emails , phone numbers etc. We find that it can do better on classes like API_KEYS , credit card cvv numbers , bank account numbers. We are creating more data for these classes to futher improve performance. You can expect improvement in the next iteration.

How to Get Started with the Model

Use the code below to get started with the model.

from transformers import AutoModelForCausalLM , AutoTokenizer
import torch

device = "cuda" if torch.cuda.is_available() else "cpu"
model = AutoModelForCausalLM.from_pretrained("betterdataai/PII_DETECTION_MODEL").to(device)
tokenizer = AutoTokenizer.from_pretrained("betterdataai/PII_DETECTION_MODEL")

classes_list = ['<pin>','<api_key>','<bank_routing_number>','<bban>','<company>','<credit_card_number>','<credit_card_security_code>','<customer_id>','<date>','<date_of_birth>','<date_time>','<driver_license_number>','<email>','<employee_id>','<first_name>','<iban>','<ipv4>','<ipv6>','<last_name>','<local_latlng>','<name>','<passport_number>','<password>','<phone_number>','<social_security_number>','<street_address>','<swift_bic_code>','<time>','<user_name>']


prompt = """You are an AI assistant who is responisble for identifying Personal Identifiable information (PII). You will be given a passage of text and you have to \
identify the PII data present in the passage. You should only identify the data based on the classes provided and not make up any class on your own.

```PII Classes```
{classes}

The given text is:
{text}

The PII data are:
"""



user_input = "Write an email to Julia indicating I won't be coming to office on the 29th of June"
new_prompt = prompt.format(classes="\n".join(classes_list) , text=user_input)
tokenized_input = tokenizer(new_prompt , return_tensors="pt").to(device)

output = model.generate(**tokenized_input , max_new_tokens=6000)
pii_classes = tokenizer.decode(output[0] , skip_special_tokens=True).split("The PII data are:\n")[1]

print(pii_classes)

##output
"""
<name> : ['Julia']
<date> : ['the 29th of June']
"""

Evaluation

Testing Data, Factors & Metrics

Testing Data

  1. We developed an in house testset that we evaluate the model on. The test set was manually annotated to ensure high quality of the test set. The test set mainly comprises of financial documents , contracts etc across all the 7 languages, covering all the classes.

Metrics

  1. We used precision , recall and F1 score to evaluate the models output with the ground truth.

We consider precision and recall to be:

  • Precision: The ratio of correctly identified PII instances to the total identified instances.
  • Recall: The ratio of correctly identified PII instances to the total actual instances in the dataset.

Model Card Authors

Srinivasan

Model Card Contact

For feedback/suggestions and any collaborations reach us at:

srini@betterdata.ai contact@betterdata.ai

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

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

GPU в ailist

Универсальный рантайм · transformers

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

Подбираем GPU…

Класс архитектуры
Qwen2ForCausalLM
Ревизия весов
7d7ce49

0 моделей