Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ Each chapter is an ablation: from bandits through PPO and SAC, then offline RL,

BreakRL is a bilingual, failure-first RL textbook (English default, Chinese edition). Each chapter explains a mechanism, then removes it so you can see the failure. Chapters 12–14 use toy sequence tasks and two-digit addition; they are not a substitute for production RLHF, DPO, or GRPO training.

**Current textbook:** v1.2.x on `main`. A V2 rewrite is an unstarted internal spec; it will not replace or empty this tree.

<p align="center">
<a href="https://powfu-zwx.github.io/BreakRL/demo.html"><img src="assets/readme-demo-en.gif" alt="Minimum demo: at low data coverage, TD loss falls while actual return collapses" width="720"></a>
</p>
Expand Down
2 changes: 0 additions & 2 deletions README.zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@

BreakRL 是一本双语、失败优先的强化学习教材(英文为默认语言,另有中文版)。每章先讲机制,再去掉它,让你看见失败。第 12–14 章用玩具序列和两位数加法讲机制,不能替代真实的 RLHF、DPO 或 GRPO 训练。

**当前教材:** `main` 上的 v1.2.x。V2 仍是未开工的内部规格,不会替换或清空本仓库。

<p align="center">
<a href="https://powfu-zwx.github.io/BreakRL/demo.html"><img src="assets/readme-demo.gif" alt="最小演示:低数据覆盖率时 TD loss 下降,实际回报塌缩" width="720"></a>
</p>
Expand Down
1 change: 0 additions & 1 deletion book/_config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ sphinx:
language: en
exclude_patterns:
- ".github/**"
- "PROJECT_AUDIT.md"
html_css_files:
- lang-toggle.css
- breakrl.css
Expand Down
71 changes: 19 additions & 52 deletions book/_static/breakrl.js
Original file line number Diff line number Diff line change
@@ -1,36 +1,7 @@
(function () {
'use strict';

function pagename() {
if (window.DOCUMENTATION_OPTIONS && DOCUMENTATION_OPTIONS.pagename) {
return String(DOCUMENTATION_OPTIONS.pagename);
}
var path = String(window.location.pathname || '');
var trimmed = path.replace(/\/+$/, '');
if (!trimmed || /(?:^|\/)index\.html$/.test(trimmed) || /\/$/.test(path)) {
return 'index';
}
var marker = '/BreakRL/';
var start = trimmed.indexOf(marker);
var relative = start >= 0 ? trimmed.slice(start + marker.length) : trimmed.replace(/^.*\//, '');
return relative.replace(/\.html$/, '');
}

function setSurface() {
var page = pagename();
var home = page === 'index' || page === 'index-zh';
var demo = page === 'demo';
var atlas = page === 'failure-atlas' || page === 'failure-atlas-en';
var pdf = page === 'offline-rl-text' || page === 'offline-rl-text-en';
document.documentElement.classList.toggle('breakrl-home', home);
document.documentElement.classList.toggle('breakrl-demo-page', demo);
document.documentElement.classList.toggle('breakrl-atlas', atlas);
document.documentElement.classList.toggle('breakrl-reader', pdf);
document.body.classList.toggle('breakrl-home', home);
document.body.classList.toggle('breakrl-demo-page', demo);
document.body.classList.toggle('breakrl-atlas', atlas);
document.body.classList.toggle('breakrl-reader', pdf);
}
var CHINESE_FOOTER = 'BreakRL 是一本双语、失败优先的强化学习教材。正文 CC BY 4.0,代码 MIT。';

function brandHref() {
var brand = document.querySelector('a.navbar-brand');
Expand Down Expand Up @@ -77,45 +48,41 @@
}
}

// Give an element its Chinese label while remembering what the page itself
// says, so switching back to English restores the text `_toc.yml` or
// `_config.yml` holds instead of a copy kept here.
function swapToChinese(selector, chinese, lang) {
document.querySelectorAll(selector).forEach(function (node) {
var original = node.getAttribute('data-breakrl-original');
if (original === null) {
original = (node.textContent || '').trim();
node.setAttribute('data-breakrl-original', original);
}
node.textContent = lang === 'zh' ? chinese : original;
});
}

function relabelToc() {
var lang = document.documentElement.getAttribute('data-breakrl-lang') || 'en';
document.querySelectorAll('.bd-sidebar p.caption .caption-text').forEach(function (node) {
var original = node.getAttribute('data-breakrl-caption') || (node.textContent || '').trim();
if (!node.getAttribute('data-breakrl-caption')) {
node.setAttribute('data-breakrl-caption', original);
}
if (original === '从这里开始 / Start here' || original === 'Start here') {
if (original === 'Start here') {
node.textContent = lang === 'zh' ? '从这里开始' : 'Start here';
} else if (original === 'English' || original === 'Chapters') {
node.textContent = 'Chapters';
} else if (original === '中文版' || original === '章节') {
} else if (original === '中文版') {
node.textContent = lang === 'zh' ? '章节' : '中文版';
}
});
document.querySelectorAll('.bd-sidebar a[href$="demo.html"]').forEach(function (node) {
node.textContent = lang === 'zh' ? '最小演示' : 'Minimum demo';
});
document.querySelectorAll('.breakrl-footer').forEach(function (node) {
node.textContent = lang === 'zh'
? 'BreakRL 是一本双语、失败优先的强化学习教材。正文 CC BY 4.0,代码 MIT。'
: 'BreakRL is a bilingual, failure-first RL textbook. Text CC BY 4.0. Code MIT.';
});
}

function keepHomepageVisible() {
var article = document.getElementById('breakrl');
var english = document.getElementById('breakrl-english');
if (article && !english && article.hidden) {
article.hidden = false;
}
swapToChinese('.bd-sidebar a[href$="demo.html"]', '最小演示', lang);
swapToChinese('.breakrl-footer', CHINESE_FOOTER, lang);
}

function init() {
setSurface();
useTextBrand();
installHeaderBrand();
relabelToc();
keepHomepageVisible();
}

if (document.readyState === 'loading') {
Expand Down
Loading