見出し画像

【日本語LLM】Ollamaで利用可能な日本語対応embeddingモデル【Ruri】

はじめに

少しおバカさんのローカルのLLM(Large Language Model)を利用する上で、重要になる技術がRAG(Retrieval-Augmented Generation)です。具体的な手法はさまざまですが、LLM推論時の辞書のような役割をします。

ローカルLLMをGUIで利用できる(Ollama)Open WebUIでは、RAGを利用できますが、利用するためには本体LLM以外に「embeddingモデル」「rerankerモデル」が必要になります。

しかし、ローカルで利用できる日本語対応モデルが少ないのが現状です。

最近Ollamaライブラリに、日本語専用のembeddingモデルが(たぶん初めて)登録されたので紹介と動作レビューしたいと思います。

【PR】Open WebUIの詳細な導入方法や使い方は下記事で紹介しています。

Ruri

Ollamaライブラリに登録されたこちらのkun432氏のモデルを利用します。

説明文に記載のhuggingfaceのページはこちら、名古屋大学研究室のモデルですね。

論文はこちら、

Abstract
We report the development of Ruri, a series of Japanese general text embedding models. While the development of general-purpose text embedding models in English and multilingual contexts has been active in recent years, model development in Japanese remains insufficient. The primary reasons for this are the lack of datasets and the absence of necessary expertise. In this report, we provide a detailed account of the development process of Ruri. Specifically, we discuss the training of embedding models using synthesized datasets generated by LLMs, the construction of the reranker for dataset filtering and knowledge distillation, and the performance evaluation of the resulting general-purpose text embedding models.

引用:https://huggingface.co/papers/2409.07737

Open WebUIの設定

埋め込みモデルエンジンをOllamaにして、埋め込みモデルを「kun432/cl-nagoya-ruri-large:latest」にします。

ブリッジ検索をオンにして、モデルの再ランキング欄に「cl-nagoya/ruri-reranker-large」と入力して、ダウンロードアイコンをクリックします。←動作しないようです(Embeddingモデルのみの動作です)

日本語pdfを扱う場合はTikaがおすすめです。(別途導入が必要です)

実行

ブリッジ検索(rerankerモデル)が利用出来ないので、Ruri embeddingモデルのみでの動作です。

LLMはMistral社とNVIDIA社開発のMistral-nemo(12B)の日本語チューニング版を利用します。※ Ollamaで利用可能なモデルがないため、仕方なく自分で量子化しました


日本で最も高い山のランキング表を作成して。トップ5位まで表示して。

Web検索

日本アニメまどか☆マギカの主要登場人物の一覧とその解説文を作成して。

Web検索(そもそもネット単純検索だけではズバリ回答を得られないため、精度が悪いようです)
Wikipediaのテキスト文章を直接参照(少し精度が上がりました)

最近の企業によるAI活用状況を整理して。

Web検索
引用トップ

まとめ

embeddingモデルだけでも、十分に実用レベルで抽出できていると思います。


この記事が気に入ったらサポートをしてみませんか?