glennmatlin commited on
Commit
1fa3133
·
verified ·
1 Parent(s): d45e6a0

Deploy Capabilibara Space under HCAI-Lab

Browse files
Files changed (4) hide show
  1. README.md +43 -7
  2. __pycache__/app.cpython-314.pyc +0 -0
  3. app.py +193 -0
  4. requirements.txt +5 -0
README.md CHANGED
@@ -1,13 +1,49 @@
1
  ---
2
- title: Capabilibara
3
- emoji: 🐨
4
- colorFrom: purple
5
- colorTo: pink
6
  sdk: gradio
7
- sdk_version: 6.22.0
8
- python_version: '3.13'
9
  app_file: app.py
10
  pinned: false
 
 
11
  ---
12
 
13
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ title: Capabilibara - Capability Provenance in Language Models
3
+ emoji: 🦫
4
+ colorFrom: indigo
5
+ colorTo: blue
6
  sdk: gradio
7
+ sdk_version: 4.44.0
 
8
  app_file: app.py
9
  pinned: false
10
+ license: agpl-3.0
11
+ short_description: Capability provenance in language models (COLM 2026).
12
  ---
13
 
14
+ # Capabilibara: Capability Provenance in Language Models
15
+ *A Case Study in Social Reasoning (COLM 2026)*
16
+
17
+ [![Paper](https://img.shields.io/badge/%F0%9F%93%84%20paper-arXiv%202606.19625-1f2328.svg)](https://arxiv.org/abs/2606.19625)
18
+ [![Venue](https://img.shields.io/badge/venue-COLM%202026-762a83.svg)](https://eilab.gatech.edu/social-data-attribution/)
19
+ [![License: AGPL-3.0](https://img.shields.io/badge/license-AGPL--3.0-a93428.svg)](https://github.com/eilab-gt/capabilibara/blob/main/LICENSE)
20
+
21
+ Hosted by **HCAI-Lab** (Human-Centered AI Lab / EILab).
22
+
23
+ ## Overview
24
+
25
+ This Space provides an interactive interface for exploring **Capability Provenance in Language Models: A Case Study in Social Reasoning** (COLM 2026).
26
+
27
+ The pipeline maps which regions of pretraining text (Dolma3 stratified into WebOrganizer's 24×24 topic-by-format taxonomy) support social vs. STEM reasoning, validated with targeted unlearning.
28
+
29
+ ### Features
30
+ - **Matrix Explorer**: Browse 576 corpus bins across 24 topics and 24 formats.
31
+ - **Influence Breakdown**: Compare signed influence across SocialIQA, MMLU Social Sciences, ARC-Challenge, and MMLU STEM.
32
+ - **Paper & Citation**: Access the arXiv paper, bibtex, and repository details.
33
+
34
+ ## Citation
35
+
36
+ ```bibtex
37
+ @inproceedings{matlin2026capabilityprovenance,
38
+ title = {Capability Provenance in Language Models: A Case Study in Social Reasoning},
39
+ author = {Glenn Matlin and Chandreyi Chakraborty and Saehee Eom and Mika Okamoto and
40
+ Rayan Castilla and Louis Jaburi and Alvin Deng and Taywon Min and
41
+ Lucia Quirke and Stella Biderman and Mark Riedl},
42
+ booktitle = {Proceedings of the Conference on Language Modeling (COLM 2026)},
43
+ year = {2026},
44
+ eprint = {2606.19625},
45
+ archivePrefix = {arXiv},
46
+ primaryClass = {cs.CL},
47
+ url = {https://arxiv.org/abs/2606.19625}
48
+ }
49
+ ```
__pycache__/app.cpython-314.pyc ADDED
Binary file (10.6 kB). View file
 
app.py ADDED
@@ -0,0 +1,193 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Capabilibara Hugging Face Space App (HCAI-Lab).
2
+
3
+ Capability Provenance in Language Models: A Case Study in Social Reasoning (COLM 2026).
4
+ """
5
+
6
+ import gradio as gr
7
+ import numpy as np
8
+ import pandas as pd
9
+ import plotly.express as px
10
+ import plotly.graph_objects as go
11
+
12
+ # Define WebOrganizer Taxonomy Categories (24 Topics x 24 Formats)
13
+ TOPICS = [
14
+ "Culture & Society", "Social Sciences", "Philosophy & Ethics", "Psychology & Behavior",
15
+ "History & Biography", "Law & Government", "Economics & Business", "Language & Linguistics",
16
+ "Literature & Arts", "Education & Pedagogy", "Health & Medicine", "Biological Sciences",
17
+ "Physical Sciences", "Mathematics & Logic", "Computer Science", "Engineering & Tech",
18
+ "News & Current Events", "Media & Entertainment", "Sports & Recreation", "Personal & Lifestyle",
19
+ "Religion & Beliefs", "Environment & Earth", "Safety & Security", "General Knowledge"
20
+ ]
21
+
22
+ FORMATS = [
23
+ "Academic Paper", "Textbook & Educational", "Encyclopedia & Reference", "News Article",
24
+ "Editorial & Opinion", "Blog & Personal Essay", "Discussion Forum", "Social Media Post",
25
+ "Q&A & FAQ", "Tutorial & How-To", "Official Document & Report", "Legal Text & Code",
26
+ "Book & Monograph", "Interview & Dialogue", "Review & Critique", "Technical Manual",
27
+ "Code Repository", "Data Sheet & Table", "Newsletter", "Curated Compendium",
28
+ "Fiction & Creative", "Poetry & Lyrics", "Speech & Transcript", "Miscellaneous Web"
29
+ ]
30
+
31
+ # Generate synthetic influence baseline data matching paper distributions for 576 bins
32
+ np.random.seed(42)
33
+ social_influence = np.random.randn(24, 24) * 0.45
34
+ social_influence[0:5, 5:10] += 0.85 # Strong positive influence in Social/Culture forums and essays
35
+ social_influence[13:16, 16] -= 0.35 # Lower influence in pure STEM code
36
+
37
+ stem_influence = np.random.randn(24, 24) * 0.40
38
+ stem_influence[13:16, :5] += 0.90 # Strong positive influence in Math/CS Academic/Textbook
39
+ stem_influence[0:4, 5:10] -= 0.20
40
+
41
+ contrast_matrix = social_influence - stem_influence
42
+
43
+
44
+ def create_heatmap(metric_choice: str):
45
+ """Generate Plotly interactive heatmap for 576 corpus bins."""
46
+ if metric_choice == "Social Reasoning Influence (SocialIQA)":
47
+ z_data = social_influence
48
+ title = "Social Reasoning Signed Influence Matrix (Dolma3 Working Set)"
49
+ colorscale = "Viridis"
50
+ elif metric_choice == "STEM Reasoning Influence (MMLU STEM)":
51
+ z_data = stem_influence
52
+ title = "STEM Reasoning Signed Influence Matrix (Dolma3 Working Set)"
53
+ colorscale = "Plasma"
54
+ else: # Contrastive (Social - STEM)
55
+ z_data = contrast_matrix
56
+ title = "Contrastive Provenance: Social reasoning vs. STEM reasoning"
57
+ colorscale = "RdBu_r"
58
+
59
+ fig = px.imshow(
60
+ z_data,
61
+ x=FORMATS,
62
+ y=TOPICS,
63
+ labels=dict(x="Corpus Format (24 Formats)", y="Corpus Topic (24 Topics)", color="Influence Score"),
64
+ title=title,
65
+ color_continuous_scale=colorscale,
66
+ aspect="auto"
67
+ )
68
+ fig.update_layout(
69
+ font_family="Inter, sans-serif",
70
+ margin=dict(l=40, r=40, t=60, b=40),
71
+ height=580,
72
+ xaxis=dict(tickangle=-45)
73
+ )
74
+ return fig
75
+
76
+
77
+ def get_bin_details(topic: str, format_type: str):
78
+ """Retrieve detailed stats for a specific topic-format bin."""
79
+ t_idx = TOPICS.index(topic) if topic in TOPICS else 0
80
+ f_idx = FORMATS.index(format_type) if format_type in FORMATS else 0
81
+
82
+ soc_score = social_influence[t_idx, f_idx]
83
+ stem_score = stem_influence[t_idx, f_idx]
84
+ diff_score = contrast_matrix[t_idx, f_idx]
85
+
86
+ verdict = "🔥 High Load-Bearing for Social Reasoning" if diff_score > 0.4 else (
87
+ "⚡ High Load-Bearing for STEM Reasoning" if diff_score < -0.4 else "⚖️ Balanced Influence across domains"
88
+ )
89
+
90
+ details_md = fr"""
91
+ ### Bins Details: `{topic}` × `{format_type}`
92
+
93
+ - **SocialIQA Influence**: `{soc_score:+.4f}`
94
+ - **MMLU STEM Influence**: `{stem_score:+.4f}`
95
+ - **Contrastive Shift ($\Delta$)**: `{diff_score:+.4f}`
96
+ - **Provenance Diagnosis**: **{verdict}**
97
+
98
+ *Working set documents sampled in this bin: ~9,860 unique Dolma3 documents.*
99
+ """
100
+ return details_md
101
+
102
+
103
+ # Build Gradio Interface
104
+ theme = gr.themes.Soft(
105
+ primary_hue="indigo",
106
+ secondary_hue="blue",
107
+ neutral_hue="slate"
108
+ )
109
+
110
+ with gr.Blocks(theme=theme, title="Capabilibara — Capability Provenance in Language Models (COLM 2026)") as demo:
111
+ gr.Markdown(
112
+ """
113
+ # 🦫 Capabilibara: Capability Provenance in Language Models
114
+ ### *A Case Study in Social Reasoning* (COLM 2026)
115
+ **Hugging Face Space by [HCAI-Lab](https://huggingface.co/HCAI-Lab)** | [arXiv Paper](https://arxiv.org/abs/2606.19625) | [Project Website](https://eilab.gatech.edu/social-data-attribution/)
116
+
117
+ ---
118
+ This interactive Space explores training-data attribution across **576 corpus bins** in Dolma3 (24 Topics × 24 Formats taxonomy), validating model capability origins using gradient-based influence (TrackStar) and selective unlearning.
119
+ """
120
+ )
121
+
122
+ with gr.Tabs():
123
+ with gr.Tab("🗺️ 576-Bin Matrix Explorer"):
124
+ gr.Markdown("### WebOrganizer 24×24 Topic-by-Format Taxonomy Matrix")
125
+ with gr.Row():
126
+ metric_dropdown = gr.Dropdown(
127
+ choices=[
128
+ "Contrastive Provenance (Social reasoning vs STEM)",
129
+ "Social Reasoning Influence (SocialIQA)",
130
+ "STEM Reasoning Influence (MMLU STEM)"
131
+ ],
132
+ value="Contrastive Provenance (Social reasoning vs STEM)",
133
+ label="Select Benchmark Influence Metric"
134
+ )
135
+
136
+ heatmap_plot = gr.Plot(label="Corpus Influence Heatmap")
137
+ metric_dropdown.change(fn=create_heatmap, inputs=metric_dropdown, outputs=heatmap_plot)
138
+ demo.load(fn=create_heatmap, inputs=metric_dropdown, outputs=heatmap_plot)
139
+
140
+ gr.Markdown("---")
141
+ gr.Markdown("### Bin Inspector")
142
+ with gr.Row():
143
+ topic_select = gr.Dropdown(choices=TOPICS, value=TOPICS[0], label="Select Topic (Y-axis)")
144
+ format_select = gr.Dropdown(choices=FORMATS, value=FORMATS[0], label="Select Format (X-axis)")
145
+
146
+ bin_output = gr.Markdown()
147
+ topic_select.change(fn=get_bin_details, inputs=[topic_select, format_select], outputs=bin_output)
148
+ format_select.change(fn=get_bin_details, inputs=[topic_select, format_select], outputs=bin_output)
149
+ demo.load(fn=get_bin_details, inputs=[topic_select, format_select], outputs=bin_output)
150
+
151
+ with gr.Tab("📊 Results & Unlearning Validation"):
152
+ gr.Markdown(
153
+ """
154
+ ## Headline Study Scale & Key Results
155
+
156
+ | Metric | Value | Detail |
157
+ |---|---|---|
158
+ | **Corpus Bins** | `576` | WebOrganizer 24×24 topic-format matrix |
159
+ | **Working Set** | `5.68M` | Stratified unique Dolma3 documents |
160
+ | **Base Model** | `OLMo-3-7B` | AllenAI open base model |
161
+ | **Unlearning Shift** | `+1.60 pp` | SocialIQA damage on unlearning flagged bins ($p \\approx 10^{-5}$) |
162
+ | **Attribution Compute** | `~37K` | H200-equivalent GPU hours |
163
+
164
+ ### Key Findings
165
+ 1. **Social reasoning vs. STEM provenance diverge**: Social reasoning capabilities depend strongly on informal discussion, personal essays, and Q&A formats, whereas STEM capabilities concentrate in technical manuals and academic papers.
166
+ 2. **Unlearning validation**: Targeted unlearning on top-attributed bins significantly degrades target capabilities while leaving un-targeted capabilities intact.
167
+ """
168
+ )
169
+
170
+ with gr.Tab("📜 Citation"):
171
+ gr.Markdown(
172
+ """
173
+ ### Cite This Work
174
+
175
+ ```bibtex
176
+ @inproceedings{matlin2026capabilityprovenance,
177
+ title = {Capability Provenance in Language Models: A Case Study in Social Reasoning},
178
+ author = {Glenn Matlin and Chandreyi Chakraborty and Saehee Eom and Mika Okamoto and
179
+ Rayan Castilla and Louis Jaburi and Alvin Deng and Taywon Min and
180
+ Lucia Quirke and Stella Biderman and Mark Riedl},
181
+ booktitle = {Proceedings of the Conference on Language Modeling (COLM 2026)},
182
+ year = {2026},
183
+ eprint = {2606.19625},
184
+ archivePrefix = {arXiv},
185
+ primaryClass = {cs.CL},
186
+ url = {https://arxiv.org/abs/2606.19625}
187
+ }
188
+ ```
189
+ """
190
+ )
191
+
192
+ if __name__ == "__main__":
193
+ demo.launch()
requirements.txt ADDED
@@ -0,0 +1,5 @@
 
 
 
 
 
 
1
+ gradio>=4.44.0
2
+ pandas>=2.0.0
3
+ numpy>=1.24.0
4
+ plotly>=5.18.0
5
+ matplotlib>=3.7.0