Omarrran commited on
Commit
b5826d2
Β·
verified Β·
1 Parent(s): 160007b

Upload README.md

Browse files
Files changed (1) hide show
  1. README.md +192 -0
README.md ADDED
@@ -0,0 +1,192 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ language:
4
+ - en
5
+ pretty_name: "StackPulse-QA: Instruction-Tuning Q&A Pairs from Stack Overflow"
6
+ size_categories:
7
+ - 100K<n<1M
8
+ task_categories:
9
+ - question-answering
10
+ - text-generation
11
+ - text2text-generation
12
+ tags:
13
+ - stackoverflow
14
+ - instruction-tuning
15
+ - qa
16
+ - code
17
+ - fine-tuning
18
+ - alpaca-format
19
+ - llm-training
20
+ ---
21
+
22
+ # 🧩 StackPulse-QA: Instruction-Tuning Q&A Pairs from Stack Overflow
23
+
24
+ ## Dataset Summary
25
+
26
+ Instruction-tuning Q&A dataset built from [Omarrran/StackPulse_778K_QnA_Code_dataset](https://huggingface.co/datasets/Omarrran/StackPulse_778K_QnA_Code_dataset) by joining question IDs with **BigQuery `bigquery-public-data.stackoverflow.posts_answers`** on `accepted_answer_id`.
27
+
28
+ Each sample consists of:
29
+ - `input_text_instruct` β€” A question (title + body) prefixed with an instruction
30
+ - `output_text` β€” The **accepted answer** from Stack Overflow
31
+
32
+ Format mirrors the instruction-tuning dataset from DeepLearning.AI's *Finetuning Large Language Models* course, ready for fine-tuning PaLM, LLaMA, Mistral, Gemma, Phi, and similar models.
33
+
34
+ ---
35
+
36
+ ## πŸ“Š Processing Progress
37
+
38
+ - **Runs completed** : 4 / 6
39
+ - **Questions processed** : 400,000 / 554,196
40
+ - **Remaining** : 154,196
41
+
42
+ ---
43
+
44
+ ## πŸ“ Files in This Dataset
45
+
46
+ ### πŸ‹οΈ Training Files (80% split)
47
+ | File | Format | Description |
48
+ |------|--------|-------------|
49
+ | data/tune_data_stack_overflow_python_qa_run1-07:19:04:2026.jsonl | JSONL | Training split from 1 |
50
+ | data/tune_data_stack_overflow_python_qa_run2-07:19:04:2026.jsonl | JSONL | Training split from 2 |
51
+ | data/tune_data_stack_overflow_python_qa_run3-07:19:04:2026.jsonl | JSONL | Training split from 3 |
52
+ | data/tune_data_stack_overflow_python_qa_run4-07:19:04:2026.jsonl | JSONL | Training split from 4 |
53
+ | data/tune_data_stack_overflow_python_qa_run5-07:19:04:2026.jsonl | JSONL | Training split from 5 |
54
+
55
+ ### πŸ§ͺ Evaluation Files (20% split)
56
+ | File | Format | Description |
57
+ |------|--------|-------------|
58
+ | data/tune_eval_data_stack_overflow_python_qa_run1-07:19:04:2026.jsonl | JSONL | Eval split from run 1 |
59
+ | data/tune_eval_data_stack_overflow_python_qa_run2-07:19:04:2026.jsonl | JSONL | Eval split from run 2 |
60
+ | data/tune_eval_data_stack_overflow_python_qa_run3-07:19:04:2026.jsonl | JSONL | Eval split from run 3 |
61
+ | data/tune_eval_data_stack_overflow_python_qa_run4-07:19:04:2026.jsonl | JSONL | Eval split from run 4 |
62
+
63
+ ### πŸ“„ Full Metadata CSVs
64
+ | File | Format | Description |
65
+ |------|--------|-------------|
66
+ | data/stackpulse_qa_full_run1-07:19:04:2026.csv | CSV | Full metadata for run 1 |
67
+ | data/stackpulse_qa_full_run2-07:19:04:2026.csv | CSV | Full metadata for run 2 |
68
+ | data/stackpulse_qa_full_run3-07:19:04:2026.csv | CSV | Full metadata for run 3 |
69
+ | data/stackpulse_qa_full_run4-07:19:04:2026.csv | CSV | Full metadata for run 4 |
70
+
71
+ ---
72
+
73
+ ## πŸ—οΈ Schema
74
+
75
+ ### JSONL Files (training / eval)
76
+ Exactly 2 fields per row β€” ready for instruction fine-tuning:
77
+
78
+ | Field | Type | Description |
79
+ |-------|------|-------------|
80
+ | `input_text_instruct` | string | Instruction prefix + question title + question body |
81
+ | `output_text` | string | Accepted answer body (HTML format) |
82
+
83
+ ### CSV Files (full metadata)
84
+ | Column | Description |
85
+ |--------|-------------|
86
+ | question_id | Stack Overflow question ID |
87
+ | input_text | title + body (no instruction prefix) |
88
+ | output_text | accepted answer body |
89
+ | input_text_instruct | instruction-prefixed input (same as JSONL) |
90
+ | title | question title only |
91
+ | tags | pipe-separated tags |
92
+ | q_score | question upvote score |
93
+ | view_count | total views |
94
+ | answer_count | number of answers |
95
+ | accepted_answer_id | ID of the accepted answer |
96
+ | answer_id | ID of this answer (= accepted_answer_id) |
97
+ | a_score | answer upvote score |
98
+ | is_accepted | always True (we only keep accepted answers) |
99
+ | creation_date | question creation timestamp |
100
+
101
+ ---
102
+
103
+ ## πŸš€ Quick Start
104
+
105
+ ### Load with pandas
106
+ ```python
107
+ import pandas as pd
108
+
109
+ # Training data
110
+ train = pd.read_json("data/tune_data_stack_overflow_python_qa_run1-*.jsonl", lines=True)
111
+
112
+ # Eval data
113
+ eval_ = pd.read_json("data/tune_eval_data_stack_overflow_python_qa_run1-*.jsonl", lines=True)
114
+
115
+ print(train.iloc[0]["input_text_instruct"][:300])
116
+ print(train.iloc[0]["output_text"][:300])
117
+ ```
118
+
119
+ ### Load with HuggingFace `datasets`
120
+ ```python
121
+ from datasets import load_dataset
122
+
123
+ # Load all training shards
124
+ ds = load_dataset(
125
+ "json",
126
+ data_files={
127
+ "train": "data/tune_data_stack_overflow_python_qa_run*.jsonl",
128
+ "eval" : "data/tune_eval_data_stack_overflow_python_qa_run*.jsonl",
129
+ }
130
+ )
131
+ print(ds)
132
+ ```
133
+
134
+ ### Use for fine-tuning (Alpaca-style)
135
+ ```python
136
+ def format_prompt(ex):
137
+ return {
138
+ "text": f"{ex['input_text_instruct']}\n\n### Response:\n{ex['output_text']}"
139
+ }
140
+
141
+ train_formatted = ds["train"].map(format_prompt)
142
+ ```
143
+
144
+ ---
145
+
146
+ ## πŸ“‹ Instruction Template Used
147
+
148
+ Please answer the following Stackoverflow question on Programming. Answer it like you are a developer answering Stackoverflow questions.
149
+ Stackoverflow question:
150
+ {title}{body}
151
+
152
+ ---
153
+
154
+ ## ⚠️ Caveats
155
+
156
+ 1. **HTML in answers**: `output_text` contains raw HTML tags (`<p>`, `<pre>`, `<code>`). Strip or preserve depending on your use case.
157
+ 2. **Accepted answers only**: We filter `q.accepted_answer_id = a.id` β€” other community answers are skipped.
158
+ 3. **~60% match rate**: Of each 100K question IDs queried, ~60K have accepted answers in BigQuery. The rest are self-answered, deleted, or lack acceptance.
159
+ 4. **80/20 split**: Each run uses `random_state=42` for reproducible train/eval splits.
160
+ 5. **Mirrors L2_data.ipynb**: Format exactly matches DeepLearning.AI's *Finetuning Large Language Models* course notebook structure.
161
+
162
+ ---
163
+
164
+ ## πŸ” Source Dataset
165
+
166
+ Question IDs and metadata sourced from:
167
+ - [Omarrran/StackPulse_778K_QnA_Code_dataset](https://huggingface.co/datasets/Omarrran/StackPulse_778K_QnA_Code_dataset)
168
+
169
+ Answers joined from:
170
+ - `bigquery-public-data.stackoverflow.posts_answers` (Google BigQuery Public Dataset)
171
+
172
+ ---
173
+
174
+ ## πŸ“‹ Citation
175
+
176
+ ```bibtex
177
+ @dataset{malik2026stackpulseqa,
178
+ author = {Malik, Omar Haq Nawaz},
179
+ title = {StackPulse-QA: Instruction-Tuning Q&A Pairs from Stack Overflow},
180
+ year = {2026},
181
+ publisher = {HuggingFace},
182
+ url = {https://huggingface.co/datasets/Omarrran/stackpulse_qa_output},
183
+ license = {Apache-2.0}
184
+ }
185
+ ```
186
+
187
+ ---
188
+
189
+ ## πŸ‘€ Author
190
+
191
+ **Omar Haq Nawaz Malik** (HuggingFace: [Omarrran](https://huggingface.co/Omarrran))
192
+ AI Engineer & NLP Researcher | BITS Pilani | Srinagar, Kashmir