チャット¶
チャットは、プロンプトを送信してLLMから回答を受信するアクティビティです。 チャット は、チャットプロンプトのコレクションです。 LLMの設定を行ったら、(パネル下部のエントリーボックスから)プロンプトを送信して、LLMブループリントのデプロイを検討する前に、さらに微調整が必要かどうかを判断します。
プレイグラウンド内でのチャットは「会話」で、それに続くプロンプトでフォローアップの質問をすることができます。 以下は、DataRobotオートパイロットを実行するためのPythonコードの出力をLLMに求める例です。
フォローアップ質問の結果は、 コンテキスト認識が有効化されているかどうかによって異なります(例の続きを参照してください)。 プレイグラウンドを使用して、システムプロンプトと設定に満足するまでプロンプトをテストおよびチューニングします。 次に、右側のパネルの下部にある設定を保存をクリックします。
コンテキスト認識チャット¶
LLMブループリントを設定する際、 プロンプティングタブで履歴認識を設定します。
コンテキストには2つの状態があります。 チャット履歴をプロンプトと一緒に送信して、回答に関連するコンテキストを含めるかどうかを制御します。
状態 | 説明 |
---|---|
コンテキスト認識 | 入力を送信する際、以前のチャット履歴がプロンプトに含まれます。 この状態がデフォルトです。 |
コンテキスト認識なし | チャットからの履歴をコンテキストに含めない。 |
備考
Consider the context state and how it functions in conjunction with the selected retriever method.
チャット内で、1回限り(コンテキストなし)とコンテキストアウェアを切り替えることができます。 これらはそれぞれ独立した履歴コンテキストのセットになります。コンテキストアウェアからコンテキストなし、そしてコンテキストアウェアに戻ると、プロンプトから以前の履歴がクリアされます。 (これが行われるのは、新しいプロンプトが送信されたときだけです。)
コンテキストの状態は2つの方法で報告されます。
-
バッジは、設定ビューと比較ビューの両方でLLMブループリント名の右側に表示され、現在のコンテキストの状態を報告します。
-
設定ビューでは、コンテキスト設定の状態がディバイダーによって示されます。
上記の例を使用して、「そのコード」に変更を加えるように求めることができます。コンテキスト認識を有効にすると、LLMは以前の会話履歴を「認識」するため、参照されているコードを認識して応答します。
最適化されたプロンプト(Few-shotプロンプティングを含む)の作成に関する情報については、 プロンプティングリファレンスを参照してください。
単一チャットと比較チャットの比較¶
単一のLLMブループリントとのチャットは、他のLLMブループリントとプロンプトでの比較を開始する前にチューニングするのに適した方法です。 比較では、複数のLLMブループリント間の回答を比較して、本番環境に移行するものを決定できます。
備考
比較プロンプトは、作成したLLMブループリントでのみ実行できます。 共有ユースケースで他のユーザーのLLMブループリントをプロンプトした結果を確認するには、ブループリントをコピーし、同じ設定を適用してチャットします。 これは意図的な操作です。LLMブループリントをプロンプトするとチャット履歴に影響し、その結果、生成される回答に影響する可能性があるためです。 ただし、回答へのフィードバックを行うことで、開発を支援できます。
単一のLLMブループリントのチャット¶
LLMブループリントを最初に設定するとき、作成プロセスの一部にチャットが含まれます。 チャットをアクティブにするには、設定を行って保存します。
チャットの結果が表示されたら、必要に応じて設定を調整し、再度プロンプトを実行します。 各チャット結果で使用できる追加のアクションを使用して、詳細情報とプロンプトを取得します。
オプション | 説明 |
---|---|
設定を表示 | そのプロンプトが使用した設定を右側の設定パネルに表示します。 チャット中に設定を変更していない場合、変更はありません。 このツールを使用すると、以前の設定をリコールし、LLMブループリントをこれらの設定に復元できます。 |
トレースを開く | トレースログを開きます。このログには、LLMの回答の生成に使用されたすべてのコンポーネントとプロンプティングアクティビティが表示されます。 |
プロンプトと応答を削除 | チャット履歴からプロンプトと回答の両方を削除します。 削除すると、将来の回答のコンテキストと見なされなくなります。 |
LLMにプロンプトを送信すると、それらのチャットのレコードがDataRobotに保持されます。 既存のチャットのコンテキストに追加するか、新しいチャットを開始することができます。新しいチャットを開始した場合、履歴内の他のチャットのコンテキストは引き継がれません。
新しいチャットを開始すると、単一のブループリントで複数の独立した会話スレッドを設定できます。 このようにして、回答を「汚染」する可能性のある以前のプロンプト回答の履歴を取り込むことなく、さまざまなタイプのトピックに基づいてLLMブループリントを評価できます。 これは、コンテキストをオフにしてプロンプトを送信し、コンテキストを再度オンにすることで実行できますが、新しいチャットを開始する方がよりシンプルな方法です。
新しいチャットを開始をクリックして、クリーンな履歴から開始します。プロンプトが送信されると、DataRobotはチャットの名前を 新しいチャット からプロンプト内の単語に変更します。
比較LLMブループリントチャット¶
準備が整ったら、ブレッドクラムの比較をクリックして、回答を他のLLMブループリントと比較します。
比較を開始した後にさらにチューニングが必要と判断した場合、個々のLLMブループリントの設定を変更できます。
複数のLLMブループリントのチャットを並べて比較するには、 LLMブループリントの比較のドキュメントを参照してください。
回答フィードバック¶
回答フィードバック「thumbs」を使用して、プロンプトの回答を評価します。 回答は、 トレースタブのユーザーからのフィードバック列に記録されます。 AIカタログに送信されるエクスポート済みフィードバックの一部としての回答は、予測モデルのトレーニングなどに使用できます。
引用¶
引用は 指標であり、デフォルトでオンになっています(レイテンシー、プロンプトトークン、回答トークンと同様)。 引用符は、ベクターデータベースから取得されたプロンプトへの関連性に基づいて、上位のリファレンスドキュメントのチャンクのリストを提供します。 最初にベクターデータベースの作成に使用される埋め込みモデルは、取得される引用の品質に影響を与える可能性があることに注意してください。
備考
引用は、クエリーされるLLMブループリントがベクターデータベースに関連付けられている場合にのみ表示されます。 引用は利用可能な指標の1つですが、引用を返すために評価機能を有効にする 必要はありません 。
引用を安全チェックとして使用してLLMの回答を検証します。 引用は、LLMの回答を検証するのに役立ちますが、ベクターデータベースから適切に取得できるかどうか(LLMにコンテキストとして提供するチャンクをドキュメントから取得しているかどうか)を検証することもできます。さらに、LLMの回答がソースと一致するかどうかを測定するFaithfulness指標を有効にする場合、これは関連性において引用の出力に依存します。
ROUGEスコア¶
ROUGE scores, also known as confidence scores, calculates the distance between the response generated from an LLM blueprint and the documents retrieved from the vector database. They indicate how close the response is to the provided context. ROUGE scores are computed using the factual consistency metric approach, where a score is computed using the facts retrieved from the vector database and the generated text from the LLM blueprint. The similarity metric used is the ROUGE-1 (Recall-Oriented Understudy for Gisting Evaluation) metric. DataRobot GenAIは、 "The limits of automatic summarization according to ROUGE"からのインサイトに基づいて、ROUGE-1の改善されたバージョンを使用します。 The ROUGE scoring algorithm is not scaled; instead, DataRobot uses heuristic coefficients.
The ROUGE score is reported in the prompt response:
類似度スコア¶
The similarity score is based on the distance of the query embedding to the chunk embedding in the vector space; the larger the similarity score, the better. Do not use this score to compare results between vector databases, only to compare values for retrievals within a single vector databases. The score informs "this chunk is more similar than that chunk to the given query."
The similarity score is reported in the citation:
How is the similarity score calculated?
TLDR: The similarity score displayed in the citation is based on the Hamming distance returned by the binary index during vector search, rescored to cosine similarities with the float embeddings of the user query, and then rounded to two decimals.
Similarity scores are based on the distance scores that Facebook AI Similarity Search (FAISS) returns along the indices as a result of the vector search. These binary indices use the Hamming distance as their distance function to find the top_k
nearest vectors for a given query vector. Instead of using the raw distance scores (which are integers because the vectors in the binary indexes are binary quantized, DataRobot uses a rescoring method adopted from sentence transformers:
-
Retrieve
rescore_multiplier * top_k
results with the binary query embedding and the binary document embeddings (i.e., the list of the first k results of the binary retrieval). -
Rescore that list of binary document embeddings with the initial (before they got quantized) float query embeddings.
Rescoring is performing a dot product operation between float vectors, returning cosine similarite (multiply corresponding elements of the vectors, sum the results to produce a single scalar value). Applying this rescoring step preserves total retrieval performance, reduces memory and disk space usage, and improves the retrieval speed.
-
Finally, DataRobot rounds the scores to two digits because of floating point arithmetic precision issues caused by numpy, binary quantization, and the rescoring method.
Because rescoring is performing a dot product with the embeddings, which leads to a cosine similarity, the higher the value, the better.
Metadata filtering¶
Use metadata filtering to limit the citations returned by the prompt query. When configured, the LLM blueprint only returns chunks that include the specified metadata column-value pair. You can add a filter for each metadata column, as needed. Each metadata column can be paired with a single value.
備考
Vector databases created before the introduction of metadata filtering do not support this feature. To use filtering with them, create a version from the original and configure the LLM blueprint to use the new vector database instead.
To create a metadata filter, click Filter metadata below the prompt entry box.
All optional metadata column names appear in the dropdown, as well as the option source
, which is content from the document_file_path
column. If the vector database includes no optional metadata, only source
is available for selection. Select a colum name and enter a single value. The value must be an exact string match from the vector database (partial matches are not allowed). Use Add filter to add filters for different metadata columns
備考
If the value entered for a source is not an exact match, while a response is returned there are no citations available. This is because there was not match on the filter.
If the LLM blueprint configuration does not include a vector database, clicking Filter metadata displays the following:
To enable filtering, add a vector database that includes a minimum of the required document
and document_file_path
(shown as source
in filtering) columns.
Metadata filtering example¶
The following example, which uses the DataRobot documentation as the vector database, compares results to the same prompt ("how do I deploy a model?") with and without a metadata filter applied.
| The image on the left has no filtering. The image on the right set the value of source
to source: datarobot_english_documentation/datarobot_docs | en | mlops | deployment | deploy-methods | deploy-model.txt
. This is a value in the document_file_path
column of the data source. Notice the differences, particularly in prompt tokens and ROUGE score. |
When you open citations for the filtered prompt, you can see the source is only the one path: