vigneshwar234 commited on
Commit
f817d5c
·
verified ·
1 Parent(s): b78b4bc

Add source: tmt/experiments/04_compare.ipynb

Browse files
Files changed (1) hide show
  1. tmt/experiments/04_compare.ipynb +61 -0
tmt/experiments/04_compare.ipynb ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "cells": [
3
+ {
4
+ "cell_type": "markdown",
5
+ "metadata": {},
6
+ "source": ["# Experiment 04 — Perplexity Comparison Table\n", "Collects results from all ablations and renders a comparison table."]
7
+ },
8
+ {
9
+ "cell_type": "code",
10
+ "execution_count": null,
11
+ "metadata": {},
12
+ "outputs": [],
13
+ "source": [
14
+ "import pandas as pd\n",
15
+ "import matplotlib.pyplot as plt\n",
16
+ "\n",
17
+ "# Fill these in after running experiments 01-03\n",
18
+ "results = {\n",
19
+ " 'Model': ['Vanilla Transformer', 'Mesh Attention Only', 'Full TMT'],\n",
20
+ " 'Perplexity': [None, None, None], # replace with actual values\n",
21
+ " 'Avg Compute / Token': ['100%', '~60%', '~50%'],\n",
22
+ " 'Innovations': [\n",
23
+ " 'none',\n",
24
+ " 'mesh attention',\n",
25
+ " 'mesh + temporal decay + adaptive depth + dual-stream FFN + memory anchors'\n",
26
+ " ]\n",
27
+ "}\n",
28
+ "\n",
29
+ "df = pd.DataFrame(results)\n",
30
+ "print(df.to_markdown(index=False))"
31
+ ]
32
+ },
33
+ {
34
+ "cell_type": "code",
35
+ "execution_count": null,
36
+ "metadata": {},
37
+ "outputs": [],
38
+ "source": [
39
+ "fig, ax = plt.subplots(figsize=(8, 4))\n",
40
+ "valid = [(m, p) for m, p in zip(results['Model'], results['Perplexity']) if p is not None]\n",
41
+ "if valid:\n",
42
+ " models, ppls = zip(*valid)\n",
43
+ " bars = ax.bar(models, ppls, color=['#4C72B0', '#DD8452', '#55A868'])\n",
44
+ " ax.bar_label(bars, fmt='%.1f')\n",
45
+ " ax.set_ylabel('Perplexity (lower is better)')\n",
46
+ " ax.set_title('TemporalMesh Transformer Ablation Study')\n",
47
+ " plt.tight_layout()\n",
48
+ " plt.savefig('ablation_perplexity.png', dpi=150)\n",
49
+ " plt.show()\n",
50
+ "else:\n",
51
+ " print('Run experiments 01-03 first, then fill in the Perplexity values above.')"
52
+ ]
53
+ }
54
+ ],
55
+ "metadata": {
56
+ "kernelspec": {"display_name": "Python 3", "language": "python", "name": "python3"},
57
+ "language_info": {"name": "python", "version": "3.10.0"}
58
+ },
59
+ "nbformat": 4,
60
+ "nbformat_minor": 4
61
+ }