🚀 PaECTER - 特許類似度モデル
PaECTER (Patent Embeddings using Citation - informed TransformERs) は特許類似度モデルです。GoogleのBERT for Patentsをベースモデルとして構築され、特許テキストから1024次元の密ベクトル埋め込みを生成します。これらのベクトルは与えられた特許テキストの意味的な本質を包含しており、特許分析に関連する様々な下流タスクに非常に適しています。
論文: https://arxiv.org/pdf/2402.19411
🚀 クイックスタート
✨ 主な機能
- 意味検索
- 先行技術検索
- クラスタリング
- 特許ランドスケーピング
📦 インストール
sentence - transformers をインストールすることで、このモデルを簡単に使用できます。
pip install -U sentence-transformers
💻 使用例
基本的な使用法 (Sentence - Transformers)
from sentence_transformers import SentenceTransformer
sentences = ["This is an example sentence", "Each sentence is converted"]
model = SentenceTransformer('mpi-inno-comp/paecter')
embeddings = model.encode(sentences)
print(embeddings)
高度な使用法 (HuggingFace Transformers)
sentence - transformers を使用しない場合、まず入力をトランスフォーマーモデルに通し、その後文脈化された単語埋め込みに適切なプーリング操作を適用する必要があります。
from transformers import AutoTokenizer, AutoModel
import torch
def mean_pooling(model_output, attention_mask):
token_embeddings = model_output[0]
input_mask_expanded = attention_mask.unsqueeze(-1).expand(token_embeddings.size()).float()
return torch.sum(token_embeddings * input_mask_expanded, 1) / torch.clamp(input_mask_expanded.sum(1), min=1e-9)
sentences = ['This is an example sentence', 'Each sentence is converted']
tokenizer = AutoTokenizer.from_pretrained('mpi-inno-comp/paecter')
model = AutoModel.from_pretrained('mpi-inno-comp/paecter')
encoded_input = tokenizer(sentences, padding=True, truncation=True, return_tensors='pt', max_length=512)
with torch.no_grad():
model_output = model(**encoded_input)
sentence_embeddings = mean_pooling(model_output, encoded_input['attention_mask'])
print("Sentence embeddings:")
print(sentence_embeddings)
📚 ドキュメント
評価結果
このモデルの評価については、論文 PaECTER: Patent - level Representation Learning using Citation - informed Transformers で確認できます。
学習
このモデルは以下のパラメータで学習されました。
DataLoader:
torch.utils.data.dataloader.DataLoader
(長さ318750) で、以下のパラメータを使用:
{'batch_size': 4, 'sampler': 'torch.utils.data.sampler.RandomSampler', 'batch_sampler': 'torch.utils.data.sampler.BatchSampler'}
損失関数:
sentence_transformers.losses.CustomTripletLoss.CustomTripletLoss
で、以下のパラメータを使用:
{'distance_metric': 'TripletDistanceMetric.EUCLIDEAN', 'triplet_margin': 1}
fit() メソッドのパラメータ:
{
"epochs": 1,
"evaluation_steps": 4000,
"evaluator": "sentence_transformers.evaluation.TripletEvaluator.TripletEvaluator",
"max_grad_norm": 1,
"optimizer_class": "<class 'torch.optim.adamw.AdamW'>",
"optimizer_params": {
"lr": 1e-05
},
"scheduler": "WarmupLinear",
"steps_per_epoch": null,
"warmup_steps": 31875.0,
"weight_decay": 0.01
}
モデルの完全なアーキテクチャ
SentenceTransformer(
(0): Transformer({'max_seq_length': 512, 'do_lower_case': False}) with Transformer model: BertModel
(1): Pooling({'word_embedding_dimension': 1024, 'pooling_mode_cls_token': False, 'pooling_mode_mean_tokens': True, 'pooling_mode_max_tokens': False, 'pooling_mode_mean_sqrt_len_tokens': False, 'pooling_mode_weightedmean_tokens': False, 'pooling_mode_lasttoken': False})
)
📄 ライセンス
このモデルはApache 2.0ライセンスの下で提供されています。
引用と著者
@misc{ghosh2024paecter,
title={PaECTER: Patent-level Representation Learning using Citation-informed Transformers},
author={Mainak Ghosh and Sebastian Erhardt and Michael E. Rose and Erik Buunk and Dietmar Harhoff},
year={2024},
eprint={2402.19411},
archivePrefix={arXiv},
primaryClass={cs.IR}
}