NLLB200の各モデルごとの日→英翻訳精度とシステム負荷(VRAM使用量)を検証した

NLLB200の各モデルごとの日→英翻訳精度とシステム負荷(VRAM使用量)を検証した ソフトウェア

200言語翻訳AI「NLLB200」の5つのモデルのうち、デカすぎる540億パラメーターのものを除いた4つの翻訳品質を比較検証し、ついでにVRAM使用量も調べてみました。

今回は日本語から英語への翻訳精度について検証し、DeepL・Google翻訳と比較も行いました。

なお翻訳精度についてはChatGPT先生の添削&採点を採用してみました。

Windowsローカル環境への導入法はこちらを参考にしてください。

チェック!!
さくいん! 本サイトのAI関連記事まとめ どれから見れば良いのか?!


数十記事ある本サイトのAI関連記事を体系的にまとめました。

目的別にどれから見れば良いのかわかります!!

AI記事索引ページはコチラ

1. 対象のモデルと翻訳精度検証のやり方など

対象のモデル

以下表の最上段のものを除いた4つです。

モデル名モデルタイプパラメーター数
NLLB-200MoE54.5B
NLLB-200Dense3.3B
NLLB-200Dense1.3B
NLLB-200-蒸留Dense1.3B
NLLB-200-蒸留Dense600M
https://github.com/facebookresearch/fairseq/tree/nllb

コチラのモデル読み込み部分だけ書き換えてみました。

翻訳精度の試験のやり方 ChatGPT先生の出番です!!

私

今から日本語英語の翻訳精度を精査したいのですが、どのような観点がありますか

ChatGPT
ChatGPT

日本語英語の翻訳精度を精査する場合、以下のような観点が考慮されることが一般的です。

  1. 正確性(Accuracy): 翻訳の正確性がどの程度であるか、原文と翻訳文とを比較して調べます。言い換えた場合、翻訳の誤訳や漏訳が含まれていないかを調べます。
  2. 自然さ(Fluency): 翻訳が自然で読みやすいかどうか、翻訳文の流暢さや文章の構造などを評価します。言い換えれば、翻訳が文法的に正確であるだけでなく、自然な表現が含まれているかどうかを調べます。
  3. 場面適応性(Appropriateness): 翻訳が文脈に適切であるかどうか、翻訳文の内容が原文と一致しているか、意図された意味を正しく表現しているかどうかを評価します。言い換えれば、翻訳が原文の意図を適切に表現しているかどうかを調べます。

これらの観点を踏まえて、翻訳精度を精査することが重要です。

また、人間による評価と機械翻訳による評価では、評価の基準が異なるため、どちらも参考にして総合的に評価することが望ましいです。

私

ではこれから、それら3つの観点それぞれでの評価を行い、
講評つきで成績を出してもらいます。

分かりましたか?

ChatGPT
ChatGPT

はい、分かりました。
3つの観点についてそれぞれ評価し、講評をつけて成績を出すことになりますね。
どのようなテキストを用いて精査を行う予定でしょうか?

私

そうですね、
まず日本語→英語の翻訳を評価したいので、難易度が適切に異なる複数のテキストを用意してください。

そのテキストを数人が翻訳した結果を書き込むのでそれぞれを評価してください

ChatGPT
ChatGPT

分かりました。

以下は、異なる難易度とテーマの日本語のテキストを3つ用意しました。複数の人に翻訳してもらい、それぞれの翻訳を評価していただければと思います。

【テキスト1】

難易度:低

テーマ:食べ物

テキスト: みかんは、日本でよく食べられる柑橘類です。冬になると、スーパーなどで売られるようになります。皮をむいて食べるのが一般的ですが、ジュースにしたり、煮物やマーマレードにしたりすることもできます。

【テキスト2】

難易度:中

テーマ:観光地紹介

テキスト: 京都は、日本の伝統的な文化を感じられる観光地のひとつです。有名な神社仏閣やお寺が数多くあり、四季折々の美しい景色が楽しめます。また、京都の食文化も魅力のひとつで、おばんざいや日本茶などが味わえます。

【テキスト3】

難易度:高

テーマ:科学技術

テキスト: 人工知能(AI)は、機械が人間のような知能を持つことを指します。最近では、AIを活用したサービスや製品が増えてきています。例えば、自動運転車や音声アシスタントなどがあります。AIの技術は今後も進化し続けることが予想されています。

と、いうわけで早速評価していきます。

いやーChatGPT便利過ぎますわ!!!

冗長なところは手動で編集しつつ、概ねChatGPTの回答をそのまま引用してみます。

2. 各モデルの翻訳精度とVRAM消費量

NLLB-200(3.3B)の場合

  1. VRAM消費量:13.6 GB
  2. 翻訳精度(日本語→英語):300点満点中298点
【テキスト1】の翻訳
Miken is a type of Japanese cucumber commonly eaten in Japan. It is sold in supermarkets and other places in the winter. It is commonly eaten with the skin, but it can also be used in juice, stew, and marmalade.

【テキスト2】の翻訳
Kyoto is one of the tourist destinations where you can experience the traditional culture of Japan. There are many famous shrines and temples, and you can enjoy the beautiful scenery of the four seasons. Also, Kyoto's food culture is one of the attractions, you can taste sake and Japanese tea.

【テキスト3】の翻訳
refers to machines that have human-like intelligence. Recently, there has been an increase in the number of services and products that use AI, such as self-driving cars and voice assistants. AI technology is expected to continue to evolve.
ChatGPT
ChatGPT

【テキスト1】

正解:100点

講評:完璧な翻訳です。原文の意味を正確に伝えています。

【テキスト2】

正解:98点

講評:ほとんど正確な翻訳ですが、”sake”は日本酒のことであり、”obaanzai”はおばんざいのことであるため、訳が逆になっています。また、”日本茶”を”Japanese tea”と訳すのは正確ですが、”green tea”と表現するとより一般的です。

【テキスト3】

正解:100点

講評:完璧な翻訳です。原文の意味を正確に伝えています。

NLLB-200(1.3B)の場合

  1. VRAM消費量: 6.3 GB
  2. 翻訳精度(日本語→英語):300点満点中280点
【テキスト1】の翻訳
It is a common Japanese snack. In winter, it is sold in supermarkets. It is common to eat it with its skin, but it can also be used in juice, stew or marmalade.
【テキスト2】の翻訳
Kyoto is one of the tourist destinations where you can feel the traditional culture of Japan. There are many famous shrines and Buddhist temples, and you can enjoy beautiful scenery every four seasons. Also, Kyoto's food culture is one of the attractions, you can taste baguette and Japanese tea.

【テキスト3】の翻訳
Artificial intelligence (AI) refers to machines having human-like intelligence. Recently, there has been an increase in services and products that leverage AI. For example, there are self-driving cars and voice assistants.
ChatGPT
ChatGPT

【テキスト1】

採点:90点

講評:翻訳はほぼ正確ですが、”snack”という単語が含まれていますが、日本語の原文にはそういう意味はありません。また、”citrus fruit”の方が正確な訳語です。

【テキスト2】

採点:95点

講評:ほぼ完璧な翻訳ですが、”おばんざい”を”local dishes”と訳すのは、文脈上は正しいですが、より具体的には”Kyoto-style home cooking”などの方が良いかもしれません。

【テキスト3】

採点:95点

講評:原文の意味を正確に伝え、表現が明確で自然である、非常に優れた翻訳です。ただし、2番目の文で「leverage」という表現を使用したことが、この文脈で最も自然な選択とは限らないという小さな問題があります。この文脈では、”Utilize”や”make use of”といった表現が適切な代替案となるかもしれません。

NLLB-200(1.3B-distilled)の場合

  1. VRAM消費量: 6.3 GB
  2. 翻訳精度(日本語→英語):300点満点中275点
回答は次の通りでした。

【テキスト1】の翻訳
Mikap is a commonly eaten snail in Japan. In winter, it is sold in supermarkets and other places. It is common to eat it with the skin, but it can also be made into juice, cooked or marmalade.

【テキスト2】の翻訳
Kyoto is one of the tourist destinations where you can feel the traditional culture of Japan. There are many famous shrines and temples, and you can enjoy the beautiful scenery of the four seasons. Also, Kyoto's food culture is one of the attractions, you can taste the bagel and Japanese tea.

【テキスト3】の翻訳
Artificial intelligence (AI) refers to the ability of machines to have intelligence similar to humans. Recently, there has been an increase in services and products that utilize AI. For example, there are self-driving cars and voice assistants. AI technology is expected to continue to evolve in the future.
ChatGPT
ChatGPT

テキスト1:

この文章は一部誤訳があります。”みかん”を”snail”と翻訳しているため、意味が通じません。正しくは、”みかん”は”mandarin orange”のように翻訳する必要があります。また、”皮をむいて食べるのが一般的ですが”は、”It is common to peel and eat them”のように翻訳する方がより自然な表現となります。

Score: 80/100

テキスト2:

この文章はほぼ正確に翻訳されていますが、”おばんざい”を”bagel”と翻訳するのは誤りです。”おばんざい”は、traditional Japanese side dishesの一種であるため、”Japanese small dishes”のように翻訳する必要があります。

Score: 95/100

テキスト3:

この文章は正確に翻訳されています。文章の表現方法や言い回しも自然で、誤訳や意訳がないことから、100点で評価します。

Score: 100/100

NLLB-200-distilled(600M)の場合

  1. VRAM消費量: 3.3GB
  2. 翻訳精度(日本語→英語):30点満点中245点
回答は次の通りでした。

【テキスト1】の翻訳
The Japanese are a popular snail, and in winter, they'll be sold in supermarkets and other places.

【テキスト2】の翻訳
Kyoto is one of the most popular tourist destinations in Japan, with many famous temples and temples, and beautiful four-season views.

【テキスト3】の翻訳
Artificial intelligence, or AI, refers to machines having human-like intelligence. Recently, there have been more and more AI-enabled services and products, like self-driving cars and voice assistants, and AI technology is expected to continue to evolve.
ChatGPT
ChatGPT

【テキスト1】

点数: 60点

講評: “Mikap”という単語は正しくなく、正しくは「Mikan」です。また、文章全体の印象としては、文法の間違いが多く、意味が通じない部分もあります。例えば、”eaten snail”という表現は正しくなく、”citrus fruit” が適切な表現です。最後に、「皮をむいて食べるのが一般的」という文を「It is common to eat it with the skin」と翻訳しましたが、正しくは「It is common to peel the skin before eating」となります。

【テキスト2】

点数: 90点

講評: ほぼ正確な翻訳です。ただし、「おばんざい」と「bagel」は似たような発音になりますが、全く異なる食べ物なので、注意が必要です。正しくは「Kyoto’s food culture is also one of the attractions, where you can enjoy traditional dishes like obanzai and Japanese tea」となります。

【テキスト3】

点数: 95点

講評: ほぼ正確な翻訳です。ただし、「machines having human-like intelligence」という表現が少し不自然であるため、「machines that can exhibit human-like intelligence」と表現する方が自然です。

参考:Google翻訳なら?

【テキスト1】の翻訳
Mikan is a citrus fruit commonly eaten in Japan. In winter, it will be sold in supermarkets. It is commonly eaten peeled, but it can also be juiced, boiled, or made into marmalade.

【テキスト2】の翻訳
Kyoto is one of the tourist destinations where you can feel the traditional culture of Japan. There are many famous shrines, temples and temples, and you can enjoy the beautiful scenery of each season. Kyoto's food culture is also one of its attractions, where you can enjoy obanzai and Japanese tea.

【テキスト3】の翻訳
Artificial intelligence (AI) refers to machines having human-like intelligence. Recently, the number of services and products that utilize AI is increasing. Examples include self-driving cars and voice assistants. AI technology is expected to continue to evolve in the future.
ChatGPT
ChatGPT

正しい翻訳です。全ての文章が正確に翻訳されていますので、100点と評価します。

流石ですね!

参考2:DeepL翻訳なら?

【テキスト1】の翻訳
Mikan is a citrus fruit commonly eaten in Japan. In winter, they are sold in supermarkets. They are generally peeled and eaten, but can also be made into juice, stewed, or marmalade.

【テキスト2】の翻訳
Kyoto is one of the most popular tourist destinations in Japan. There are many famous shrines, temples, and shrines, and beautiful scenery can be enjoyed in each of the four seasons. Kyoto's culinary culture is also one of its attractions, with obanzai (traditional Japanese dishes) and Japanese green tea available.

【テキスト3】の翻訳
Artificial intelligence (AI) refers to machines having human-like intelligence. Recently, an increasing number of services and products have been developed that utilize AI. Examples include self-driving cars and voice assistants, and AI technology is expected to continue to evolve.
ChatGPT
ChatGPT

All of your responses are accurate and convey the main points of the texts clearly. Well done!

なぜか返答英語になってるけど、やはり完璧らしいです。

参考3:別スレッドのChatGPTに英訳させたら?

【テキスト1】の翻訳
Mikan is a commonly eaten citrus fruit in Japan. It is sold in supermarkets and other places during winter. It is common to eat it peeled, but it can also be used to make juice, stew, and marmalade.

【テキスト2】の翻訳
Kyoto is one of the tourist destinations where you can experience traditional Japanese culture. There are many famous shrines, temples, and gardens, and you can enjoy the beautiful scenery of the four seasons. Also, Kyoto's food culture is one of the attractions, where you can taste obanzai (traditional Kyoto-style cuisine) and Japanese tea.

【テキスト3】の翻訳
Artificial intelligence (AI) refers to machines having human-like intelligence. Recently, there has been an increase in services and products that utilize AI, such as self-driving cars and voice assistants. The technology of AI is expected to continue to evolve in the future.
ChatGPT
ChatGPT

Thank you for your answers. They are all accurate and well-written. Is there anything else I can help you with?

「全部正確でよく書けてるヨ!!」とのことでした。

追加検証:半精度(fp16)なら翻訳品質落ちる?

NLLB-200(1.3B)を以下の通りにして半精度でやってみました。

model = AutoModelForSeq2SeqLM.from_pretrained(
    "facebook/nllb-200-1.3B", torch_dtype=torch.float16
)
  • VRAM消費量: 6.3 GB→3.7 GB
  • 翻訳精度(日本語→英語):300点満点中280点275点

というわけでfp16にしても性能低下はごくわずかでした。
VRAM節約できるので、基本半精度でいきましょう!!
(画像生成AIでも実感してますが、単精度と半精度はほとんど品質が変わらないので、デフォが半精度でも良いんじゃね(素人並感))

3. まとめ NLLB200の日本語→英語の翻訳精度(DeepL,Google翻訳とも対決)

モデル名モデルタイプパラメーター数翻訳精度(ja→en)VRAM(GB)
NLLB-200MoE54.5B
NLLB-200Dense3.3B298/30013.6
NLLB-200Dense1.3B280/3006.3
NLLB-200-distilledDense1.3B275/3006.3
NLLB-200-distilledDense600M245/3003.3
Google翻訳完璧
DeepL翻訳完璧
ChatGPT完璧
https://github.com/facebookresearch/fairseq/tree/nllb

NLLB-200-1.3B実用に耐える高い品質翻訳して、VRAMも少なくて済むのでおすすめです。

NLLB200の真髄はオフラインで高精度な翻訳ができるところにあるので、それネットの英訳でいいんじゃね?!は禁句です。。。

会員登録・クレジットカード登録・API使用申請やら面倒なことをせず無料で無制限でプライバシーも万全(そもそもオフラインだからどこにも情報をアップロードしていない)な点がNLLB200の魅力です!!

NLLB200日本語不可のAIを日本語対応にする際にも役立ちます。

例えばGoogle製質疑応答AI「Flan-t5」を日本語対応させました。

追記:日本語と英語に特化した、NLLB200より高精度かつ軽量な翻訳AI「FuguMT」もあります。

他にも色々とAI関連の記事を書いています。合わせてご覧ください。

画像生成AI「Stable Diffusion」を動かす方法

コード生成AI「santacoder」をWindowsローカル環境で動かす方法

文章生成AI「GPT-2/rinna」をWindowsローカルで動かすには

タイトルとURLをコピーしました