Scoring
When you query a knowledge base, paperKB retrieves candidate passages using hybrid search (vector similarity + BM25 full-text search), then scores each result using a weighted combination of signals. The final score determines the ranking of both individual passages and the papers they belong to.
Score components
Each passage receives five component scores, shown as abbreviations in the Ask KB results:
| Abbrev | Name | Description |
|---|---|---|
| ck | Chunk similarity | Cosine similarity between the query embedding and the passage (chunk) embedding. This is the primary relevance signal. |
| doc | Document similarity | Cosine similarity between the query embedding and the document-level embedding (average of all chunk embeddings for the paper). Rewards papers that are topically relevant overall. |
| abs | Abstract similarity | Cosine similarity between the query embedding and the paper's abstract embedding. Captures title/abstract-level relevance. |
| fig | Figure similarity | Maximum cosine similarity between the query embedding and any figure legend embedding in the paper. Surfaces papers with relevant figures even when the main text match is weaker. |
| pr | PageRank | Citation-graph PageRank score for the paper. Boosts well-cited papers. Applied as log(1 + pagerank) to compress the range. |
Scoring formula
The final score for each passage is a weighted sum:
score = α·ck + β·doc + γ·abs + ε·fig + δ·log(1 + pr)
Default weights:
| Symbol | Component | Default weight |
|---|---|---|
| α | ck (chunk similarity) | 0.5 |
| β | doc (document similarity) | 0.3 |
| γ | abs (abstract similarity) | 0.1 |
| ε | fig (figure similarity) | 0.1 |
| δ | pr (PageRank) | 0.2 |
These weights can be customized in the server configuration.
Paper scores
Papers are ranked by their best passage score. The paper-level component scores (doc, abs, fig, pr) are the same for every passage in a paper; only the chunk similarity (ck) varies between passages.
Hybrid search
Before scoring, candidate passages are retrieved using a hybrid of vector cosine similarity and BM25 full-text search. The two signals are blended with a configurable weight (default 50/50). This ensures that both semantic meaning and exact keyword matches contribute to candidate selection.
Query expansion
When query expansion is enabled (the default), paperKB uses an LLM to generate alternative phrasings of your question before searching. For example, a question about "GABRA2's role in alcohol use disorder" might produce sub-queries using related terms like "GABA receptor alpha-2 subunit", "GABRA2 polymorphism and alcoholism", or "GABRA2 AUD genetic association".
Each sub-query captures a different angle on the same intent — different terminology, abbreviations, or related concepts — so that relevant passages are found even when they use different wording than your original question. By default, three sub-queries are generated in addition to the original.
The expanded queries are shown in the Ask KB results under "Queries used" so you can see exactly what was searched.
Multi-query merging
Because each sub-query produces its own embedding, the similarity scores (ck, doc, abs, fig) are computed independently for each sub-query. Results are then merged by keeping the best per-signal score for each passage across all queries before final scoring.
This means two passages from the same paper can end up with different doc, abs, or fig scores — even though the paper-level embeddings are the same — because each passage may have been best matched by a different sub-query with a different embedding.