rerank: use an example where the cross-encoder fixes the order in 02, correct the download size
Co-Authored-By: Claude Sonnet 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Cfo2K4u4rF18QsPXPFnytf
This commit is contained in:
@@ -32,12 +32,12 @@ class PairEncodingTest {
|
||||
|
||||
@Test
|
||||
void oneQuestionByHand() {
|
||||
String question = "A buyer told their bank they never got the item. What now?";
|
||||
String question = "Meaning of E-4133";
|
||||
List<Document> candidates = Fixture.retriever().withTopK(8).retrieve(new Query(question));
|
||||
float[] scores = Fixture.fp32().score(question, candidates.stream().map(Document::getText).toList());
|
||||
try (Transcript t = new Transcript("02-one-question-by-hand.txt", "One question, the bi-encoder's top 8, rescored")) {
|
||||
t.line("question: %s", question);
|
||||
t.line("gold passage: G-04");
|
||||
t.line("gold passage: E-4133");
|
||||
t.blank();
|
||||
t.line("%-9s %-7s %-12s %s", "retrieved", "id", "cosine", "cross-encoder logit");
|
||||
int goldRetrieved = -1;
|
||||
@@ -45,7 +45,7 @@ class PairEncodingTest {
|
||||
for (int i = 0; i < candidates.size(); i++) {
|
||||
Document d = candidates.get(i);
|
||||
t.line("%-9d %-7s %-12.3f %.2f", i + 1, d.getMetadata().get("pid"), d.getScore(), scores[i]);
|
||||
if ("G-04".equals(d.getMetadata().get("pid"))) {
|
||||
if ("E-4133".equals(d.getMetadata().get("pid"))) {
|
||||
goldRetrieved = i + 1;
|
||||
}
|
||||
if (scores[i] > scores[best]) {
|
||||
@@ -53,7 +53,7 @@ class PairEncodingTest {
|
||||
}
|
||||
}
|
||||
t.blank();
|
||||
t.line("bi-encoder rank of G-04: %d; cross-encoder winner: %s", goldRetrieved, candidates.get(best).getMetadata().get("pid"));
|
||||
t.line("bi-encoder rank of E-4133: %d; cross-encoder winner: %s", goldRetrieved, candidates.get(best).getMetadata().get("pid"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user