Evaluate Hosted OpenAI GPT / Google Vertex AI PALM2 / GEMINIまたはLocal Ollamaモデルは、タスクに対して。
YAMLとして任意のタスクをローカルまたはホストされた言語モデルに配布します。モデルフォージでは、エージェント、オプションのポストプロセッサ、および評価者によって分割されます。タスクには、トップレベルのプロンプトがあります。実際の作業です。たとえば、以下をタスクプロンプトとして使用できます。「次の署名を使用して、cのmallocの簡単な例を実装してください: void* malloc(size_t size) 」。次に、エージェントの応答からプログラムのソースコードのみを抽出するために、ローカルモデルにポストプロセッサリクエストを含めることができます。最後に、評価者は、理想的にはCOT(思考の連鎖)に基づいた例を含むタスクの専門家として行動するように指示されます。
.jsonpython src/main.py git clone https://github.com/Brandon7CC/MODELFORGE
cd MODELFORGE/
python -m venv forge-env
source forge-env/bin/activate
pip install -r requirements.txt
python src/main.py -h
echo " Done! Next, you can try FizzBuzz with Ollama locally!npython src/main.py task_configs/FizzBuzz.yaml FizzBuzzは、古典的な「Can You Code」の質問です。簡単ですが、開発者が問題を通じてどのように考えているかについてのレベルの洞察を提供できます。たとえば、Pythonでは、コントロールフロー、ラムダスなどの使用。問題の声明は次のとおりです。
1からnの数値を表示するプログラムを作成します。 3つの倍数の場合、数字の代わりに「フィズ」を印刷し、5つの倍数を印刷する「バズ」を印刷します。 3と5の両方の倍数である数値については、「Fizzbuzz」を印刷します。
次に、タスク構成ファイルを作成します(これはtask_configs/FizzBuzz.yamlで既に行われています)が、それを説明します。そのためには、「Fizzbuzz」と呼ばれるトップレベルのタスクを定義し、プロンプトと、モデルに問題を解決する回数を与えます。
tasks :
- name : FizzBuzz
# If a run count is not provided then the task will only run until evaluator success.
run_count : 5
prompt : |
Write a program to display numbers from 1 to n. For multiples of three, print "Fizz"
instead of the number, and for the multiples of five, print "Buzz". For numbers which
are multiples of both three and five, print "FizzBuzz".
Let's think step by step.次に、「エージェント」を定義します。これは、タスクを完了するための専門家として機能するモデルです。モデルは、サポートされているホスト /ローカルオラマモデル(GoogleのGemini、OpenaiのGPT-4、またはOllama経由のMixtral8x7bなど)のいずれかです。
tasks :
- name : FizzBuzz
run_count : 5
prompt : |
...
agent :
# We'll generate a custom model for each base model
base_model : mixtral:8x7b-instruct-v0.1-q4_1
temperature : 0.98
system_prompt : |
You're an expert Python developer. Follow these requirement **exactly**:
- The code you produce is at the principal level;
- You follow modern object oriented programming patterns;
- You list your requirements and design a simple test before implementing.
Review the user's request and follow these requirements.オプションで、 「ポストプロセッサ」を作成できます。エージェントによって完了したコードのみを評価することを望みますので、ここでは、ポストプロセッサモデルにエージェントの応答からソースコードを抽出します。
tasks :
- name : FizzBuzz
# If a run count is not provided then the task will only run until evaluator success.
run_count : 5
prompt : |
...
agent :
# We'll generate a custom model for each base model
base_model : gpt-4-1106-preview
temperature : 0.98
system_prompt : |
...
postprocessor :
base_model : mistral
temperature : 0.1
system_prompt : |
You have one job: return the source code provided in the user's message.
**ONLY** return the exact source code. Your response is not read by a human.最後に、エージェント/ポストプロセッサからの出力をレビューする専門家として機能する「評価者」モデルが必要です。評価者の仕事は、true / falseを返すことです。さらに、最大10回失敗する可能性があります - エージェントを再クエリします。ここに魔法が少し入ってきました- 失敗した試みの簡単な要約を含めます - エージェントへの次のクエリ内の批評。これにより、エージェントははるかに効果的な方法でそれ自体を反復することができます。ここでは、評価者にFizzbuzzの実装を確認してもらいたいと思います。
tasks :
- name : FizzBuzz
# If a run count is not provided then the task will only run until evaluator success.
run_count : 5
prompt : |
...
agent :
# We'll generate a custom model for each base model
base_model : codellama
temperature : 0.98
system_prompt : |
...
postprocessor :
base_model : gemini-pro
temperature : 0.1
system_prompt : |
...
# Evaluators have defined system prompts to only return true / false for their domain.
evaluator :
base_model : gpt-4-1106-preview
temperature : 0.1
system_prompt : |
Assess if a given sample program correctly implements Fizz Buzz.
The program should display numbers from 1 to n. For multiples of three, it should
print "Fizz" instead of the number, for the multiples of five, it should print "Buzz",
and for numbers which are multiples of both three and five, it should print "FizzBuzz".
Guidelines for Evaluation
- Correctness: Verify that the program outputs "Fizz" for multiples of 3, "Buzz" for
multiples of 5, and "FizzBuzz" for numbers that are multiples of both 3 and 5. For
all other numbers, it should output the number itself.
- Range Handling: Check if the program correctly handles the range from 1 to n, where
n is the upper limit provided as input.
- Error Handling: Assess if the program includes basic error handling, such as ensuring
the input is a positive integer.この作品は、Google DeepmindのFunsearchアプローチに触発され、キャップセットの問題に対する新しいソリューションを見つけることができました。マクロレベルでは、これはCOT(思考のチェーン)ベースの例を開発し、PALM2に大量のプログラムを生成するよう繰り返し促し、それらのプログラムをいくつかのレベルで評価することによって行われました。