-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
souzatharsis
committed
Dec 20, 2024
1 parent
1967c48
commit cbeec56
Showing
40 changed files
with
2,257 additions
and
978 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified
BIN
+204 Bytes
(100%)
tamingllms/_build/.doctrees/notebooks/output_size_limit.doctree
Binary file not shown.
Binary file not shown.
Binary file modified
BIN
+810 Bytes
(100%)
tamingllms/_build/.doctrees/notebooks/structured_output.doctree
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
import React from 'react'; | ||
import { BarChart, Bar, XAxis, YAxis, CartesianGrid, Tooltip, Legend, ResponsiveContainer, LineChart, Line, ErrorBar } from 'recharts'; | ||
import { Card, CardContent, CardHeader, CardTitle } from "@/components/ui/card"; | ||
|
||
const ModelComparison = () => { | ||
// Perplexity data with error margins | ||
const pplData = [ | ||
{ | ||
model: 'Q2', | ||
pplRatioPercent: (1.103587 - 1) * 100, | ||
pplRatioError: 0.007783 * 100, | ||
pplDiff: 1.751667, | ||
pplDiffError: 0.146474 | ||
}, | ||
{ | ||
model: 'Q4', | ||
pplRatioPercent: (1.035039 - 1) * 100, | ||
pplRatioError: 0.003969 * 100, | ||
pplDiff: 0.592510, | ||
pplDiffError: 0.071893 | ||
}, | ||
{ | ||
model: 'Q6', | ||
pplRatioPercent: (1.009254 - 1) * 100, | ||
pplRatioError: 0.001784 * 100, | ||
pplDiff: 0.156488, | ||
pplDiffError: 0.031618 | ||
}, | ||
]; | ||
|
||
// KL divergence data | ||
const klData = [ | ||
{ model: 'Q2', mean: 0.111707, median: 0.074315 }, | ||
{ model: 'Q4', mean: 0.029804, median: 0.019842 }, | ||
{ model: 'Q6', mean: 0.003549, median: 0.002481 }, | ||
]; | ||
|
||
const boldAxisStyle = { | ||
fontSize: '14px', | ||
fontWeight: 'bold' | ||
}; | ||
|
||
const axisLabelStyle = { | ||
fontSize: '16px', | ||
fontWeight: 'bold' | ||
}; | ||
|
||
return ( | ||
<div className="space-y-8"> | ||
<Card> | ||
<CardHeader> | ||
<CardTitle>Perplexity Comparison vs Base Model</CardTitle> | ||
</CardHeader> | ||
<CardContent> | ||
<div className="grid grid-cols-2 gap-4"> | ||
<div className="h-96"> | ||
<ResponsiveContainer width="100%" height="100%"> | ||
<BarChart data={pplData}> | ||
<CartesianGrid strokeDasharray="3 3" /> | ||
<XAxis dataKey="model" tick={boldAxisStyle} label={{ value: "Model", position: "bottom", style: axisLabelStyle }} /> | ||
<YAxis tick={boldAxisStyle} label={{ value: "PPL Ratio - 1 (%)", angle: -90, position: "insideLeft", style: axisLabelStyle }} /> | ||
<Tooltip formatter={(value) => value.toFixed(2) + '%'} /> | ||
<Bar | ||
dataKey="pplRatioPercent" | ||
name="PPL Ratio - 1 (%)" | ||
fill="#3eaf7c" | ||
> | ||
<ErrorBar dataKey="pplRatioError" width={4} strokeWidth={2} stroke="#000" /> | ||
</Bar> | ||
</BarChart> | ||
</ResponsiveContainer> | ||
</div> | ||
<div className="h-96"> | ||
<ResponsiveContainer width="100%" height="100%"> | ||
<BarChart data={pplData}> | ||
<CartesianGrid strokeDasharray="3 3" /> | ||
<XAxis dataKey="model" tick={boldAxisStyle} label={{ value: "Model", position: "bottom", style: axisLabelStyle }} /> | ||
<YAxis tick={boldAxisStyle} label={{ value: "PPL Difference", angle: -90, position: "insideLeft", style: axisLabelStyle }} /> | ||
<Tooltip /> | ||
<Bar | ||
dataKey="pplDiff" | ||
name="PPL Difference" | ||
fill="#3eaf7c" | ||
> | ||
<ErrorBar dataKey="pplDiffError" width={4} strokeWidth={2} stroke="#000" /> | ||
</Bar> | ||
</BarChart> | ||
</ResponsiveContainer> | ||
</div> | ||
</div> | ||
</CardContent> | ||
</Card> | ||
|
||
<Card> | ||
<CardHeader> | ||
<CardTitle>KL Divergence Statistics</CardTitle> | ||
</CardHeader> | ||
<CardContent> | ||
<div className="h-96"> | ||
<ResponsiveContainer width="100%" height="100%"> | ||
<LineChart data={klData}> | ||
<CartesianGrid strokeDasharray="3 3" /> | ||
<XAxis dataKey="model" tick={boldAxisStyle} label={{ value: "Model", position: "bottom", style: axisLabelStyle }} /> | ||
<YAxis tick={boldAxisStyle} label={{ value: "KL Divergence", angle: -90, position: "insideLeft", style: axisLabelStyle }} /> | ||
<Tooltip /> | ||
<Legend verticalAlign="top" height={36} /> | ||
<Line type="monotone" dataKey="mean" name="Mean" stroke="#3eaf7c" strokeWidth={3} /> | ||
<Line type="monotone" dataKey="median" name="Median" stroke="#c9b6e4" strokeWidth={3} /> | ||
</LineChart> | ||
</ResponsiveContainer> | ||
</div> | ||
</CardContent> | ||
</Card> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ModelComparison; |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.