Skip to content

Add latex-vs-slogan retrieval experiment - #14

Open
Vilin97 wants to merge 1 commit into
mainfrom
add-latex-vs-slogan-experiment
Open

Add latex-vs-slogan retrieval experiment#14
Vilin97 wants to merge 1 commit into
mainfrom
add-latex-vs-slogan-experiment

Conversation

@Vilin97

@Vilin97 Vilin97 commented Jul 16, 2026

Copy link
Copy Markdown
Collaborator

What

Adds experiments/latex_vs_slogan/ — a controlled test of whether we should index a
theorem's verbatim raw-LaTeX statement or an LLM slogan for natural-language
retrieval. Corroborates the "raw LaTeX underperforms" decision and explains the apparent
counterexamples.

Setup

  • 100 theorems from 10 papers, one per arXiv math tag (AG, AT, NT, CO, PR, DG, FA, LO, RT, AP); statements extracted from arXiv LaTeX source (frozen in data/papers.json).
  • Per theorem: a slogan and an independent NL query (searcher's register, no formulas), both from Qwen3-235B-A22B-Instruct-2507.
  • Embed with Qwen3-Embedding-8B via Nebius/TokenFactory; score gap = cos(query, slogan) − cos(query, raw) under the deployed asymmetric prompts and a symmetric-query variant.

Result

config slogan closer mean gap mean cos slo / raw
asym (deployed) 87 / 100 +0.061 0.806 / 0.745
symq (symmetric) 90 / 100 +0.067 0.854 / 0.787
  • Every tag favors the slogan on average (per-tag 60–100%).
  • Mechanism: the slogan advantage grows with the notation density of the raw statement (Pearson r = +0.28) — symbol-dense statements embed poorly against NL.
  • Raw LaTeX wins only a 13% minority: statements that are already prose (nothing to translate) or where the slogan drifted into higher-abstraction jargon.

figure

Full write-up, per-tag tables, minority-case breakdown, and caveats (chiefly: query and slogan share a source, so the +0.06 is an upper-ish bound) are in experiments/latex_vs_slogan/README.md.

Notes

  • Scripts read the embedding key from NEBIUS_API_KEY / TOKENFACTORY_API_KEY (or a repo-root .env); no secrets are committed.
  • .gitignore gains two ! allow-rules for this experiment's data/*.json and figure, matching the existing per-experiment convention.
  • Reproduce: pip install -r requirements.txt then run_experiment.py / analyze.py / plot.py (corpus is committed; fetch_theorems.py re-fetches).

🤖 Generated with Claude Code

https://claude.ai/code/session_01HqhLKdyxACFbErUP4vDpM1

Compares embedding a verbatim raw-LaTeX theorem statement vs. an
LLM-generated slogan for natural-language retrieval, on 100 theorems
from 10 papers (one per arXiv math tag). The slogan is closer to the
NL query in 87% of cases under the deployed asymmetric prompts (90%
under symmetric-query prompts), mean cosine gap +0.061 (slogan 0.806
vs raw 0.745). The advantage grows with the notation density of the
raw statement (Pearson r = +0.28): symbol-dense statements embed
poorly against NL and the slogan recovers them. Raw LaTeX wins only a
13% minority, concentrated in already-prose statements or where the
generated slogan drifted into higher-abstraction jargon.

Adds experiments/latex_vs_slogan/ with the pipeline (fetch_theorems,
run_experiment, analyze, plot), the frozen corpus + results, the
figure, and an analysis README. Scripts read the embedding key from
NEBIUS_API_KEY/TOKENFACTORY_API_KEY; no secrets are committed.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HqhLKdyxACFbErUP4vDpM1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant