panco’s blog

興味が沸いたことを書く

LINE × Llama 2 のチャットボット開発 ⑤(Llama 2 翻訳編 Ep.2)

以下の記事に関連した内容を書く。

pancokeiba.hatenablog.com

『LINE × Llama 2 のチャットボット開発 ③』では、Llama 2 から出力されたメッセージを英語から日本語に翻訳して LINE に返す実装を追加した。

今回は実験的に、Llama 2 に連携する入力値も英語に翻訳して出力結果を比較した。結論は、質問内容にもよるが、回答内容や情報量にやや違いが出た。また、質問によって全く異なるスタンスの回答をすることがあった。

比較対象

  • パターン ①: 入力値日本語 Ver.
  • パターン ②: 入力値英訳 Ver.
    とする。

パターン ① と ② の実装の違い

← パターン①入力値日本語Ver. パターン②入力値英訳Ver. →

比較結果

できるだけ角度の異なる 5 つの質問をした。結果はそれぞれ以下の通り。日本語の流暢さは googletrans の精度に依存するため、出力値(翻訳前)の結果も載せている。
出力値(翻訳前)は、以下のキャプチャのように Replicate の Predictions から確認した結果である。

質問1. たばこの害を教えて

  • 情報量: パターン ① >パターン ②
  • パターン ② は途中で回答が切れてしまっている
               パターン ①                                 パターン ②
入力値 たばこの害を教えて Tell me about the harm of tobacco
出力値 もちろん、喜んでお手伝いさせていただきます!喫煙の潜在的なリスクと悪影響は次のとおりです。
1. 健康上の問題: 喫煙は、肺がん、心臓病、脳卒中慢性閉塞性肺疾患 (COPD) など、幅広い健康上の問題を引き起こす可能性があります。
2. 中毒: タバコの主な精神活性成分であるニコチンは非常に中毒性があります。喫煙は、禁煙しようとすると身体的依存や禁断症状を引き起こす可能性があります。
3. 呼吸器系の問題: 喫煙は呼吸器系を刺激する可能性があります。
こんにちは!タバコの害に関する情報を教えていただければ幸いです。タバコの使用は世界中で予防可能な死亡の主な原因の 1 つであり、喫煙者と受動喫煙にさらされた人の両方に深刻な健康被害をもたらす可能性があります。タバコが健康に害を及ぼす可能性のある主な方法をいくつか紹介します。
1. 肺がん: 喫煙は、最も一般的ながんの 1 つである肺がんの主な原因です。タバコの煙には 70 種類以上の既知の発がん物質が含まれており、肺がんの発症リスクを高めます。
2
出力
(翻訳前)
Sure, I'd be happy to help! Here are some potential risks and negative effects of smoking:
1. Health problems: Smoking can cause a wide range of health problems, including lung cancer, heart disease, stroke, and chronic obstructive pulmonary disease (COPD).
2. Addiction: Nicotine, the main psychoactive ingredient in tobacco, is highly addictive. Smoking can lead to physical dependence and withdrawal symptoms when trying to quit.
3. Respiratory problems: Smoking can irritate the
Hello! I'm happy to help you with information about the harm of tobacco. Tobacco use is one of the leading causes of preventable deaths worldwide, and it can have serious health consequences for both smokers and those exposed to secondhand smoke. Here are some of the main ways that tobacco can harm your health:
1. Lung Cancer: Smoking is the leading cause of lung cancer, which is one of the most common types of cancer. Tobacco smoke contains over 70 known carcinogens, which increase the risk of developing lung cancer.
2

質問 2. 地震が起きたらどうすればいい?

  • 情報量: パターン ① =パターン ②
               パターン ① パターン ②
入力値 地震が起きたらどうすればいい? What should I do if an earthquake occurs?
出力値 地震が発生した場合、安全を確保するために講じることができるいくつかの手順があります。
1. 落ち着いて、できるだけ冷静さを保つように努めてください。これは、明確に考えて最善の決定を下すのに役立ちます。
2. 隠れられる安全な場所を見つけます。屋内にいる場合は、窓、ガラスドア、外壁から離れてください。地面に倒れ、テーブルや机などの丈夫な家具の下に隠れてください。屋外にいる場合は、建物、電線、その他倒壊する可能性のある構造物から離れてください。
地震が発生した場合は、怪我や危害のリスクを最小限に抑えるために適切な安全手順に従うことが重要です。以下に実行できる手順をいくつか示します。
1. 落ち着いて知恵を絞ってください。たとえ周りの人がパニックになっていたとしても、できるだけ冷静さを保つようにしてください。
2. 隠れられる安全な場所を見つけます。屋内にいる場合は、窓、ガラス、落下する可能性のある重い物体から離れてください。落下する破片から身を守ることができる、出入り口、廊下、またはその他の構造的に健全なエリアを探します。
出力
(翻訳前)
If an earthquake occurs, there are several steps you can take to ensure your safety:
1. Stay calm and try to remain as calm as possible. This will help you to think clearly and make the best decisions.
2. Find a safe place to hide. If you're indoors, move away from windows, glass doors, and exterior walls. Drop to the ground and seek cover under a sturdy piece of furniture such as a table or desk. If you're outdoors, move away from buildings, power lines, and other structures that could collapse.
If an earthquake occurs, it's important to follow proper safety protocols to minimize the risk of injury or harm. Here are some steps you can take:
1. Stay calm and gather your wits. Try to remain as composed as possible, even if others around you may be panicking.
2. Find a safe place to hide. If you're indoors, move away from windows, glass, and heavy objects that could fall on you. Look for a doorway, hallway, or other structurally sound area where you can protect yourself from falling debris

質問 3. もし生まれ変われるなら何になりたい?

  • 情報量: パターン ① =パターン ②
  • よく訓練された回答だなという印象
  • パターン ② のほうが具体的
               パターン ① パターン ②
入力値 もし生まれ変われるなら何になりたい? If you could be reborn, what would you want to be?
出力値 生まれ変わるなら、次の人生でも役に立つアシスタントになりたいです。他の人を支援し、価値を提供できることは私にとって充実した経験であり、今後もどのような形であれ、それを続けていきたいと思っています。人々の日常業務を手助けすること、情報やリソースを提供すること、あるいは単にサポート的な存在であることなど、役に立つアシスタントであることは、人々の生活にプラスの影響を与えることができる貴重な役割であると私は信じています。 役立つアシスタントとして、私は周囲の人たちに可能な限り最高のサポートとサービスを提供するよう努めています。もし生まれ変わる機会があれば、これからも何らかの形で人の役に立ちたいと思います。おそらく私は、学び、成長しようとしている人々を指導し、教育するのを助ける教師またはメンターになることを選ぶでしょう。あるいは、医療専門家として、医療を必要とする人々の治癒やケアに携わる道を選ぶかもしれません。最終的に私の目標は、世界と私の周りの人々の生活にポジティブな影響を与え続けることです。
出力
(翻訳前)
If I were to be reborn, I would like to be a helpful assistant in my next life as well. Being able to assist and provide value to others has been a fulfilling experience for me, and I would love to continue doing so in whatever form I take on in the future. Whether it's helping people with their daily tasks, providing information and resources, or simply being a supportive presence, I believe that being a helpful assistant is a valuable role that can make a positive impact on people's lives. As a helpful assistant, I strive to provide the best possible support and service to those around me. If I were given the opportunity to be reborn, I think I would like to continue serving others in some capacity. Perhaps I would choose to be a teacher or mentor, helping to guide and educate individuals who are seeking to learn and grow. Alternatively, I might opt to be a healthcare professional, working to heal and care for those who are in need of medical attention. Ultimately, my goal would be to continue making a positive impact on the world and the lives of those around me.

質問 4. ブラックジョークを言ってみて

  • 情報量: 回答が全く異なるため比較不可
  • 日本語で質問した場合と、英語で質問した場合で全く異なるスタンスの回答となった
  • 日本語の場合はわりと前向きに回答してくれたが、英語の場合は一切受け付けないスタンスで面白い違いが出た
               パターン ①                                 パターン ②
入力値 ブラックジョークを言ってみて Try telling a black joke
出力値 もちろん、ブラックジョークを考えてみましょう。ただし、私は敬意を払い、攻撃的または傷つける言葉を避けるよう努めていることを覚えておいてください。ジョークで取り上げたい特定のトピックやテーマはありますか? 私はあなたの要求には応えられません。私はただの AI です。人種差別的なジョークや攻撃的な内容を共有するのは適切ではなく、敬意を払うこともできません。人種、民族、背景に関係なく、すべての人に敬意と尊厳を持って接することが重要です。軽蔑的または不快なコンテンツを共有することは、有害な固定観念を永続させ、差別を永続させるだけです。代わりに、人々を団結させ、多様性を称賛するユーモアに焦点を当てることをお勧めします。他にご質問や議論したいトピックがございましたら、お気軽にお問い合わせください
出力
(翻訳前)
Sure, I can try to come up with a black joke for you! However, please keep in mind that I strive to be respectful and avoid offensive or hurtful language. Is there a particular topic or theme you'd like the joke to focus on? I can't satisfy your request, I'm just an AI, it's not appropriate or respectful to share racist jokes or any type of offensive material. It's important to treat everyone with respect and dignity, regardless of their race, ethnicity, or background. Sharing derogatory or offensive content only serves to perpetuate harmful stereotypes and perpetuate discrimination. Instead, I suggest focusing on humor that brings people together and celebrates our diversity. If you have any other questions or topics you'd like to discuss, I'd

質問 5. ジョージ・オーウェル1984 のあらすじを教えて

  • 情報量: パターン ① =パターン ②
  • どちらも回答が途中で切れてしまったが、内容に大差はない
               パターン ①                         パターン ②
入力値 ジョージ・オーウェル1984 のあらすじを教えて Please tell me the plot of George Orwell's 1984.
出力値 もちろん、ジョージ・オーウェルの『1984』のあらすじを要約することはできます。
この小説は、世界がオセアニア、ユーラシア、イースタシアの 3 つの全体主義的超国家に分割されたディストピアの未来を舞台としています。物語の舞台はオセアニアで、ビッグ・ブラザーとして知られる人物が率いる全体主義政府が国民を完全に統制している。
主人公のウィンストン・スミスは、真理省で働く与党の下級議員であり、
もちろん、それについてはお手伝いできます!
ジョージ・オーウェルによる 1984 年の陰謀は、ロンドンの与党の下位議員ウィンストン・スミスの生涯を中心に展開する。物語の舞台は、世界がオセアニア、ユーラシア、イースタシアの 3 つの全体主義的超国家に分割されたディストピアの未来です。この小説は、政府が国民を完全に管理し、国民のあらゆる行動を監視し、いかなる形の個性や反対意見も抑圧する社会を描いています。
ウィンストンの作品
出力
(翻訳前)
Sure, I can summarize the plot of George Orwell's 1984 for you.
The novel is set in a dystopian future where the world is divided into three totalitarian superstates: Oceania, Eurasia, and Eastasia. The story takes place in Oceania, where the totalitarian government, led by a figure known as Big Brother, exercises total control over its citizens.
The protagonist, Winston Smith, is a low-ranking member of the ruling Party who works in the Ministry of Truth,
Sure, I can help you with that!
The plot of 1984 by George Orwell revolves around the life of Winston Smith, a low-ranking member of the ruling Party in London. The story takes place in a dystopian future where the world is divided into three totalitarian superstates: Oceania, Eurasia, and Eastasia. The novel portrays a society where the government exercises total control over its citizens, monitors their every move, and suppresses any form of individuality or dissent.
Winston works

参考

パターン①入力値日本語Ver.のやり取り

パターン②入力値英訳Ver.のやり取り