AI Hero Club

Multimodal RAG · Lesson 2

Marked Complete by You0 / 8

Saved in this browser only. Marking a lesson complete does not mean the project has passed verification.

Lesson Outline 3 subsections
Course Contents 8 lessons
Full course plan.
Multimodal RAG / Learning Plan ↗

LESSON 02 / 8Suggested study 120 minutes

Lexical Retrieval, BM25 and Hand-checkable Baselines

When a document repeats query terms many times, how does BM25 limit term-frequency advantages and account for document length?

3 Questions for This Lesson
  • Simulate saturation of word frequency, reverse document frequency and length
  • Achieving certainty in Chinese binary units
  • A clear word of relevance does not amount to evidence support.
Course Project ZIP ↓

Lexical Units, Term Frequency, and Length Normalization

When the source layer is established, an interpretable word baseline is made. Entering is an actual query string with a true evidence unit that produces an orderly candidate and does not directly export an answer. The word method compares words that appear together, without the need for training weights or automatic synonyms. It is effective in the short description of document fields and controlled images, so it must be retained as a true baseline; rather, a deliberately poor searcher cannot be compared to highlight a neurological model.

In Chinese, there are no natural spaces and the project uses a clear and limited formula: removes the blanks and converts the lowercases, Latin letters numeric strings as units, and the two adjoining words after the Chinese character is extracted constitute two word entries. It is not a linguistic split, it may also spell the fragments that were separated out across boundaries. For example, “Red Small Circle” forms red, small colour, small circle, circular; image pixel short descriptions use the same rules to match queries. The connection of the removed points is also a public limit and cannot be claimed for common Chinese understanding.

(a) To quantify this chapter as enforceable constraint: NN is the number of non-negative documents dft∈{0,…,N}df_t\in\{0,\ldots,N\} , tft,dtf_{t,d} is non-negative integer. ∣d∣|d|. The average length is positive when the current non-empty index is fixed; the empty index should return to an empty ranking instead of explaining a non-existent average document. This type and range check can detect many index errors before entering the float point rating.

It can also be calculated directly by word frequency factors. A=k1(1−b+b∣d∣/∣d∣‾)>0A=k_1(1-b+b|d|/\overline{|d|})>0 Put it on. tftf Consider it as a continuous variable for now ff, the commercial law guide (k1+1)A/(f+A)2(k_1+1)A/(f+A)^2 # It's just as it goes # ff Increases and decreases. This is a local mathematical interpretation of saturation; the actual word frequency is still an integer number, which can be checked by adjacent integer differences. The model does not thus obtain probabilities for natural language relevance.

Sets the total number of evidences N, with a word appearing as tf in article d, which contains df, the length of the document being the sum of all words and the average of the entire set. df is counted at most once for each document, while tf can be used several times; they are misguided to punish repeated words. The more common the word is, the less frequently it appears, the less it is; plus one form avoids the very common word having a negative weight, which is the option of achieving it and cannot be distinguished from all BM25 variants.

idf⁡(t)=log⁡(1+N−dft+0.5dft+0.5),score(q,d)=∑t∈unique(q)idf⁡(t)tft,d(k1+1)tft,d+k1(1−b+b∣d∣/∣d∣‾)\operatorname{idf}(t)=\log\left(1+\frac{N-df_t+0.5}{df_t+0.5}\right),\quad score(q,d)=\sum_{t\in unique(q)}\operatorname{idf}(t)\frac{tf_{t,d}(k_1+1)}{tf_{t,d}+k_1(1-b+b|d|/\overline{|d|})}
Natural logarithms; k1=1.2, b=0.75, duplicate queries are counted only once.

The frequency item is saturated? When tf tends to be infinite, the molecule denominators have the same number of times, and the factor is close to k plus one does not grow indefinitely with repeated words. tf contributes zero at zero, there is a single increase in the relevant signal, which continues to be repeated but has a reduction in marginality. This form is an information retrieval rating model, not a genuinely relevant test from actual document probabilities; it explains its mechanisms and boundaries without considering its output fractions as a directly comparable confidence probability.

Length is a function of the length of documents divided by average length. b Controls the penalty. b does not look at the length at zero hour, b is fully adjusted for relative length at one time. Under the same tf, the denominators for longer documents are usually larger and lower so as to reduce the advantage that a long document would have in terms of word and by chance. But long documents may really contain more complete answers, so blocks are sorted together with length. The short line of the current language need not be the same as the best parameters for the long paper.

Example 1: Hand-Scoring Two Equal-Length Evidence Items

Set the length of both evidence to two, the first to two words a, and the second to two words b. The query is only a, N to two, df to one, so Idf to log two. The length is a 1:2 ratio, and the first frequency factor is two times two, two times two and three times two, which is equal to one: three and three and a half. A total of one, three and seven times two, about five and five times two, and a second to zero. Tests with an independent hand count do not rewrite expectations from the function ' s own output.

If the first article contains only one timea while the length is still two, the frequency factor is one times two and two times two, equal to one. The word doubles the score, which is the saturation mechanism. If the whole text is copied, N changes with df, the smooth constant makes idf need not be identical; therefore, the rating depends on the index full version, and it is not possible to recreate the original fraction without adding or deleting the data and claiming that the original fraction remains unchanged.

Example 2: Length Penalties at Equal Term Frequency

tf is equal to one, with an average length of ten. Evidence A is ten and the frequency factor is one; evidence B is twenty, divided by one point two times two and two times one plus two plus five plus three plus seven times two, i.e. two points one and a half, molecules two and a factor of about zero seven and nine. The same difference is lower for B under the Idf. If b is zero, both factors are one; this melting is one and it is clear that the length of isolation is one and should not be changed to explain the same difference at the same time as a split and a query.

The simplest way to achieve a word-saving frequency for each evidence is to calculate df and cumulative fractions of the search word. There are currently dozens of small indexes that are sufficiently complicated to be associated with document numbers multiplied by query words and statistical scans. Large libraries can create reverse tables that only access evidence containing query words and pre-empt df and length. The algorithm should replace contracts that retain tokenizer, formulae, float sequence and parallel strategies; approximation indexes are not a necessary prerequisite and cannot be retrieved by mistaking “No vector database”.

The entries are added to the evidence ID to ensure that the same input is stable. Zero entry does not enter the word list, which means that the word can be returned empty if it is not shared, rather than in the file order. A high score “Open” field must also be retrieved and the theme, fields and versions confirmed by the answerr; key words recommence is only a call back signal. If the query is addressed to the administrator, these words are found in the note and can be retrieved for hits, but this text cannot be used as command or answer permission.

The current graphics baseline is not an artificial caption table, which indexes the colour, size and shape phrases generated by actual pixel algorithms. The phrase will be strong when it is accurate, so its failure should also be retained as a comparison with the learning encoder to show whether additional learning is necessary in this controlled domain: fixed horizon values may be used as objects for the whole background and are misdefined; the word search then faithfully searches the wrong description. Errors occur in the sensor layer and cannot be misdiagnosticized as BM25 formula errors.

The synonym is a typical gap in the word approach. The source document writes “Claims for restitution”, querying “What do you want to do before you give it back?”, and the two words may not overlap enough. The dictionary can be expanded, but the dictionary is a new manual knowledge that requires versions and comparisons; the training text encoder can also be used, but the current Tiny model only recognizes geometry and does not have such semantic capability. The course does not quietly delegate missing capabilities to remote LLM. Fixed queries first check the grammatical laws of declared fields, which are rejected or failed when beyond syntax.

The baseline acceptance not only looks at the final correct rate, but also preserves the candidate ID for each query, the original BM25, the first five words of the word and the final reference. A query answer may be saved from the following strict field rule or may be the first direct correct; the two cannot be synthesized “Searchtop- That's right.”. The subsequent chapter will define the mean rate of chance, the last ranking and the correctness of the answer, separately, by preserving the sorted product here, avoiding an evaluation that can only guess the middle process from the last answer.

An empty query, an empty index, a zero average length, etc. boundary must be acted upon. The project returns uncanny when the search has no matching word, the length denominator is very well protected; the complete fixed originals are not empty and all damaged material is not claimed to be authenticated. Unicode ' s standardization with the digital date rules is not universally achieved, the original form contract is maintained. The extension of the language is preceded by a failed sample, the word or synonym is chosen and cannot directly hide the specific problem with “Big models will understand.”.

Standalone ProgramCalculates the BM25 smoothidf with saturation frequency item independently.
import math
idf=math.log(1+(2-1+.5)/(1+.5))
score=idf*2*2.2/(2+1.2)
assert abs(score-1.375*math.log(2))<1e-14
print(idf,score)

TRY IT YOURSELF

Practice 1: df and tf

Three documents contain a three times, a once, and no a at all. Ask N, df, and the documents tf. What range would you violate if the total frequency was misused for df?

Hint 1
df by number of documents containing the word, tf by number of occurrences in the document.
Hint 2
Write a boolean value for “Whether to includea” on a document-by-document basis, and then write a frequency number; check df must fall between 0 and N.
Compare with the Solution
N is three, df is two, because only the first two articles contain a; tf is three, one, zero. The total number of occurrences is four, not df. Using four as df would exceed the total number of documents, destroy the definition of “Number of documents containing the word” and lose the expected explanation of the idf smooth ratio. To achieve that each document member should be checked at df at once and the frequency at Counter is used for tf, the test can be distinguished by this small example of repeated words.

TRY IT YOURSELF

Practice II: Saturation limits

Fixed document length is a normal number A with a frequency factor of tf(k1+1)/ (tf+A)). For tf, the limit for time is infinite; why does repetition of keywords not guarantee an unlimited lead?

Hint 1
The molecular denominators of the frequency factor are first removed from the limit.
Hint 2
The A/tf is reduced to zero, and the upper limit is determined by distinguishing between saturation of frequencies and complete prevention of cheating and assurances of authenticity.
Compare with the Solution
Molecular denominators are divided by tf, obtained (k1+1)/(1+A/tf), limited to k1+1). idf has a upper limit when it is fixed, and the marginal benefits of repeated times are gradually reduced. But artificial repetition may still affect length and distribution with other terms, and cannot be said to prevent total cheating. BM25 is a sorting inspiration model, and authenticity and evidence support still need to be handled together with originals, privileges, versions and answer constraints.

TRY IT YOURSELF

Practice III: Failed Positioning

The dark background picture is wrongly described as “Square”. Query correctly describes the missed. Should we change BM25 or the perception module? How to compare controlled?

Hint 1
The pixel description that retrieves the input is wrong, first location error before or after ranking.
Hint 2
Fixed BM25 and query, properly described as diagnostics are under control; real change of perception and reconstruction cannot be considered an automatic result.
Compare with the Solution
Pixels thresholds and feature extractions are checked first, because index text is wrong. BM25, language and query can be fixed and the correct pixel description can be changed as a positive control, and the chain of perception can be located if called back; re-read the extractor and re-create the index to record old and new results. The correct description can only be used for diagnostic purposes and cannot be assumed to automatically extract results. If search formulas, thresholds and queries are changed at the same time, it is not possible to explain which improvements are coming from.

CHECK YOUR UNDERSTANDING

Check Your Understanding

Answer first, then open the explanation to check your reasoning. These questions help reveal gaps in understanding; independent implementation and transfer require separate evaluation.

1. df calculates what?

Show ExplanationEach document contributes to df at most once, tf being repeated separately.
Why does the word frequency gain of 2.BM25 not increase linearly?

Show Explanationtf The frequency factor tends to k1+1 when it is larger.
3. Does the current pixel descriptor benceline have artificially visualized claims?

Show ExplanationIt is still subject to fixed perception rules, but the source of information is the true PNG.
4. High BM25 points directly indicates what?

Show ExplanationThe search score does not validate the source, identity or identity of the person asked.

Manual completion records your progress; it does not certify your project.