Back to Home

Query Results

Query: "{{ query }}"

{{ "%.2f"|format(alpha) }}
BM25 (Keywords) Semantic (Meaning)

Adjust slider, then click "Re-rank Results" to see new ordering

{% if compare_mode and (has_custom_model or has_e5_model) %}
View Mode:
{% endif %}
{% if mode == "count" %}

Total Matches: {{ total }}

{% for r in by_kb %}
{{ r.kb }}: {{ r.count }} matches ({{ r.model }})
{% endfor %}
{% else %} {% if compare_mode and (has_custom_model or has_e5_model) %}
{% if not has_custom_model %}

âš ī¸ No Custom Model Available

The selected knowledge bases only use E5 baseline model. Train a custom model and create a KB with it to enable model comparison.

{% endif %} {% if not has_e5_model %}

âš ī¸ No E5 Baseline Available

The selected knowledge bases only use custom models. Create a KB with E5 model to enable model comparison.

{% endif %} {% if has_custom_model and has_e5_model %}
{% for r in custom_results %}
{{ r.kb }} {{ r.file }}
{{ r.model }}
{% if r.score >= 0.9 %}
{{ r.score_percentage }}
đŸŸĸ Excellent
{% elif r.score >= 0.7 %}
{{ r.score_percentage }}
🟡 Good
{% elif r.score >= 0.5 %}
{{ r.score_percentage }}
🟠 Moderate
{% else %}
{{ r.score_percentage }}
🔴 Weak
{% endif %}
{{ r.snippet_highlighted|safe }}
{% endfor %}
{% endif %}
{% else %}

Found {{ count }} results

{% if results|length > 0 %} {% set kb_counts = {} %} {% for r in results %} {% set _ = kb_counts.__setitem__(r.kb, kb_counts.get(r.kb, 0) + 1) %} {% endfor %} {% if kb_counts.keys()|list|length > 1 %}

Filter by Knowledge Base:

{% for kb_name in kb_counts.keys()|sort %} {% endfor %}
{% endif %} {% endif %}
{% for r in results %}
{{ r.kb }} {{ r.file }}
{{ r.model }}
🔍 Keywords: {{ r.bm25_percentage }}
🧠 Semantic: {{ r.semantic_percentage }}
(Hybrid: {{ r.score_percentage }})
{% if r.score >= 0.9 %}
đŸŸĸ Excellent
{% elif r.score >= 0.7 %}
🟡 Good
{% elif r.score >= 0.5 %}
🟠 Moderate
{% else %}
🔴 Weak
{% endif %}
{{ r.snippet_highlighted|safe }}
{% if r.explanation %}

✓ Match Explanation

{% if r.explanation.bm25_score is defined and r.explanation.semantic_score is defined %}
📊 Hybrid Score Breakdown
Overall Hybrid Score: {{ "%.1f"|format(r.score * 100) }}%
Semantic Score ({{ "%.0f"|format(r.explanation.alpha * 100) }}% weight): {{ "%.1f"|format(r.explanation.semantic_score * 100) }}%
BM25 Score ({{ "%.0f"|format((1 - r.explanation.alpha) * 100) }}% weight): {{ "%.1f"|format(r.explanation.bm25_score * 100) }}%
{% if r.explanation.matching_terms and r.explanation.matching_terms|length > 0 %}

🔍 BM25 Keyword Matches:

{% for term in r.explanation.matching_terms %} {{ term }} {% endfor %}
{% endif %}
{% endif %}
đŸŽ¯ Match Quality Assessment
{% if r.score >= 0.9 %} đŸŸĸ Excellent match ({{ "%.1f"|format(r.score * 100) }}%)

Very high semantic similarity - meanings are nearly identical

{% elif r.score >= 0.7 %} 🟡 Good match ({{ "%.1f"|format(r.score * 100) }}%)

High semantic similarity - meanings are very close

{% elif r.score >= 0.5 %} 🟠 Moderate match ({{ "%.1f"|format(r.score * 100) }}%)

Moderate semantic similarity - related concepts

{% else %} 🔴 Weak match ({{ "%.1f"|format(r.score * 100) }}%)

Low semantic similarity - loosely related or unrelated

{% endif %}
{% if r.explanation.model_type == 'custom' and r.explanation.query_terms %}
🔍 Top Contributing Terms ({{ r.explanation.model_name }} model)

â„šī¸ Custom TF-IDF Model:

  • ✅ Each dimension = word/bigram from training corpus
  • ✅ TF-IDF scores show term importance
  • ✅ Higher scores = more distinctive/relevant terms
  • ✅ Exact words that matched are highlighted below

Query "{{ query }}" - Top terms with TF-IDF scores:

    {% for term, score in r.explanation.query_terms %}
  • {{ term }} (TF-IDF: {{ "%.2f"|format(score) }})
  • {% endfor %}

Result text snippet - Top terms with TF-IDF scores:

    {% for term, score in r.explanation.chunk_terms %}
  • {{ term }} (TF-IDF: {{ "%.2f"|format(score) }})
  • {% endfor %}
{% set query_term_set = [] %} {% for term, score in r.explanation.query_terms %} {% set _ = query_term_set.append(term) %} {% endfor %} {% set chunk_term_set = [] %} {% for term, score in r.explanation.chunk_terms %} {% set _ = chunk_term_set.append(term) %} {% endfor %} {% set overlapping_terms = [] %} {% for term in query_term_set %} {% if term in chunk_term_set %} {% set _ = overlapping_terms.append(term) %} {% endif %} {% endfor %} {% if overlapping_terms|length > 0 %}

✅ Exact Words That Matched:

{% for term in overlapping_terms %} {{ term }} {% endfor %}

→ Custom model learned these terms are related!

{% else %}

âš ī¸ No Direct Word Overlap

Match is based on semantic similarity in embedding space, not exact word matches

{% endif %}

💡 Custom model uses TF-IDF vectorization: Each of {{ r.explanation.embedding_dim }} dimensions represents a unique word/bigram

{% endif %}
🔍 Dimension Browser

Explore all {{ r.explanation.embedding_dim }} dimensions

{% if r.explanation.model_type == 'custom' %}

✅ Custom Model Feature:

{% if r.explanation.vocabulary %}

Each dimension shows the exact word/bigram it represents with TF-IDF scores

{% else %}

This model was trained without vocabulary metadata. Retrain the model to see word/bigram names for each dimension.

{% endif %}
{% endif %}
Dimensions 1-3

Educational feature: Scroll through all dimensions to understand embedding space

Full dimension: {{ r.explanation.embedding_dim }} | Blue = positive, Red = negative

📊 Overall Vector Alignment
{% set query_emb = r.explanation.query_embedding_preview %} {% set chunk_emb = r.explanation.chunk_embedding_preview %} {% set same_sign_count = 0 %} {% set total_diff = 0 %} {% for i in range(3) %} {% if i < query_emb|length and i < chunk_emb|length %} {% set diff = ((query_emb[i] - chunk_emb[i])|abs) %} {% if (query_emb[i] >= 0 and chunk_emb[i] >= 0) or (query_emb[i] < 0 and chunk_emb[i] < 0) %} {% set same_sign_count = same_sign_count + 1 %} {% endif %} {% set total_diff = total_diff + diff %} {% endif %} {% endfor %}
Direction match: {{ "%.0f"|format((same_sign_count / 3.0) * 100) }}% ({{ same_sign_count }}/3 dimensions same sign)
Magnitude match: {% set mag_match = (1 - (total_diff / 3.0)) * 100 %} {{ "%.0f"|format(mag_match) }}% (bars similar length)
Combined score: {{ "%.1f"|format(r.score * 100) }}% {% if r.score >= 0.7 %}(Good match){% elif r.score >= 0.5 %}(Moderate match){% else %}(Weak match){% endif %}
{% if r.explanation.most_aligned and r.explanation.most_aligned|length > 0 %}
đŸŸĸ Top 3 Most Aligned Dimensions
{% for dim_info in r.explanation.most_aligned %}

Dimension {{ dim_info.dim + 1 }}: {% if r.explanation.model_type == 'custom' and r.explanation.vocabulary and dim_info.dim < (r.explanation.vocabulary|length) %} "{{ r.explanation.vocabulary[dim_info.dim] }}" {% endif %}

{% if r.explanation.model_type == 'custom' %}

TF-IDF scores for this word/bigram:

{% endif %}
Query: {{ "%.3f"|format(dim_info.query_val) }} {{ '[' }}{% for _ in range((dim_info.query_val * 10)|int|abs) %}█{% endfor %}{% for _ in range(10 - (dim_info.query_val * 10)|int|abs) %}░{% endfor %}{{ ']' }}
Result: {{ "%.3f"|format(dim_info.chunk_val) }} {{ '[' }}{% for _ in range((dim_info.chunk_val * 10)|int|abs) %}█{% endfor %}{% for _ in range(10 - (dim_info.chunk_val * 10)|int|abs) %}░{% endfor %}{{ ']' }} ↑ Nearly identical! (Δ={{ "%.3f"|format(dim_info.diff) }})
{% endfor %}
{% endif %} {% if r.explanation.most_divergent and r.explanation.most_divergent|length > 0 %}
🔴 Most Divergent Dimensions
{% for dim_info in r.explanation.most_divergent %}

Dimension {{ dim_info.dim + 1 }}: {% if r.explanation.model_type == 'custom' and r.explanation.vocabulary and dim_info.dim < (r.explanation.vocabulary|length) %} "{{ r.explanation.vocabulary[dim_info.dim] }}" {% endif %}

{% if r.explanation.model_type == 'custom' %}

TF-IDF scores for this word/bigram:

{% endif %}
Query: {{ "%.3f"|format(dim_info.query_val) }} {{ '[' }}{% for _ in range((dim_info.query_val * 10)|int|abs) %}█{% endfor %}{% for _ in range(10 - (dim_info.query_val * 10)|int|abs) %}░{% endfor %}{{ ']' }}
Result: {{ "%.3f"|format(dim_info.chunk_val) }} {{ '[' }}{% for _ in range((dim_info.chunk_val * 10)|int|abs) %}█{% endfor %}{% for _ in range(10 - (dim_info.chunk_val * 10)|int|abs) %}░{% endfor %}{{ ']' }} {% if not dim_info.same_sign %} ↑ Opposite signs! {% else %} ↑ Large difference! {% endif %}
{% endfor %}
{% endif %}
📐 About Cosine Similarity

Cosine Similarity = dot product of normalized vectors

Scores range from 0 (unrelated) to 1 (identical). Higher scores mean more similar meanings.

{% if r.explanation.model_type == 'custom' %} This custom model ({{ r.explanation.model_name }}) was trained on domain-specific text. {% else %} Using E5-Small general-purpose model (384 dimensions). {% endif %}

{% endif %}
{% endfor %}
{% endif %} {% endif %}