aifree.dev

Vì sao RAG trả về sai đoạn văn?

Chunking: kích thước chunk, phần chồng lấn và chỗ cắt trong RAG · Thực hành · 5 phút · rag, embeddings · học sau Tìm kiếm ngữ nghĩa: embedding và độ tương đồng cosine

RAG cắt tài liệu thành các chunk (mẩu) và trả về chunk có embedding chỉ gần câu hỏi nhất. Chỗ cắt quyết định chunk đó có chứa câu trả lời hay không: cắt giữa một ý sẽ tạo ra chunk nghe có vẻ đúng nhưng thiếu câu trả lời.

Trước khi bắt đầu: bạn giải thích được chuyện này cho bạn bè không?

1 = hoàn toàn không · 5 = dễ dàng

  1. 1 Đoán trước

    Một ứng dụng RAG cắt một trang bảng giá ngắn thành các mẩu 20 từ. Bạn hỏi: “How many requests per day does the free plan allow?” (trang ghi 1,000). Bộ tìm kiếm (all-MiniLM-L6-v2) trả về mẩu nào đầu tiên?
  2. 2 Xem

    Where the cuts fall

    1 / 4
    ask:

    “How many requests per day does the free plan allow?”

    20 words

    Every account starts on the Free plan.

    The Pro plan costs $20 a month, billed in advance. It allows 50,000 requests per day, and support answers within four hours.

    The Free plan needs no card: sign up with an email address and your API key appears at once. It allows 1,000 requests per day.

    Requests over the daily limit return error 429 until midnight UTC, when the counter resets. Unused requests do not roll over.

    Team plans start at five seats. Each seat adds 10,000 requests per day to a shared pool.

    5 chunks · the search returns the lit one, score 0.75: the answer, “1,000”, is not in it ✗

    • ✗ requests per day, and support answers within four hours. The Free plan needs no card: sign up with an email0.75
    • ✓ address and your API key appears at once. It allows 1,000 requests per day. Requests over the daily limit return0.64
    • ✗ Every account starts on the Free plan. The Pro plan costs $20 a month, billed in advance. It allows 50,0000.57

    measured with all-MiniLM-L6-v2 (384 numbers per chunk) · cosine similarity · 2026-10-23

    Cut every 20 words: the free-plan question gets a chunk with neither number. Drag the size.

    Bộ tìm kiếm trả về chunk nghe giống câu hỏi nhất; nếu chỗ cắt chia đôi một ý, chunk đó có thể nghe đúng mà chẳng chứa gì.

  3. Ứng dụng RAG không thể embed cả một cuốn hướng dẫn thành một vector, nên nó cắt tài liệu thành các chunk, embed từng chunk, rồi dán vài chunk gần nhất vào prompt. Bộ tìm kiếm chấm điểm một chunk *nghe giống* câu hỏi đến đâu, không phải nó có trả lời câu hỏi hay không. Chỗ cắt quyết định một chunk nói về điều gì.

  4. 4 Bạn là model

    Bạn là bộ tìm kiếm. Với bốn câu hỏi, mỗi câu trên trang được cắt theo một cách khác nhau, hãy chọn chunk mà all-MiniLM-L6-v2 chấm điểm cao nhất.

    you are the search · pick the chunk all-MiniLM-L6-v2 scores highest

    “When does the daily request limit reset?” · cut every 20 words

    measured with all-MiniLM-L6-v2 (384 numbers per chunk) · cosine similarity · 2026-10-23

    You are the search. Which chunk scores highest?
  5. 5 Kiểm tra

    Trong hình, cắt mỗi 20 từ và hỏi “When does the daily request limit reset?”. Cái gì về đầu tiên?
  6. Vài thói quen giúp ích. Cắt theo cấu trúc sẵn có của tài liệu: tiêu đề, đoạn văn, câu. Mỗi chunk một ý, thêm chút chồng lấn (overlap) cho những ý chạy qua chỗ cắt. Thêm tiêu đề hoặc mục vào mỗi chunk; thử nghiệm của Anthropic giảm 35% số lần tìm sai nhờ cách đó. Rồi thử bằng câu hỏi thật: chunk đứng đầu có chứa câu trả lời không?

  7. 7 Nói lại bằng lời bạn

  8. 8 Nhiệm vụ · 5 phút

    Chép key miễn phí trên trang embeddings của Jina (không cần thẻ) và embed ba đoạn văn trong một request với "normalized": true: câu hỏi “How many requests per day does the free plan allow?”, mẩu 20 từ “requests per day, and support answers within four hours. The Free plan needs no card: sign up with an email”, và đoạn văn “The Free plan needs no card: sign up with an email address and your API key appears at once. It allows 1,000 requests per day.” Nhân vô hướng (dot) từng cái với câu hỏi. Mô hình lớn hơn có mắc cùng lỗi không?

Ba câu nhanh

Rút ngẫu nhiên từ bộ câu hỏi của bài; lần sau sẽ khác.

Xong chưa?

Còn bây giờ: bạn giải thích được cho bạn bè chưa?

1 = hoàn toàn không · 5 = dễ dàng

Trả lời ba câu nhanh trước đã.

Nhận email khi có bài mới

Bài mới nằm trong bản tin hằng tuần, chỉ gửi vào tuần có bài. Bạn xác nhận qua email trước; hủy đăng ký chỉ với một lần bấm.

Nguồn

  • Cosine similarities measured with sentence-transformers/all-MiniLM-L6-v2 (https://huggingface.co/sentence-transformers/all-MiniLM-L6-v2: 384 dimensions, mean pooling, normalised, max 256 word pieces) on 2026-10-23 by scripts/explain-data/chunking.ts, which reuses the plain forward pass of scripts/explain-data/semantic-search.ts (it reproduces the published sbert.net example 0.6660, 0.1046, 0.1411)
  • The pricing page (92 words, 5 paragraphs, a made-up API) and the three questions were written for the lesson; the cuts are computed by app/components/explain/lessons/chunking-data.ts, the same code the picture uses
  • Scores used: 20 words, free plan → mixed Pro/Free chunk 0.753, chunk with 1,000 0.637, first chunk 0.572; 20 words, reset → 1,000 chunk 0.689, midnight chunk 0.507; 20 words + 10 overlap, reset → 0.784 (holds the answer), free → 0.753 (mixed chunk again); 10 words, Pro price → “Every account … The Pro plan” 0.654, “costs $20 …” 0.511; by sentence, free → “It allows 1,000 requests per day.” 0.759, “It allows 50,000 …” 0.680; by paragraph → free 0.780, reset 0.784, Pro 0.836; whole page → free 0.764, reset 0.413, Pro 0.766
  • https://www.anthropic.com/news/contextual-retrieval (Sep 19, 2024, checked 2026-10-23): Contextual Embeddings cut the top-20 retrieval failure rate by 35% (5.7% → 3.7%); with Contextual BM25 by 49%; “The choice of chunk size, chunk boundary, and chunk overlap can affect retrieval performance”
  • https://jina.ai/embeddings/ (checked 2026-10-23): new users get an auto-generated API key with free tokens; endpoint https://api.jina.ai/v1/embeddings; aifree.dev catalog jina-ai-free-api-tokens (verified 2026-10-12): 10M tokens per new API key, no card

Đăng Oct 23, 2026 · cập nhật Oct 23, 2026

Never miss new offers and news

New tools, credits, and AI news are added regularly. Pick how you want to hear about them.

Telegram channel
Join @aifree_dev and get new free AI offers and news right in your Telegram feed.
Browser notifications
Turn on push notifications and get an alert on this device whenever something new is posted. No account needed.
Email newsletter
A weekly digest of new, changed and expiring free AI offers. Double opt-in, one-click unsubscribe. See the latest issue.

Unsubscribe anytime. Privacy

Frequently asked questions

What is aifree.dev?

aifree.dev helps everyone access AI through a curated directory of free AI tools, API credits, free tiers, and startup programs for coding, image, voice, video, and students - verified regularly.

How are offers presented?

Each offer includes its access details, free models when available, and expiration information when provided. Limited-time deals stay visible so they are easy to compare.

Do education and startup programs need verification?

Yes. Providers usually ask students to verify their status with a school email, student ID, or a program like the GitHub Student Pack, and ask startups to verify company details such as age, funding, or website. Check each offer’s claim page for the exact requirements.

What kinds of free AI offers are listed?

Free tiers and free trials from AI providers, free API credits, startup and student programs, and free tools for coding, image generation, voice, and video.

How can I suggest a tool or report a broken link?

Use the submit form: paste the offer page URL and a short note. A person checks every submission before anything is listed. Broken links and changed terms go through the same form.

+

Know a good one?

Tell us about an AI tool worth knowing. Found a broken link? We want to hear that too.

Submit an offer