FEmXFeqYNZ / notebooks /success_conditioning_tutorial.py
DineshAI's picture
Add claim-by-claim CPU reproduction evidence
73f895d verified
Raw
History Blame Contribute Delete
2.93 kB
import marimo
__generated_with = "0.23.15"
app = marimo.App(width="medium")
@app.cell
def _():
import marimo as mo
return (mo,)
@app.cell
def _(mo):
mo.md(r"""
# Success conditioning, from identity to failure mode
![Four verified contracts](https://huggingface.co/spaces/DineshAI/FEmXFeqYNZ/resolve/main/images/reproduction_summary.svg)
This tutorial opens with the published evidence; no expensive experiment
is required. The formal reproduction uses exact dynamic programming,
24 independent constrained solves, a symbolic monotonicity certificate,
and 63,360 analytic threshold cells.
""")
return
@app.cell
def _(mo):
q_good = mo.ui.slider(0.50, 0.99, value=0.70, step=0.01, label="Good-action success")
q_bad = mo.ui.slider(0.01, 0.49, value=0.30, step=0.01, label="Bad-action success")
mo.hstack([q_bad, q_good], justify="space-around")
return q_bad, q_good
@app.cell
def _(mo, q_bad, q_good):
behavior = 0.5
value = behavior * q_bad.value + behavior * q_good.value
conditioned_good = behavior * q_good.value / value
new_value = (1 - conditioned_good) * q_bad.value + conditioned_good * q_good.value
influence = (
behavior * (q_bad.value - value) ** 2
+ behavior * (q_good.value - value) ** 2
) / value**2
relative_improvement = (new_value - value) / value
mo.md(
f"""
## A two-action success-conditioned update
Behavior success is **{value:.4f}**. Conditioning raises the good-action
probability from `0.5` to **{conditioned_good:.4f}** and success to
**{new_value:.4f}**.
The statewise identity is visible numerically:
| quantity | value |
|---|---:|
| relative improvement | `{relative_improvement:.8f}` |
| action-influence | `{influence:.8f}` |
Their difference is `{abs(relative_improvement - influence):.2e}`.
"""
)
return
@app.cell
def _(mo):
mo.md(r"""
## Why thresholding can break alignment
Faithful randomized labels preserve expected reward. A threshold label
instead asks which action most often exceeds `θ`. Near `θ=1`, volatile
low-mean actions can win that tail-probability contest through luck. The
published paper-setting sweep finds:
| statistic | observed |
|---|---:|
| faithful conditioned return | `0.507143` |
| best proxy gain beyond faithful | `0.004927–0.005400` |
| first harmful threshold | `0.968–0.970` |
| return at threshold `0.999` | `0.500024–0.500030` |
[Read the complete illustrated report](https://github.com/MachineLearning-Nerd/icml26-repro-FEmXFeqYNZ-success-conditioning/blob/main/reports/success-conditioning/report.md)
or inspect the [canonical raw-evidence page](https://huggingface.co/spaces/DineshAI/FEmXFeqYNZ).
""")
return
if __name__ == "__main__":
app.run()