Query rotation
Rotating the query changes which document aligns best.
Local calculation / simulationLocal educational experiment. No external API calls. Synthetic fixtures are not production measurements.
Study guide & lesson outline
LEARNING CONTRACTUnderstand → implement → investigate
Goal: explain the mechanism in this lesson, reproduce one example and test a failure case. Reading alone does not mark mastery.
- Understand: state assumptions, shapes/units and a counterexample.
- Implement: reproduce a numerical example and inspect boundaries.
- Investigate: compare one alternative under a matched budget.
02 · Predict & configure
Technical scenario notes, parameter names and reference answers are currently in English.
03 · Inspect the evidence
Methods & references
Five manually chosen 2D vectors, not embeddings generated by a language model. Zero-vector cosine is defined as 0 in this lab. Ties preserve fixture order.
Text / 原始公式
cos(q,d)=q·d/(||q|| ||d||); dot(q,d)=Σqᵢdᵢ
Geometry alone cannot establish semantic relevance; these vectors are hand-authored.
Introduction to Information Retrieval · vector space scoring ↗Practice questions
embedding-3 / 01What does “Query rotation” test?
Rotating the query changes which document aligns best.
Original teaching answer / local derivation. Method reference: Introduction to Information Retrieval · vector space scoring ↗
Open lab →embedding-3 / 02Which computation produces the result in “Query rotation”?
Original teaching answer / local derivation. Method reference: Introduction to Information Retrieval · vector space scoring ↗
Open lab →embedding-3 / 03What is the baseline configuration for “Query rotation”?
{"x":0,"y":1,"metric":0}
Original teaching answer / local derivation. Method reference: Introduction to Information Retrieval · vector space scoring ↗
Open lab →embedding-3 / 04What numerical result should you check for “Query rotation”?
{"Top score":1,"Query norm":1}
Original teaching answer / local derivation. Method reference: Introduction to Information Retrieval · vector space scoring ↗
Open lab →embedding-3 / 05How would you run a controlled comparison for “Query rotation”?
Keep the supplied fixture and other settings fixed; change x. Compare ranking order, vector norms and scores on identical documents.
Original teaching answer / local derivation. Method reference: Introduction to Information Retrieval · vector space scoring ↗
Open lab →embedding-3 / 06What failure could invalidate a conclusion from “Query rotation”?
Geometry alone cannot establish semantic relevance; these vectors are hand-authored.
Original teaching answer / local derivation. Method reference: Introduction to Information Retrieval · vector space scoring ↗
Open lab →embedding-3 / 07Is “Query rotation” a benchmark of a deployed language model?
No. Five manually chosen 2D vectors, not embeddings generated by a language model. Zero-vector cosine is defined as 0 in this lab. Ties preserve fixture order.
Original teaching answer / local derivation. Method reference: Introduction to Information Retrieval · vector space scoring ↗
Open lab →embedding-3 / 08Which evidence should you report for “Query rotation”?
Compare ranking order, vector norms and scores on identical documents. Export inputs, engine, result and method; distinguish synthetic fixtures from observed production data.
Original teaching answer / local derivation. Method reference: Introduction to Information Retrieval · vector space scoring ↗
Open lab →embedding-3 / 09How can another researcher reproduce “Query rotation”?
Open embedding-3, reset the preset, retain the exact inputs and run. The calculation is deterministic for identical inputs.
Original teaching answer / local derivation. Method reference: Introduction to Information Retrieval · vector space scoring ↗
Open lab →embedding-3 / 10What is the next validation step after “Query rotation”?
Geometry alone cannot establish semantic relevance; these vectors are hand-authored. Test the hypothesis on a representative held-out workload and document a baseline, success metric and stopping rule before claiming deployment readiness.
Original teaching answer / local derivation. Method reference: Introduction to Information Retrieval · vector space scoring ↗
Open lab →Assumptions, implementation & acceptance
Mathematical cosine is undefined for a zero vector. This software returns zero as a sentinel, which must not be interpreted as orthogonality. Dot product and cosine have different scale sensitivity.
Engine formulas, scenario presets and numerical safeguards reviewed. Seeded synthetic inputs are not a production benchmark.
Before running: predict a boundary case
Rotating the query changes which document aligns best.
Hint: isolate the assumption
Keep the baseline input fixed, change one parameter or boundary, and compare both the numerical result and the claimed units. A passing example verifies this fixture only.
Minimal executable example
Save the example and linked modules in one folder. Use Node.js 22 or newer, then run node embedding-3.mjs. No third-party runtime dependencies.
import {calculate,network} from './academy-core.mjs';
const params={
"x": 0,
"y": 1,
"metric": 0
};
const result=calculate('embedding',params);
console.log(result.metrics);Test and transfer
Rotating the query changes which document aligns best.
Record input, code version, expected result and observed result in the notebook below. Then construct a counterexample that violates the assumption above and explain why the original conclusion no longer follows.
Download complete kit (.tar.gz) · Complete reference kit and regression checksPredict, test and keep evidence
Before revealing an answer, predict one result. After the exercise, record the discrepancy and a transfer test. Saved locally across language editions.
Open notebook / export / clear →The mathematical review scope is recorded per lesson. It does not establish empirical paper reproduction; report suspected errors in your notes. Review scope