GPT-4oやClaude-3.5-sonnetを凌ぐNVIDIA発の生成AI「Nemotron」が無料・登録不要で試せるので触ってみた【LLM】

生成AI

生成AIの特にLLM界隈はNemotronで持ち切りですね、ということで自分も触ってみました。
Nemotronにもいくつか種類がありますが、ここではLlama-3.1-Nemotron-70B-Instructを扱います。

概要

Nemotronとは

Nemortronについて、NVIDIAのXポストでは以下のように紹介されています。

当社のLlama-3.1-Nemotron-70B-Instructモデルは@lmarena_aiのArena Hardベンチマーク(85)におけるトップモデルです。

Arena Hard は、データパイプラインを使用して Chatbot Arena のライブデータから高品質のベンチマークを構築します。そして、Chatbot Arena Elo スコアの予測能力や、役立つモデルと役に立たないモデルの分離性能で知られています。

アプリケーションにおける LLM 生成応答の有用性を向上させるために、カスタマイズされたモデル Llama-3.1-Nemotron-70B をぜひ使用しようしてください。

何やら凄そうなことは伝わってきますね。

性能

公式発表によると、各AI指標について、Arena Hard で 85.0、 AlpacaEval 2 LC で 57.6、 GPT-4-Turbo MT-Bench で 8.98ポイントを獲得しており、GPT-4oなどと比較することで、いかに凄いことかをアピールしています。(実際に凄いことです。)

ModelArena HardAlpacaEvalMT-BenchMean Response Length
Details(95% CI)2 LC (SE)(GPT-4-Turbo)(# of Characters for MT-Bench)
Llama-3.1-Nemotron-70B-Instruct85.0 (-1.5, 1.5)57.6 (1.65)8.982199.8
Llama-3.1-70B-Instruct55.7 (-2.9, 2.7)38.1 (0.90)8.221728.6
Llama-3.1-405B-Instruct69.3 (-2.4, 2.2)39.3 (1.43)8.491664.7
Claude-3-5-Sonnet-2024062079.2 (-1.9, 1.7)52.4 (1.47)8.811619.9
GPT-4o-2024-05-1379.3 (-2.1, 2.0)57.5 (1.47)8.741752.2

試してみる

細かい話はさておき、実際に試してみます。

以下のNVIDIA公式サイトから、登録不要ですぐに動かすことができます。
登録不要というのがまた凄いですよね。

https://build.nvidia.com/nvidia/llama-3_1-nemotron-70b-instruct

入出力制限やデータセットについて聞いてみた

以下、実際のやり取りです。

質問1:「あなたはどれくらいまでの出力に対応していますか?」

私は、テキスト入力に対して、約20,000文字までの出力を対応できますが、入力の長さと内容によっては、実際の出力文字数が制限される場合があります。

質問2:「入力は?」

入力の対応範囲については以下の通りです。

文字数: 入力テキストの文字数は約 2048文字 まで対応しています。
言語: 主に 日本語 を中心に、英語 やその他の 多言語 (一部対応) にも対応しています。
形式: テキスト形式 (文章、会話、質問、文章の抜粋など) の入力に対応しています。画像、音声、動画ファイルなどの非テキスト形式は対応していません。
内容: 一般的なトピック (日常会話、ニュース、娯楽、教育、技術など) まで対応しています。高度な専門知識 (高度な医学用語、特定の学術研究など) や 最新のイベント (最新のニュース、リアルタイムのスポーツ結果など) に関する入力は、限られた範囲でのみ対応可能です。
質問の種類: 事実系の質問、説明を求める質問、比較を求める質問、簡単な文章の要約、簡単な翻訳 (主に日本語↔英語) などに対応しています。非常に抽象的または主観的な質問 (例: 「この世界の意味は何ですか?」など) には、限られた回答しか提供できません。

質問3:「どれくらい最新のデータまで対応してる?」

私のトレーニングデータは、**2022年末(2022年12月)**までの情報に基づいています。つまり、2023年以降のイベント、最新のトレンド、2023年以降に発表された新商品・新サービスなどについては、知識が不足している可能性があります。

以下は、主な対応範囲と対応限界を示した例です:

ニュース: 2022年12月までの主要な世界的および日本のニュースイベント
映画/ドラマ: 2022年12月までに公開/放送された作品
音楽: 2022年12月までにリリースされたアルバム/シングル
書籍: 2022年12月までに出版された本
科学技術:
一般的科学知識: 最新の研究結果まで対応していますが、非常に新しい(2023年以降の)突破的研究については対応できません。
コンピューターサイエンス: 2022年までの主要な技術トレンド(AI、機械学習、プログラミング言語など)に対応していますが、2023年以降に登場した新技術については対応できません。
スポーツ: 2022年までの主要なスポーツイベント(オリンピック、ワールドカップ、各国のプロスポーツリーグなど)
経済/株式市場: 2022年12月までの経済動向と主要な企業の情報
ご了承くださいが、上記の範囲外の情報については、最新の情報を提供することができません。最新の情報が必要な場合は、他の情報源(ニュースサイト、公式ウェブサイトなど)をご参照ください。

小まとめ

まとめると、こんな感じでしょうか。

  • 入力は約2,048文字まで対応
  • 出力は約20,000文字まで対応
  • 対応形式はテキストのみで、日本語や英語など多言語に対応
  • トレーニングデータは2022年末までの情報

データセットが古いのは気がかりですが、最新知識より性能を取るなら非常に有用ですね。

プログラム組んでもらった

Pythonのプログラミングを試しにやってもらいました。
流石に日本語は酷かなと思い、英語で入力しています。

入力内容1:"make some amazing python program."

Amazing Python Program: Interactive Hangman Game with Word Guessing and Score Tracking

Below is an engaging Python program that combines a Hangman game with word guessing and score tracking. This program is designed to be interactive, fun, and easy to understand, showcasing several key aspects of Python programming such as conditional statements, loops, lists, and file input/output for persistence.

Hangman Game Program

import random

# List of words to guess from
word_list = ['apple', 'banana', 'cherry', 'date', 'elderberry', 'fig', 'grape']

def hangman():
    word = random.choice(word_list)
    word_length = len(word)
    
    # For displaying the guessed word
    display = ['_'] * word_length
    guessed = False
    guessed_letters = []
    guessed_words = []
    tries = 6
    score = 0
    
    print("Let's play Hangman!")
    print(display_hangman(tries))
    print(' '.join(display))
    print("\n")
    
    while not guessed and tries > 0:
        guess = input("Please guess a letter or word: ").lower()
        
        if len(guess) == 1 and guess.isalpha():
            if guess in guessed_letters:
                print("You already guessed the letter", guess)
            elif guess not in word:
                print(guess, "is not in the word.")
                tries -= 1
                guessed_letters.append(guess)
            else:
                print("Good job,", guess, "is in the word!")
                guessed_letters.append(guess)
                word_as_list = list(word)
                indices = [i for i, letter in enumerate(word_as_list) if letter == guess]
                for index in indices:
                    display[index] = guess
        elif len(guess) == word_length and guess.isalpha():
            if guess in guessed_words:
                print("You already guessed the word", guess)
            elif guess != word:
                print(guess, "is not the word.")
                tries -= 1
                guessed_words.append(guess)
            else:
                guessed = True
                display = list(guess)
                score += 1
        else:
            print("Not a valid guess.")
        
        print(display_hangman(tries))
        print(' '.join(display))
        print("\n")
    
    if guessed:
        print("Congratulations, you guessed the word! You earned 1 point.")
        print("Your final score is:", score)
    else:
        print("Sorry, you ran out of tries. The word was " + word)
        print("Your final score is:", score)

    # Save score to file
    with open("hangman_score.txt", "a") as file:
        file.write("Game ended with score: " + str(score) + "\n")

    play_again = input("Play Again? (yes/no): ").lower()
    if play_again == "yes":
        hangman()
    else:
        print("Thanks for playing!")

def display_hangman(tries):
    stages = [  # final state: head, torso, both arms, and both legs
                """
                   --------
                   |      |
                   |      O
                   |     \\|/
                   |      |
                   |     / \\
                   -
                """,
                # head, torso, both arms, and one leg
                """
                   --------
                   |      |
                   |      O
                   |     \\|/
                   |      |
                   |     / 
                   -
                """,
                # head, torso, and both arms
                """
                   --------
                   |      |
                   |      O
                   |     \\|/
                   |      |
                   |      
                   -
                """,
                # head, torso, and one arm
                """
                   --------
                   |      |
                   |      O
                   |     \\|
                   |      |
                   |     
                   -
                """,
                # head and torso
                """
                   --------
                   |      |
                   |      O
                   |      |
                   |      |
                   |     
                   -
                """,
                # head
                """
                   --------
                   |      |
                   |      O
                   |    
                   |      
                   |     
                   -
                """,
                # initial empty state
                """
                   --------
                   |      |
                   |      
                   |    
                   |      
                   |     
                   -
                """
    ]
    return stages[tries]

if __name__ == "__main__":
    hangman()

How to Run:
Copy the Code: Copy the provided Python code into a text editor or an Integrated Development Environment (IDE) of your choice.
Save the File: Save the file with a .py extension, for example, hangman_game.py.
Run the Program: Open a terminal or command prompt, navigate to the directory where you saved hangman_game.py, and run the program by typing `python hang

入力内容2:"continue"

途切れちゃったので続けてもらいました。

Continuation of the Amazing Python Program: Interactive Hangman Game with Word Guessing and Score Tracking

How to Run (Continued):
Interact with the Game:
Guess a letter or the entire word when prompted.
Observe how the game updates the hangman figure and the word display based on your guesses.
Keep guessing until you correctly guess the word or run out of tries (6 attempts).
Review Score and Play Again:
After the game ends, your final score will be displayed.
You'll be prompted to play again. Type yes to restart the game or no to exit.
Additional Features and Code Explanations:
Score Tracking and Persistence
Score Display: The game displays your score at the end of each session.
Score Persistence: Scores are saved to a file named hangman_score.txt in the same directory as your Python script. Each game's final score is appended to this file.
Relevant Code Snippet for Score Persistence:

# Save score to file
with open("hangman_score.txt", "a") as file:
    file.write("Game ended with score: " + str(score) + "\n")

Hangman Figure Display
The game features a visually engaging hangman figure that updates based on the player's guesses.
The figure is defined as a list of multi-line strings (stages), with each stage representing a different state of the hangman's gallows.
Relevant Code Snippet for Hangman Figure Display:

def display_hangman(tries):
    stages = [  # ... definitions for each stage ...
    ]
    return stages[tries]

Word Selection and Guessing Mechanics
Random Word Selection: A word is randomly chosen from the predefined word_list at the start of each game.
Letter and Word Guessing: Players can guess either a single letter or attempt to guess the entire word.
Feedback Mechanism: The game provides immediate feedback on guesses, indicating correct letters, incorrect attempts, and previously guessed content.
Relevant Code Snippet for Word Guessing Mechanics:

if len(guess) == 1 and guess.isalpha():
    # Handle single letter guess
elif len(guess) == word_length and guess.isalpha():
    # Handle full word guess

Customization and Expansion Ideas:
Enhance Word List:
Add more words to the word_list for increased game variety.
Consider categorizing words (e.g., countries, animals, foods) for themed gameplay.
Implement Difficulty Levels:
Adjust the number of tries based on selected difficulty (e.g., easy, medium, hard).
Introduce more complex words for higher difficulty levels.
Visual and Audio Enhancements:
Utilize a library like tkinter or PyQt for a graphical interface.
Add sound effects for correct/incorrect guesses and game events.
Multiplayer Capability:
Design a system for multiple players to take turns guessing.
Keep track of individual scores for competitive gameplay.

小まとめ

小さい頃に英会話教室に通っていたり海外で過ごしたりした方なら知っているHangmanというゲームを作ってくれました。
一言で説明するなら「単語当てゲーム」です。

プログラム内容も、機能性や可読性が高く、(動かしていませんが)ちゃんと動きそうな感じがします。

まとめ

なかなか素晴らしい結果を得られました。

欲を言えば、無料で使える範囲ではChat GPTなどに比べてレスポンスが若干遅いのが気になりました。

また、70Bモデルなのでローカルで動かすとかなり重くなりそうだなとも思いました。

ただ、これらは「あれもこれも」とねだるようなものなので、素直に恩恵にあやかって今後の開発に活かせないか検討していこうと思います。

以上です。

【Reference】

https://huggingface.co/nvidia/Llama-3.1-Nemotron-70B-Instruct

https://build.nvidia.com/nvidia/llama-3_1-nemotron-70b-instruct

スポンサーリンク

生成AI

Posted by このめ