0Pricing
NLP Academy · レッスン

文脈内で回答スパンを見つける

開始トークンと終了トークンを予測する

「文脈内で回答スパンを見つける」はCoddyKit上の無料NLP Academyレッスンです。 これはレッスン3/4です。 下記で完全なレッスンを無料で読むことができます。その後、ブラウザ内の組み込みコードエディタと24時間対応のAIチューターでハンズオン演習できます。 これはNLP Academy学習パスの一部であり、ウェブとCoddyKitアプリ全体で進捗が同期されます。 NLP Academyコースには全4レッスンが含まれています。

このレッスンの一部はまだ翻訳されておらず、英語で表示されています。

The Span Mindset

Under the hood, extractive QA never writes text. It picks a span: a contiguous slice of the context defined by where it starts and ends.

Predicting Two Numbers

The model's real job is to predict two positions: the start token of the answer and the end token. The slice between them is the answer.

Tokens, Not Characters

Inside the model the context is split into tokens, not raw letters. Start and end are token indexes that get mapped back to characters.

A Score Per Position

For every token the model emits a start logit and an end logit. These scores say how likely each token begins or ends the answer.

Picking the Best Pair

The chosen span is the start and end pair with the highest combined score, with the rule that end never comes before start.

Slicing With Offsets

The pipeline returns character offsets so you can slice the original context yourself and recover the exact answer text.

answer = context[result["start"]:result["end"]]

Why Offsets Matter

Those offsets let you highlight the answer right inside the passage, which is great for showing users where a fact came from.

Limiting Answer Length

You can cap how long a span may be with max_answer_len. This stops the model from returning an entire sentence as the answer.

qa(question=q, context=c, max_answer_len=20)

Getting Several Candidates

Set top_k to return more than one candidate span. Reviewing a few options helps when the best answer is ambiguous.

qa(question=q, context=c, top_k=3)

Spans Must Be Contiguous

A span is always one continuous stretch of text. Extractive QA cannot stitch together words from different parts of the passage.

Spans Power Highlighting

Because answers are exact spans with offsets, you can highlight them in place, giving users a verifiable source for every reply. 🔦

Quick Check

How does the model decide what the answer is?

Recap

The model predicts start and end positions, picks the best valid pair, and offsets let you slice and highlight the exact answer. 📌

よくある質問

「文脈内で回答スパンを見つける」レッスンは無料ですか?

はい。「文脈内で回答スパンを見つける」の完全なテキストはこのウェブで無料で読めます。インタラクティブに演習し(組み込みコードエディタと24時間対応のAIチューター)、NLP Academyコースの残りをアンロックするには、CoddyKit PROにアップグレードしてください。 NLP Academyコースには全4レッスンが含まれています。

「文脈内で回答スパンを見つける」で何を学びますか?

開始トークンと終了トークンを予測する ブラウザで直接実行するハンズオンコードでNLP Academyを演習し、24時間対応のAIチューターがレッスンを進める中での質問に答えます。

NLP Academyを始めるのに経験は必要ですか?

事前経験は必要ありません。CoddyKitのNLP Academyは初級者から上級者向けに構成されているため、ここから始めるか最初から始めて、自分のペースで進むことができます。 これはレッスン3/4です。

「文脈内で回答スパンを見つける」レッスンにはどのくらい時間がかかりますか?

ほとんどのCoddyKitレッスンは約5~10分かかります。各レッスンはコンパクトでインタラクティブなので、着実に進歩し、ウェブとアプリ全体で正確に前回の場所から再開できます。

このNLP Academyレッスンでコードを書いて実行できますか?

はい。すべてのNLP Academyレッスンに組み込みコードエディタが含まれているため、ブラウザでリアルコードを書いて実行し、即座のAIフィードバックを取得できます。ローカル設定は不要です。

このコースのすべてのレッスン

  1. 抽出型 QA と生成型 QA
  2. QA パイプラインを実行する
  3. 文脈内で回答スパンを見つける
  4. 回答なしと長い文書に対応する
← NLP Academyに戻る