zefancainlp/xiaofan_backup / local_reports /denoising-code-length-two-plots.html
zefancainlp's picture
download
raw
13.1 kB
<!doctype html>
<html lang="zh-CN">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Denoising: code length across rollout steps</title>
<script src="https://cdn.jsdelivr.net/npm/d3@7.9.0/dist/d3.min.js"></script>
<style>
:root {
color-scheme: light dark;
--background: #f7f8fc;
--surface: #ffffff;
--foreground: #172033;
--muted: #637083;
--border: #d9dfeb;
--grid: #e8ecf3;
--single: #1769e0;
--single-fill: rgba(23, 105, 224, 0.12);
--baseline: #e05b36;
--baseline-fill: rgba(224, 91, 54, 0.12);
--accent-bg: #edf4ff;
--shadow: 0 10px 28px rgba(22, 32, 51, 0.08);
}
@media (prefers-color-scheme: dark) {
:root {
--background: #10141d;
--surface: #171d28;
--foreground: #ecf1fb;
--muted: #aeb8c8;
--border: #303a49;
--grid: #27303d;
--single: #69a7ff;
--single-fill: rgba(105, 167, 255, 0.14);
--baseline: #ff8d6e;
--baseline-fill: rgba(255, 141, 110, 0.14);
--accent-bg: #172a47;
--shadow: 0 12px 34px rgba(0, 0, 0, 0.28);
}
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
background: var(--background);
color: var(--foreground);
font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
line-height: 1.45;
}
main {
width: min(1480px, calc(100% - 40px));
margin: 0 auto;
padding: 30px 0 34px;
}
h1 {
margin: 0;
font-size: clamp(25px, 2.5vw, 38px);
line-height: 1.15;
letter-spacing: -0.025em;
}
.subtitle {
max-width: 980px;
margin: 9px 0 18px;
color: var(--muted);
font-size: 14px;
}
.summary {
display: grid;
grid-template-columns: repeat(3, minmax(0, 1fr));
gap: 10px;
margin-bottom: 14px;
}
.stat {
min-height: 82px;
padding: 13px 15px;
border: 1px solid var(--border);
border-radius: 12px;
background: var(--surface);
}
.stat-label {
color: var(--muted);
font-size: 12px;
font-weight: 650;
letter-spacing: 0.035em;
text-transform: uppercase;
}
.stat-value {
display: block;
margin-top: 4px;
font-size: clamp(18px, 2vw, 27px);
font-weight: 760;
letter-spacing: -0.02em;
}
.plots {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 14px;
}
.panel {
min-width: 0;
padding: 17px 17px 13px;
border: 1px solid var(--border);
border-radius: 15px;
background: var(--surface);
box-shadow: var(--shadow);
}
.panel-heading {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 12px;
margin-bottom: 3px;
}
h2 {
margin: 0;
font-size: 17px;
line-height: 1.25;
}
.badge {
flex: 0 0 auto;
padding: 3px 8px;
border-radius: 999px;
background: var(--accent-bg);
color: var(--foreground);
font-size: 11px;
font-weight: 700;
}
.panel-note {
margin: 0 0 8px;
color: var(--muted);
font-size: 12px;
}
.chart {
width: 100%;
min-height: 410px;
}
svg { display: block; width: 100%; overflow: visible; }
.axis path, .axis line { stroke: var(--border); }
.axis text { fill: var(--muted); font-size: 11px; }
.grid line { stroke: var(--grid); }
.grid path { display: none; }
.axis-label { fill: var(--muted); font-size: 11px; }
.endpoint-label { fill: var(--foreground); font-size: 12px; font-weight: 750; }
.peak-label { fill: var(--muted); font-size: 11px; }
.focus-ring { fill: var(--surface); stroke-width: 3px; }
.tooltip {
position: fixed;
z-index: 5;
pointer-events: none;
padding: 7px 9px;
border: 1px solid var(--border);
border-radius: 8px;
background: var(--surface);
color: var(--foreground);
box-shadow: var(--shadow);
font-size: 12px;
opacity: 0;
transform: translate(-50%, calc(-100% - 12px));
transition: opacity 90ms linear;
white-space: nowrap;
}
.method-note {
margin: 13px 2px 0;
color: var(--muted);
font-size: 12px;
}
@media (max-width: 880px) {
main { width: min(100% - 24px, 720px); padding-top: 20px; }
.summary { grid-template-columns: 1fr; }
.stat { min-height: 0; }
.plots { grid-template-columns: 1fr; }
.chart { min-height: 360px; }
}
</style>
</head>
<body>
<main>
<h1>Denoising:最终 best 代码长度随 step 的变化</h1>
<p class="subtitle">
两张图使用完全相同的纵轴(0–1,100 行),追踪各自最终 best 节点的祖先路径;代码围栏不计入行数。
</p>
<section class="summary" aria-label="Key comparisons">
<div class="stat">
<span class="stat-label">相同 25-step 预算</span>
<span class="stat-value">230 vs 524 lines</span>
</div>
<div class="stat">
<span class="stat-label">各自运行终点</span>
<span class="stat-value">230 vs 1,043 lines</span>
</div>
<div class="stat">
<span class="stat-label">25-step 减少</span>
<span class="stat-value">56.1% fewer lines</span>
</div>
</section>
<section class="plots">
<article class="panel">
<div class="panel-heading">
<h2>Single-anchor PFG</h2>
<span class="badge">25 rollout steps</span>
</div>
<p class="panel-note">完整可执行代码;最终 230 行 = 150 行 active graph + 80 行固定框架。</p>
<div id="single-chart" class="chart"></div>
</article>
<article class="panel">
<div class="panel-heading">
<h2>Baseline</h2>
<span class="badge">50 rollout steps</span>
</div>
<p class="panel-note">完整生成程序;最终增长到 1,043 行。</p>
<div id="baseline-chart" class="chart"></div>
</article>
</section>
<p class="method-note">
Init 表示训练前状态;single-anchor 的 step 0–24 共 25 次 rollout,baseline 的 step 0–49 共 50 次 rollout。
</p>
</main>
<div id="tooltip" class="tooltip" role="status" aria-live="polite"></div>
<script>
const singleValues = [82,126,151,162,155,191,207,203,243,243,264,267,267,269,268,275,275,267,268,253,263,247,233,239,238,230];
const baselineValues = [60,195,306,354,347,350,364,447,453,479,569,623,565,581,586,414,436,524,575,577,579,602,634,653,512,524,516,511,636,694,737,776,776,809,828,824,821,865,877,931,988,927,945,953,966,1037,1007,1047,1066,1051,1043];
const toSeries = values => values.map((lines, index) => ({
index,
step: index - 1,
label: index === 0 ? "Init" : `Step ${index - 1}`,
lines
}));
const charts = [
{
selector: "#single-chart",
data: toSeries(singleValues),
color: "--single",
fill: "--single-fill",
description: "Single-anchor PFG full executable code length from initialization through 25 rollout steps."
},
{
selector: "#baseline-chart",
data: toSeries(baselineValues),
color: "--baseline",
fill: "--baseline-fill",
description: "Baseline full generated program length from initialization through 50 rollout steps."
}
];
const tooltip = d3.select("#tooltip");
const css = name => getComputedStyle(document.documentElement).getPropertyValue(name).trim();
function drawChart(config) {
const host = document.querySelector(config.selector);
const width = Math.max(340, host.clientWidth);
const compact = width < 520;
const height = compact ? 350 : 410;
const margin = { top: 24, right: 30, bottom: 48, left: 58 };
const innerWidth = width - margin.left - margin.right;
const innerHeight = height - margin.top - margin.bottom;
const color = css(config.color);
const fill = css(config.fill);
d3.select(host).selectAll("*").remove();
const svg = d3.select(host)
.append("svg")
.attr("viewBox", `0 0 ${width} ${height}`)
.attr("role", "img")
.attr("aria-label", config.description);
svg.append("title").text(config.description);
svg.append("desc").text("The vertical scale is shared with the companion chart and runs from 0 to 1100 lines.");
const g = svg.append("g").attr("transform", `translate(${margin.left},${margin.top})`);
const x = d3.scaleLinear()
.domain(d3.extent(config.data, d => d.index))
.range([0, innerWidth]);
const y = d3.scaleLinear().domain([0, 1100]).range([innerHeight, 0]);
const maxStep = config.data.length - 2;
let tickSteps;
if (maxStep <= 24) tickSteps = compact ? [-1, 5, 11, 17, 24] : [-1, 5, 10, 15, 20, 24];
else tickSteps = compact ? [-1, 9, 19, 29, 39, 49] : [-1, 10, 20, 30, 40, 49];
const tickIndices = tickSteps.map(step => step + 1);
g.append("g")
.attr("class", "grid")
.call(d3.axisLeft(y).tickValues([0, 200, 400, 600, 800, 1000]).tickSize(-innerWidth).tickFormat(""));
g.append("g")
.attr("class", "axis")
.attr("transform", `translate(0,${innerHeight})`)
.call(d3.axisBottom(x).tickValues(tickIndices).tickFormat(i => i === 0 ? "Init" : `${i - 1}`));
g.append("g")
.attr("class", "axis")
.call(d3.axisLeft(y).tickValues([0, 200, 400, 600, 800, 1000]).tickFormat(d3.format(",d")));
g.append("text")
.attr("class", "axis-label")
.attr("x", innerWidth / 2)
.attr("y", innerHeight + 41)
.attr("text-anchor", "middle")
.text("Rollout step");
g.append("text")
.attr("class", "axis-label")
.attr("transform", "rotate(-90)")
.attr("x", -innerHeight / 2)
.attr("y", -45)
.attr("text-anchor", "middle")
.text("Code length (lines)");
const area = d3.area()
.x(d => x(d.index))
.y0(innerHeight)
.y1(d => y(d.lines))
.curve(d3.curveMonotoneX);
const line = d3.line()
.x(d => x(d.index))
.y(d => y(d.lines))
.curve(d3.curveMonotoneX);
g.append("path")
.datum(config.data)
.attr("fill", fill)
.attr("d", area);
g.append("path")
.datum(config.data)
.attr("fill", "none")
.attr("stroke", color)
.attr("stroke-width", 3)
.attr("stroke-linecap", "round")
.attr("stroke-linejoin", "round")
.attr("d", line);
const peak = config.data.reduce((a, b) => a.lines > b.lines ? a : b);
const finalPoint = config.data[config.data.length - 1];
g.append("circle")
.attr("class", "focus-ring")
.attr("cx", x(finalPoint.index))
.attr("cy", y(finalPoint.lines))
.attr("r", 5)
.attr("stroke", color);
g.append("text")
.attr("class", "endpoint-label")
.attr("x", x(finalPoint.index) - 7)
.attr("y", y(finalPoint.lines) + (peak.index >= finalPoint.index - 3 ? 22 : -11))
.attr("text-anchor", "end")
.text(`${finalPoint.lines.toLocaleString()} final`);
if (peak.index !== finalPoint.index) {
g.append("circle")
.attr("cx", x(peak.index))
.attr("cy", y(peak.lines))
.attr("r", 3.5)
.attr("fill", color);
g.append("text")
.attr("class", "peak-label")
.attr("x", x(peak.index) + (peak.index >= finalPoint.index - 3 ? -8 : 0))
.attr("y", y(peak.lines) - (peak.index >= finalPoint.index - 3 ? 17 : 10))
.attr("text-anchor", peak.index >= finalPoint.index - 3 ? "end" : "middle")
.text(`peak ${peak.lines.toLocaleString()}`);
}
g.selectAll(".hit")
.data(config.data)
.join("circle")
.attr("class", "hit")
.attr("cx", d => x(d.index))
.attr("cy", d => y(d.lines))
.attr("r", compact ? 8 : 7)
.attr("fill", "transparent")
.attr("tabindex", 0)
.attr("aria-label", d => `${d.label}: ${d.lines} lines`)
.on("pointerenter focus", function(event, d) {
tooltip.style("opacity", 1).html(`<strong>${d.label}</strong><br>${d.lines.toLocaleString()} lines`);
const rect = this.getBoundingClientRect();
tooltip.style("left", `${rect.left + rect.width / 2}px`).style("top", `${rect.top}px`);
})
.on("pointerleave blur", () => tooltip.style("opacity", 0));
}
function renderAll() { charts.forEach(drawChart); }
renderAll();
let resizeTimer;
window.addEventListener("resize", () => {
clearTimeout(resizeTimer);
resizeTimer = setTimeout(renderAll, 120);
});
</script>
</body>
</html>

Xet Storage Details

Size:
13.1 kB
·
Xet hash:
324a7b229de9f66122bb91655b8d336c2922ae6dd2f0f532a2d533462f365a97

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.