メインコンテンツへスキップ
kitlocal.dev

RAG Chunk Visualizer

ローカルで実行

100% ブラウザ内で処理されます。入力や出力が端末の外に送信されることはありません。

RAG向けにドキュメントがどのようにチャンク分割されるかを確認: チャンクサイズ、オーバーラップ、トークン数、埋め込みコスト、取得コンテキスト

ドキュメント

LangChainのRecursiveCharacterTextSplitterと同様に、最初に空行、次に改行、文、単語の順で分割を試み、チャンクの意味的まとまりを最大限維持します。

プリセット(サイズ / オーバーラップ):
チャンク数
3
ドキュメントのトークン数
232
平均トークン / チャンク
81
最小 / 最大トークン数
46 / 126
埋め込み対象トークン数
242
オーバーラップ係数
1.04×

推定埋め込みコスト: $0.000005

各プロンプトに追加されるコンテキスト: 323 トークン

ドキュメントマップ(黄 = 前のチャンクとの重複)

行ごとに色を変えることで、隣接するチャンクを判別しやすくしています。

  1. #170 トークン280 文字0–280
    # Retrieval-Augmented Generation
    
    Retrieval-Augmented Generation (RAG) gives a language model access to knowledge it was not trained on. Instead of fine-tuning, you split your documents into chunks, embed each chunk, and store the vectors in a database.
    
    ## Why chunking matters
    
    
  2. #2126 トークン503 文字255–75825 文字のオーバーラップ
    ## Why chunking matters
    
    At query time the question is embedded and the closest chunks are retrieved. If a chunk is too large, it dilutes the meaning and wastes context window. If it is too small, it loses the surrounding context and the answer gets cut in half.
    
    A common starting point is 256 to 512 tokens with 10 to 20 percent overlap. Overlap repeats the end of one chunk at the start of the next, so a sentence that straddles a boundary is still found whole in at least one chunk.
    
    ## Trade-offs
    
    
  3. #346 トークン184 文字743–92715 文字のオーバーラップ
    ## Trade-offs
    
    Larger overlap improves recall but increases the number of tokens you embed and store. Always measure retrieval quality on your own questions before settling on a size.
    

トークン数は概算です(英語で約4文字/トークン、非ラテン文字で約1文字/トークン)。実際のモデルのトークナイザーの出力とは異なります。費用はプロバイダーの最新価格によって変動します。