Skip to content

Commit fccb378

Browse files
wanshuiyinclaude
andauthored
fix(render): escape <,>,& inside math so LaTeX with < no longer breaks (#18) (#19)
Reported by @wangzh1998 (#18): LaTeX containing `<` (e.g. y_{<t}) was emitted raw into the HTML, so the browser parsed `<t}...` as an HTML tag and silently ate the rest of the formula — breaking §3.1 / Q20 / §1.2 of the KL tutorial and ~18 other spots across 7 tutorials (and any `>` / `&` matrix-align math too). Root cause: tools/render_html.py stashed math bodies as passthrough WITHOUT HTML-escaping them. Fix: html_lib.escape(body, quote=False) in the display- and inline-math substitutions. MathJax v3 reads the decoded DOM text, so it still sees the original LaTeX — escape-transparent (Codex-verified CORRECT, MathJax-safe; no entity workarounds exist in source, so no double-escaping). Re-rendered all 51 tutorial HTMLs with the fixed pipeline. Gate `verify_reviews.py --mode strict --reproduce`: 51 OK / 0 FAIL / 3 EXEMPT — every page byte-reproduces from source. Blogs unaffected (hand-authored, math in \(...\) with no raw `<`). Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 5c5d738 commit fccb378

54 files changed

Lines changed: 398 additions & 393 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ Phone on the subway, iPad at a café, laptop in the library — same HTML link o
6666

6767
## 📢 What's New
6868

69+
- **2026-06-16**![FIX](https://img.shields.io/badge/FIX-d73a49?style=flat-square) 🩹 **LaTeX `<` rendering bug fixed across the whole collection** — reported by [@wangzh1998](https://github.com/wangzh1998) in [#18](https://github.com/wanshuiyin/ARIS-in-AI-Offer/issues/18): LaTeX with `<` (e.g. `y_{<t}`) was emitted raw into the HTML, so the browser parsed `<t}…` as an HTML tag and silently ate the rest of the formula. Root-caused to [`tools/render_html.py`](tools/render_html.py) not escaping `<`/`>`/`&` inside math passthrough; fixed at the pipeline level (MathJax reads the decoded text, so the LaTeX is unchanged — escape-transparent, Codex-verified) and **re-rendered all 51 tutorial HTMLs**. Gate `--reproduce` confirms every page byte-reproduces. Thanks @wangzh1998! 🙏
6970
- **2026-06-15** — ![QUALITY](https://img.shields.io/badge/QUALITY-2ea44f?style=flat-square) 🔬 **Post-ship adversarial pass on #24/#25 — a real bug caught that survived 4 review rounds** — a fresh hostile-reviewer pass (Codex GPT-5.5 xhigh) re-derived everything from scratch and found that the **LoRA DoRA magnitude axis was wrong**: it used per-**input** (`norm dim=0`) where real DoRA / HF PEFT use per-**output** (`torch.linalg.norm(weight, dim=1)`, weight-normalization style). Fixed in §6 + Q17 + `code/lora.py` (re-verified on Server5; Codex re-confirmed CORRECT). Also corrected two RAG terms (HyDE retrieves a hypothetical **document** not "answer"; CRAG scores **retrieved-doc relevance/confidence**, not "recall"). Plus compact 2026-frontier enrichments — LoRA: S-LoRA/Punica multi-LoRA serving, *LoRA Learns Less and Forgets Less* (Biderman 2024), QDoRA · RAG: SPLADE, ColBERTv2/PLAID, Contextual Retrieval / late chunking, BEIR/MTEB. Both editions (中文 + EN) updated; all new citations verified.
7071
- **2026-06-14** — ![NEW](https://img.shields.io/badge/NEW-red?style=flat-square) 🔎 **New cheat sheet (#25): RAG + Embedding / Retrieval** — the other glaring hole: the collection used retrieval/embeddings nowhere but never explained the math. Merges "training embeddings" (bi-encoder · **InfoNCE** + temperature · in-batch / hard negatives + the false-negative trap · **Matryoshka**) with "using embeddings" (**BM25** · dense + **HNSW** · **RRF** hybrid · **cross-encoder** vs **ColBERT** late interaction · chunking · **HyDE / Self-RAG / CRAG** · **GraphRAG** · RAG-vs-long-context-vs-finetune · **RAGAS** eval) — with from-scratch PyTorch and 25 高频题. Bilingual + runnable [`code/rag_embedding.py`](docs/tutorials/code/rag_embedding.py) (6 asserts, verified on a real box). Review: 4 batched Codex GPT-5.5 xhigh passes (citations 16/16 · formulas 8/8 · code · answers) + a **holistic full-document pass** that caught cross-section inconsistencies the split passes missed + render + 2-round EN translation-fidelity. [`rag_embedding_retrieval_tutorial.html`](docs/tutorials/rag_embedding_retrieval_tutorial.html).
7172
- **2026-06-13** — ![NEW](https://img.shields.io/badge/NEW-red?style=flat-square) 🧩 **New cheat sheet (#24): LoRA / PEFT 参数高效微调** — the long-missing "how the math actually works" sheet for a method the other tutorials use 100+ times but never derive. Covers LoRA (B=0 identity start, α/r vs rsLoRA √r scaling, zero-latency merge), QLoRA (NF4 quantile quantization, double quantization, paged optimizer), DoRA (magnitude–direction decomposition), and the family (PiSSA / AdaLoRA / LoRA+ / (IA)³) vs Adapter / Prefix / Prompt / BitFit — with from-scratch PyTorch (`LoRALinear` / `DoRALinear`) and 25 高频题. effort=max; 3-round Codex GPT-5.5 xhigh math/code review (caught an NF4 bit/byte unit error, a 14-vs-16 B/param memory slip, an (IA)³ additive-vs-multiplicative mislabel, 3 unverifiable venues, and a §10 self-contradiction) + 1-round render-fidelity review, plus a runnable [`code/lora.py`](docs/tutorials/code/lora.py) (6 asserts, verified on a real GPU box). **Bilingual** (中文 + [EN](docs/tutorials/lora_peft_tutorial_en.md), 2-round translation-fidelity review). [`lora_peft_tutorial.html`](docs/tutorials/lora_peft_tutorial.html).

README_CN.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@
6666

6767
## 📢 最新动态
6868

69+
- **2026-06-16**![FIX](https://img.shields.io/badge/FIX-d73a49?style=flat-square) 🩹 **全集 LaTeX `<` 渲染 bug 修复** —— [@wangzh1998](https://github.com/wangzh1998)[#18](https://github.com/wanshuiyin/ARIS-in-AI-Offer/issues/18) 报告:含 `<` 的 LaTeX(如 `y_{<t}`)被原样输出进 HTML,浏览器把 `<t}…` 当成标签开头、悄悄吃掉后面整条公式。根因定位到 [`tools/render_html.py`](tools/render_html.py) 没对数学 passthrough 里的 `<`/`>`/`&` 转义;在 **pipeline 层修复**(MathJax 读浏览器解码后的文本,LaTeX 不变——转义透明,已 Codex 验证)并**重渲全部 51 篇 tutorial HTML**。gate `--reproduce` 确认每页都能 byte 复现。感谢 @wangzh1998!🙏
6970
- **2026-06-15**![QUALITY](https://img.shields.io/badge/QUALITY-2ea44f?style=flat-square) 🔬 **#24/#25 上线后对抗终审 —— 抓出一个过了 4 轮审的真 bug** —— 一次全新「敌意审稿人」复审(Codex GPT-5.5 xhigh,从零重推)发现 **LoRA 的 DoRA magnitude 轴反了**:用了逐**输入**`norm dim=0`),而真正的 DoRA / HF PEFT 是逐**输出**`torch.linalg.norm(weight, dim=1)`,weight normalization 风格)。已修 §6 + Q17 + `code/lora.py`(Server5 重验、Codex 复确认 CORRECT)。另修两处 RAG 术语(HyDE 检索的是「假设**文档**」不是「答案」;CRAG 打分对象是**已检索文档的相关性/置信度**,不是「recall」)。外加紧凑的 2026 前沿补全 —— LoRA:S-LoRA/Punica 多 LoRA serving、*LoRA Learns Less and Forgets Less*(Biderman 2024)、QDoRA · RAG:SPLADE、ColBERTv2/PLAID、Contextual Retrieval / late chunking、BEIR/MTEB。中英双语同步更新;新引用全部核实。
7071
- **2026-06-14** — ![NEW](https://img.shields.io/badge/NEW-red?style=flat-square) 🔎 **新 cheat sheet(第 25 篇):RAG + 文本嵌入/检索** —— 另一个 glaring hole:全集到处用检索/嵌入,却从没讲过其数学。把「训嵌入」(双塔 · **InfoNCE** + 温度 · in-batch / 难负例 + false-negative 陷阱 · **Matryoshka**)与「用嵌入」(**BM25** · 稠密 + **HNSW** · **RRF** 混合 · **cross-encoder** vs **ColBERT** late interaction · chunking · **HyDE / Self-RAG / CRAG** · **GraphRAG** · RAG-vs-长上下文-vs-微调 · **RAGAS** 评测)合成一篇 —— 含从零 PyTorch + 25 高频题。双语 + 可跑 [`code/rag_embedding.py`](docs/tutorials/code/rag_embedding.py)(6 个 assert,真机验证)。审:4 批 Codex GPT-5.5 xhigh 拆审(引用 16/16 · 公式 8/8 · 代码 · 答案)+ 一轮**全文整体审**(抓出拆审漏的接缝一致性)+ render + 2 轮 EN 翻译保真。[`rag_embedding_retrieval_tutorial.html`](docs/tutorials/rag_embedding_retrieval_tutorial.html)。
7172
- **2026-06-13** — ![NEW](https://img.shields.io/badge/NEW-red?style=flat-square) 🧩 **新 cheat sheet(第 24 篇):LoRA / PEFT 参数高效微调** —— 补上了"被全集用了 100+ 次、却从没人讲过其数学"的那篇。覆盖 LoRA(B=0 恒等起点、α/r vs rsLoRA √r 缩放、零延迟 merge)、QLoRA(NF4 分位量化、双重量化、paged optimizer)、DoRA(幅度-方向分解)、家族(PiSSA / AdaLoRA / LoRA+ / (IA)³)vs Adapter / Prefix / Prompt / BitFit —— 含从零 PyTorch(`LoRALinear` / `DoRALinear`)+ 25 高频题。effort=max;3 轮 Codex GPT-5.5 xhigh 数学/代码审(抓出 NF4 bit/byte 单位错、省显存 14-vs-16 B/param、(IA)³ 加性-vs-乘性误标、3 个无法核实的 venue、§10 自相矛盾)+ 1 轮 render 保真审,外加可跑的 [`code/lora.py`](docs/tutorials/code/lora.py)(6 个 assert,真机验证过)。**双语**(中文 + [EN](docs/tutorials/lora_peft_tutorial_en.md),2 轮翻译保真审)。[`lora_peft_tutorial.html`](docs/tutorials/lora_peft_tutorial.html)。

docs/index.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<meta name="generator" content="ARIS render-html (academic, v1)">
99
<meta name="aris:source-path" content="docs/about.md">
1010
<meta name="aris:source-sha256" content="15ccd3d65d308c4656117fca714381d163daa0631e2053409704f6c45f4617e8">
11-
<meta name="aris:generated-at" content="2026-05-31 08:56 UTC">
11+
<meta name="aris:generated-at" content="2026-06-16 06:15 UTC">
1212

1313
<!-- MathJax 3 -->
1414
<script>
@@ -546,7 +546,7 @@ <h1>About</h1>
546546
<div class="meta">
547547
<span><strong>Source:</strong> <code>docs/about.md</code></span>
548548
<span><strong>SHA256:</strong> <code>15ccd3d65d30</code></span>
549-
<span><strong>Rendered:</strong> 2026-05-31 08:56 UTC</span>
549+
<span><strong>Rendered:</strong> 2026-06-16 06:15 UTC</span>
550550

551551
</div>
552552
</header>
@@ -616,7 +616,7 @@ <h2 id="license">License</h2>
616616
Generated by <a href="https://github.com/wanshuiyin/Auto-claude-code-research-in-sleep/blob/main/skills/render-html/SKILL.md">ARIS <code>/render-html</code></a> ·
617617
source path <code>docs/about.md</code> ·
618618
SHA256 <code>15ccd3d65d30</code> ·
619-
generated at 2026-05-31 08:56 UTC.
619+
generated at 2026-06-16 06:15 UTC.
620620
This is a generated view — edit the source Markdown, then re-render.
621621
</footer>
622622
</main>

0 commit comments

Comments
 (0)