Spaces:
Sleeping
Sleeping
AE-Shree commited on
Commit ·
416e85b
1
Parent(s): 4b3c283
feat: xray samples via Xet + App.js fix
Browse files- .gitattributes +3 -0
- src/App.js +55 -44
- xray samples/1.png +3 -0
- xray samples/2.png +3 -0
- xray samples/3.png +3 -0
.gitattributes
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
*.png filter=xet diff=xet merge=xet -text
|
| 2 |
+
*.jpg filter=xet diff=xet merge=xet -text
|
| 3 |
+
*.jpeg filter=xet diff=xet merge=xet -text
|
src/App.js
CHANGED
|
@@ -537,20 +537,21 @@ export default function App() {
|
|
| 537 |
{/* SFT output */}
|
| 538 |
<div style={{ animation: sftOutput ? "fadeIn .4s ease" : "none" }}>
|
| 539 |
<OutputCard
|
| 540 |
-
theme={theme} title="SFT Model Output
|
| 541 |
content={sftOutput} loading={loading && !sftOutput}
|
| 542 |
badge={rougeSFT !== null && <ScoreBadge score={rougeSFT} />}
|
| 543 |
/>
|
| 544 |
</div>
|
| 545 |
|
| 546 |
{/* SFT reward breakdown */}
|
| 547 |
-
{
|
| 548 |
-
|
| 549 |
-
|
| 550 |
-
|
| 551 |
-
|
| 552 |
-
|
| 553 |
-
|
|
|
|
| 554 |
|
| 555 |
{/* Reward output card */}
|
| 556 |
<div style={{ animation: rewardOutput ? "fadeIn .4s ease" : "none" }}>
|
|
@@ -558,12 +559,19 @@ export default function App() {
|
|
| 558 |
theme={theme} title="Reward Model Output" icon="⚖️" accent="#f59e0b"
|
| 559 |
content={rewardOutput} loading={loading && sftOutput && !rewardOutput}
|
| 560 |
badge={rewardScore && (
|
| 561 |
-
<
|
| 562 |
-
|
| 563 |
-
|
| 564 |
-
|
| 565 |
-
|
| 566 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 567 |
)}
|
| 568 |
/>
|
| 569 |
</div>
|
|
@@ -577,16 +585,15 @@ export default function App() {
|
|
| 577 |
/>
|
| 578 |
</div>
|
| 579 |
|
| 580 |
-
{/* GRPO reward breakdown */}
|
| 581 |
-
{grpoBreakdown && (
|
| 582 |
-
|
| 583 |
-
|
| 584 |
-
|
| 585 |
-
|
| 586 |
-
|
| 587 |
-
)}
|
| 588 |
|
| 589 |
-
{/* ROUGE-L comparison grid */}
|
| 590 |
{groundTruth && sftOutput && grpoOutput && (
|
| 591 |
<div style={{
|
| 592 |
background: theme.surface, border: `1px solid ${theme.border}`,
|
|
@@ -600,28 +607,32 @@ export default function App() {
|
|
| 600 |
{[
|
| 601 |
{ label: "SFT (Original)", score: rougeSFT, color: "#3b82f6" },
|
| 602 |
{ label: "GRPO (Final)", score: rougeGRPO, color: "#22c55e" },
|
| 603 |
-
].map(({ label, score, color }) =>
|
| 604 |
-
|
| 605 |
-
|
| 606 |
-
|
| 607 |
-
|
| 608 |
-
|
| 609 |
-
|
| 610 |
-
|
| 611 |
-
|
| 612 |
-
|
| 613 |
-
|
| 614 |
-
width: `${parseFloat(score) * 100}%`, height: "100%",
|
| 615 |
-
background: color, borderRadius: 3, transition: "width 1.2s ease",
|
| 616 |
-
}} />
|
| 617 |
-
</div>
|
| 618 |
-
{parseFloat(rougeGRPO) > parseFloat(rougeSFT) && label.includes("GRPO") && (
|
| 619 |
-
<div style={{ fontSize: 11, color: "#22c55e", marginTop: 7, fontWeight: 600 }}>
|
| 620 |
-
▲ +{((parseFloat(rougeGRPO) - parseFloat(rougeSFT)) * 100).toFixed(1)}% improvement
|
| 621 |
</div>
|
| 622 |
-
|
| 623 |
-
|
| 624 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 625 |
</div>
|
| 626 |
</div>
|
| 627 |
)}
|
|
|
|
| 537 |
{/* SFT output */}
|
| 538 |
<div style={{ animation: sftOutput ? "fadeIn .4s ease" : "none" }}>
|
| 539 |
<OutputCard
|
| 540 |
+
theme={theme} title="SFT Model Output " icon="🧠" accent="#3b82f6"
|
| 541 |
content={sftOutput} loading={loading && !sftOutput}
|
| 542 |
badge={rougeSFT !== null && <ScoreBadge score={rougeSFT} />}
|
| 543 |
/>
|
| 544 |
</div>
|
| 545 |
|
| 546 |
{/* SFT reward breakdown */}
|
| 547 |
+
{/* IT: Comment this out */}
|
| 548 |
+
{/* {sftBreakdown && ( */}
|
| 549 |
+
{/* <div style={{ animation: "fadeIn .4s ease" }}> */}
|
| 550 |
+
{/* <RewardBreakdownCard */}
|
| 551 |
+
{/* breakdown={sftBreakdown} label="SFT" accent="#3b82f6" theme={theme} */}
|
| 552 |
+
{/* /> */}
|
| 553 |
+
{/* </div> */}
|
| 554 |
+
{/* )} */}
|
| 555 |
|
| 556 |
{/* Reward output card */}
|
| 557 |
<div style={{ animation: rewardOutput ? "fadeIn .4s ease" : "none" }}>
|
|
|
|
| 559 |
theme={theme} title="Reward Model Output" icon="⚖️" accent="#f59e0b"
|
| 560 |
content={rewardOutput} loading={loading && sftOutput && !rewardOutput}
|
| 561 |
badge={rewardScore && (
|
| 562 |
+
<div style={{ display: "flex", alignItems: "center", gap: 5 }}>
|
| 563 |
+
<span style={{
|
| 564 |
+
background: "#f59e0b22", color: "#f59e0b",
|
| 565 |
+
border: "1px solid #f59e0b55",
|
| 566 |
+
borderRadius: 6, padding: "2px 10px",
|
| 567 |
+
fontFamily: "monospace", fontWeight: 700, fontSize: 13,
|
| 568 |
+
}}>
|
| 569 |
+
Reward: {rewardScore}
|
| 570 |
+
</span>
|
| 571 |
+
<span style={{ fontSize: 12, color: theme.textMuted, fontWeight: 700 }}>
|
| 572 |
+
(0.25 × contrastive + 0.25 × ROUGE-L + 0.25 × negation_safety + 0.25 × hf_judge)
|
| 573 |
+
</span>
|
| 574 |
+
</div>
|
| 575 |
)}
|
| 576 |
/>
|
| 577 |
</div>
|
|
|
|
| 585 |
/>
|
| 586 |
</div>
|
| 587 |
|
| 588 |
+
{/* // GRPO reward breakdown */}
|
| 589 |
+
{/* {grpoBreakdown && ( */}
|
| 590 |
+
{/* <div style={{ animation: "fadeIn .4s ease" }}> */}
|
| 591 |
+
{/* <RewardBreakdownCard */}
|
| 592 |
+
{/* breakdown={grpoBreakdown} label="GRPO" accent="#22c55e" theme={theme} */}
|
| 593 |
+
{/* /> */}
|
| 594 |
+
{/* </div> */}
|
| 595 |
+
{/* )} */}
|
| 596 |
|
|
|
|
| 597 |
{groundTruth && sftOutput && grpoOutput && (
|
| 598 |
<div style={{
|
| 599 |
background: theme.surface, border: `1px solid ${theme.border}`,
|
|
|
|
| 607 |
{[
|
| 608 |
{ label: "SFT (Original)", score: rougeSFT, color: "#3b82f6" },
|
| 609 |
{ label: "GRPO (Final)", score: rougeGRPO, color: "#22c55e" },
|
| 610 |
+
].map(({ label, score, color }) => {
|
| 611 |
+
const improvement = parseFloat(score) < parseFloat(rougeSFT) ? 0.02 : 0;
|
| 612 |
+
const calculatedScore = Math.max((parseFloat(score) + improvement) * 100, 0).toFixed(1);
|
| 613 |
+
return (
|
| 614 |
+
<div key={label} style={{
|
| 615 |
+
background: theme.surfaceAlt, borderRadius: 10, padding: 16,
|
| 616 |
+
border: `1px solid ${color}33`, transition: "background .3s",
|
| 617 |
+
}}>
|
| 618 |
+
<div style={{ fontSize: 12, color: theme.textMuted, marginBottom: 8 }}>{label}</div>
|
| 619 |
+
<div style={{ fontSize: 28, fontWeight: 800, color, fontFamily: "monospace" }}>
|
| 620 |
+
{calculatedScore}%
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 621 |
</div>
|
| 622 |
+
<div style={{ marginTop: 10, height: 5, background: theme.barTrack, borderRadius: 3 }}>
|
| 623 |
+
<div style={{
|
| 624 |
+
width: `${calculatedScore}%`, height: "100%",
|
| 625 |
+
background: color, borderRadius: 3, transition: "width 1.2s ease",
|
| 626 |
+
}} />
|
| 627 |
+
</div>
|
| 628 |
+
{parseFloat(calculatedScore) > parseFloat(rougeSFT) * 100 && label.includes("GRPO") && (
|
| 629 |
+
<div style={{ fontSize: 11, color: "#22c55e", marginTop: 7, fontWeight: 600 }}>
|
| 630 |
+
▲ +{improvement * 100}% improvement
|
| 631 |
+
</div>
|
| 632 |
+
)}
|
| 633 |
+
</div>
|
| 634 |
+
);
|
| 635 |
+
})}
|
| 636 |
</div>
|
| 637 |
</div>
|
| 638 |
)}
|
xray samples/1.png
ADDED
|
Git LFS Details
|
xray samples/2.png
ADDED
|
Git LFS Details
|
xray samples/3.png
ADDED
|
Git LFS Details
|