{
  "schema_version": 1,
  "title": "Text Embeddings: Cosine Similarity and Retrieval",
  "review_type": "AI-assisted source-support audit; not independent expert verification",
  "sources": [
    {
      "id": "S1",
      "key": "embedding-context",
      "title": "CPU Optimized Embeddings with 🤗 Optimum Intel and fastRAG",
      "author": "Intel / Hugging Face authors. (2024).",
      "url": "https://huggingface.co/blog/intel-fast-embedding",
      "requested_url": "https://huggingface.co/blog/intel-fast-embedding",
      "accessed_at": "2026-11-13T22:38:56.708Z",
      "source_type": "primary",
      "version": null,
      "published_at": "2024-03-15T00:00:00.000Z",
      "source_date_note": "Intel / Hugging Face authors. (2024).",
      "retrieved_body_sha256": "f33edb885f8a47db1e1ac52700ac0ceeb671ac663975a75c5708d9391efd5bb0",
      "library": {
        "id": "e22d4f6821d6b88bbaee5294a65f8a31",
        "revision": "add9531d9d9c7a46dfd0f2c4d2bad106",
        "published_at": "2024-03-15T00:00:00.000Z",
        "captured_at": "2026-11-06T19:39:20.482Z",
        "exact_quote_in_saved_original": true,
        "passage_matches": [
          {
            "evidence_id": "S1-E1",
            "exact_match": true
          }
        ]
      },
      "evidence": [
        {
          "id": "S1-E1",
          "location": "Information Retrieval with Embedding Models",
          "quote": "Embedding models encode textual data into dense vectors",
          "normalized_text_offset": 1395
        }
      ],
      "limitations": "Saved public original used for the embedding/retrieval context, not its hardware measurements.",
      "checks": [
        "publisher URL and final redirect inspected",
        "actual relevant primary passage read",
        "exact excerpt matched",
        "scope and available version/date inspected"
      ]
    },
    {
      "id": "S2",
      "key": "cosine",
      "title": "cosine_similarity — scikit-learn 1.9.1 documentation",
      "author": "scikit-learn maintainers. (v1.9.1).",
      "url": "https://scikit-learn.org/stable/modules/generated/sklearn.metrics.pairwise.cosine_similarity.html",
      "requested_url": "https://scikit-learn.org/stable/modules/generated/sklearn.metrics.pairwise.cosine_similarity.html",
      "accessed_at": "2026-11-13T22:38:56.670Z",
      "source_type": "primary",
      "version": "scikit-learn 1.9.1",
      "published_at": null,
      "source_date_note": "scikit-learn maintainers. (v1.9.1).",
      "retrieved_body_sha256": "b0c515869b162b502b3a319e95ad6ab3b4472df9c4df55763ca475b6a3a3040d",
      "library": null,
      "evidence": [
        {
          "id": "S2-E1",
          "location": "cosine_similarity API definition",
          "quote": "computes similarity as the normalized dot product of X and Y",
          "normalized_text_offset": 196
        }
      ],
      "limitations": "Mathematical definition. This toy rejects zero vectors explicitly.",
      "checks": [
        "publisher URL and final redirect inspected",
        "actual relevant primary passage read",
        "exact excerpt matched",
        "scope and available version/date inspected"
      ]
    },
    {
      "id": "S3",
      "key": "embedding-search",
      "title": "Semantic Textual Similarity — Sentence Transformers  documentation",
      "author": "Sentence Transformers maintainers. (Documentation accessed 2026).",
      "url": "https://www.sbert.net/docs/sentence_transformer/usage/semantic_textual_similarity.html",
      "requested_url": "https://www.sbert.net/docs/sentence_transformer/usage/semantic_textual_similarity.html",
      "accessed_at": "2026-11-13T22:38:56.718Z",
      "source_type": "primary",
      "version": null,
      "published_at": null,
      "source_date_note": "Sentence Transformers maintainers. (Documentation accessed 2026).",
      "retrieved_body_sha256": "5d3b3ead677fb15a310dfb9d87ad09edb90a11a849762116361415c43cc6d5f4",
      "library": null,
      "evidence": [
        {
          "id": "S3-E1",
          "location": "Similarity Calculation",
          "quote": "SimilarityFunction.COSINE",
          "normalized_text_offset": 1994
        }
      ],
      "limitations": "Library documents multiple similarity choices. A cosine score is not a calibrated relevance probability.",
      "checks": [
        "publisher URL and final redirect inspected",
        "actual relevant primary passage read",
        "exact excerpt matched",
        "scope and available version/date inspected"
      ]
    }
  ],
  "claims": [
    {
      "id": "C01",
      "notebook_locations": [
        "workflow"
      ],
      "claim": "Prepare text — Query + passages — Decide which text units the actual system will encode. — Chunking and model choice are outside the geometric experiment.; Encode vectors — Model representation — A real encoder supplies numeric representations for query and passages. — Here the coordinates are declared by hand so every score can be inspected.; Score candidates — Normalized dot product — Compare nonzero vectors using the stated cosine formula. — Other similarity functions have different assumptions and behavior.; Inspect retrieval — Rank + relevance — Sort scores and evaluate against the question’s actual evidence needs. — A high score is a geometric result, not an independent truth or relevance judgment.",
      "source_ids": [
        "S1",
        "S2",
        "S3"
      ],
      "evidence_ids": [
        "S1-E1",
        "S2-E1",
        "S3-E1"
      ],
      "verdict": "editorial_diagram_with_source_supported_roles",
      "reason": "Diagram is a teaching workflow, not an exhaustive protocol or measured system. Each role and arrow is bounded in nearby text."
    },
    {
      "id": "C02",
      "notebook_locations": [
        "experiment"
      ],
      "claim": "Documents D1–D4 point at 0°, 45°, 90° and 135°. Rotate the query between 0° and 180°. Each arrow has length 1. The second chart shows all four scores on the full −1 to +1 scale. cos(q,d) = (q · d) / (‖q‖ ‖d‖), for nonzero vectors. Exact ties use document ID order in this toy. Labels have no semantic meaning and the score is not a probability. 0° between vectors: Cosine = 1: Same direction, including positive rescaling. 90° between vectors: Cosine = 0: Orthogonal directions. 180° between vectors: Cosine = −1: Opposite directions; negative values are possible.",
      "source_ids": [],
      "evidence_ids": [],
      "verdict": "original_synthetic_experiment",
      "reason": "Original fixed inputs and outputs; Python assertions and independent browser arithmetic checked in verification artifacts."
    },
    {
      "id": "C03",
      "notebook_locations": [
        "workflow"
      ],
      "claim": "Text embedding models map text to vectors. A retrieval system can compare a query vector with document vectors and rank candidates by a chosen similarity function. That representation is learned by a real model; the four vectors below are hand-authored geometric examples, not embeddings of the displayed labels.",
      "source_ids": [
        "S1"
      ],
      "evidence_ids": [
        "S1-E1"
      ],
      "verdict": "source_supported_with_stated_scope",
      "reason": "Read against the stated source sections and notebook assumptions; see separate source audit. "
    },
    {
      "id": "C04",
      "notebook_locations": [
        "workflow"
      ],
      "claim": "Cosine similarity divides the dot product by both vector lengths. It measures direction for nonzero vectors. Multiplying one vector by a positive scalar leaves its cosine with another vector unchanged. On unit-length vectors, the denominator is one, so cosine equals the dot product.",
      "source_ids": [
        "S2"
      ],
      "evidence_ids": [
        "S2-E1"
      ],
      "verdict": "source_supported_with_stated_scope",
      "reason": "Read against the stated source sections and notebook assumptions; see separate source audit. "
    },
    {
      "id": "C05",
      "notebook_locations": [
        "interpretation"
      ],
      "claim": "At a query angle of 45°, D2 has score 1, while D1 and D3 tie near 0.7071. The tie is broken by ID here. A query at 180° gives D1 score −1. The figure therefore preserves negative scores rather than clipping them into an apparently probabilistic range.",
      "source_ids": [],
      "evidence_ids": [],
      "verdict": "original_example_or_reasoned_limitation",
      "reason": "Read against the stated source sections and notebook assumptions; see separate source audit. "
    },
    {
      "id": "C06",
      "notebook_locations": [
        "interpretation"
      ],
      "claim": "The mathematical denominator vanishes for a zero vector. This notebook’s Python helper raises an error instead of choosing a library-specific fallback. A production system should record the actual encoder and similarity implementation, including normalization and its zero-vector behavior.",
      "source_ids": [
        "S2"
      ],
      "evidence_ids": [
        "S2-E1"
      ],
      "verdict": "source_supported_with_stated_scope",
      "reason": "Read against the stated source sections and notebook assumptions; see separate source audit. "
    },
    {
      "id": "C07",
      "notebook_locations": [
        "interpretation"
      ],
      "claim": "Editorial retrieval check: inspect which passages a ranking actually returns and label their relevance to real questions. A model’s similarity convention, an index configuration and evidence quality are separate parts of that evaluation. This exercise establishes only the declared geometry.",
      "source_ids": [
        "S1",
        "S3"
      ],
      "evidence_ids": [
        "S1-E1",
        "S3-E1"
      ],
      "verdict": "source_supported_with_stated_scope",
      "reason": "Read against the stated source sections and notebook assumptions; see separate source audit. "
    },
    {
      "id": "C08",
      "notebook_locations": [
        "reproduce"
      ],
      "claim": "The original standard-library Python example passed its assertions and 7 input fixtures. Its browser implementation is separately compared against those results.",
      "source_ids": [],
      "evidence_ids": [],
      "verdict": "tested_original_example",
      "reason": "No publisher code executed; no model, external network call or privileged action in the examples."
    },
    {
      "id": "C09",
      "notebook_locations": [
        "self-check"
      ],
      "claim": "What is the cosine of two nonzero perpendicular vectors? Correct answer: 0. Their dot product is zero, so their normalized dot product is zero.",
      "source_ids": [
        "S2"
      ],
      "evidence_ids": [
        "S2-E1"
      ],
      "verdict": "source_supported_and_worked_example",
      "reason": "Answer rechecked against the declared fixture and cited source scope."
    },
    {
      "id": "C10",
      "notebook_locations": [
        "self-check"
      ],
      "claim": "Multiply one vector by a positive number. What happens to cosine? Correct answer: It stays the same. The scale appears in the numerator and length denominator and cancels.",
      "source_ids": [
        "S2"
      ],
      "evidence_ids": [
        "S2-E1"
      ],
      "verdict": "source_supported_and_worked_example",
      "reason": "Answer rechecked against the declared fixture and cited source scope."
    },
    {
      "id": "C11",
      "notebook_locations": [
        "self-check"
      ],
      "claim": "Does a score of 0.9 prove a passage supports an answer? Correct answer: No. A geometric match does not inspect the passage’s factual support.",
      "source_ids": [],
      "evidence_ids": [],
      "verdict": "original_example_or_reasoned_limitation",
      "reason": "Answer rechecked against the declared fixture and cited source scope."
    },
    {
      "id": "C12",
      "notebook_locations": [
        "self-check"
      ],
      "claim": "What policy does this example use for a zero vector? Correct answer: Reject it. The helper rejects a denominator of zero; that explicit policy is part of this toy.",
      "source_ids": [],
      "evidence_ids": [],
      "verdict": "original_example_or_reasoned_limitation",
      "reason": "Answer rechecked against the declared fixture and cited source scope."
    }
  ],
  "original_experiment": {
    "scope": "Hand-authored two-dimensional vectors. No embedding model is downloaded or evaluated.",
    "assumptions": "cos(q,d) = (q · d) / (‖q‖ ‖d‖), for nonzero vectors. Exact ties use document ID order in this toy. Labels have no semantic meaning and the score is not a probability.",
    "results_file": "verification/python-results.json"
  },
  "library_gap": null,
  "excluded_evidence": [],
  "limitations": [
    "No real model or GPU measured.",
    "Sources and version/date labels checked as recorded; this does not prove absence of errors."
  ],
  "separate_audit_file": "verification/source-audit.json",
  "publication": {
    "state": "published",
    "approved_on": "2026-11-14",
    "published_on": "2026-11-14",
    "source_checks_on": "2026-11-13"
  }
}
