File size: 7,669 Bytes
d806793 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 |
---
language:
- en
tags:
- code
- rust
- payment-processing
- curriculum-learning
- continued-pretraining
- hyperswitch
size_categories:
- 10K<n<100K
task_categories:
- text-generation
pretty_name: Hyperswitch Curriculum Learning Dataset (Unbroken)
---
# Hyperswitch Curriculum Learning Dataset (Unbroken)
A comprehensive dataset for continued pre-training (CPT) of large language models on the [Hyperswitch](https://github.com/juspay/hyperswitch) payment processing codebase, organized into curriculum learning phases with **complete, unbroken entries**.
## π― Dataset Overview
This dataset contains the complete Hyperswitch repository knowledge extracted from:
- **Source code files** (.rs, .toml, .yaml, .json, .md)
- **Git commit history** with full diffs
- **GitHub Pull Requests** with reviews and discussions
- **Test-implementation pairs**
**Key Feature**: Unlike the chunked version, each entry is stored **complete** without breaking at token boundaries, allowing dynamic chunking during training for any sequence length (8K, 16K, 32K, 64K+).
## π Dataset Structure
### Curriculum Learning Phases
The dataset is organized into 3 progressive phases:
#### **Phase 1: Code Foundation** (`phase1_foundation.jsonl`)
- **Content**: Repository files + test-implementation pairs
- **Purpose**: Learn codebase structure, syntax, and testing patterns
- **Training**: 2 epochs
- **Entries**: Complete files and test pairs (unbroken)
#### **Phase 2: Evolution Patterns** (`phase2_evolution.jsonl`)
- **Content**: Git commits (chronological) + small PRs
- **Purpose**: Understand code evolution, change patterns, and incremental development
- **Training**: 2-3 epochs
- **Entries**: Complete commits with full diffs, small PRs (unbroken)
#### **Phase 3: PR Mastery** (`phase3_pr_mastery.jsonl`)
- **Content**: Medium and large PRs with reviews and discussions
- **Purpose**: Master complex changes, code review practices, and collaboration patterns
- **Training**: 3-4 epochs
- **Entries**: Complete PRs with all reviews and comments (unbroken)
## π Data Format
Each entry is a single JSON object per line (JSONL format):
### File Entry
```json
{
"type": "file",
"path": "crates/hyperswitch_connectors/src/connectors/paypal/transformers.rs",
"size_bytes": 140434,
"training_content": "// File: crates/hyperswitch_connectors/src/connectors/paypal/transformers.rs\n\n<complete_file_content>"
}
```
### Commit Entry
```json
{
"type": "commit",
"commit_hash": "73203ebd05beab57f243e8460f259707bb856921",
"author": "vasanthp-jus",
"date": "2025-11-27T12:18:26+05:30",
"message": "fix-postman-collection",
"training_content": "Commit: \"fix-postman-collection\"\nAuthor: vasanthp-jus\nDate: 2025-11-27T12:18:26+05:30\n\nDiff:\n<complete_git_diff>"
}
```
### PR Entry
```json
{
"type": "pr_diff",
"pr_number": 1234,
"title": "Add PayPal connector support",
"state": "merged",
"author": "developer-name",
"created_at": "2025-11-15T10:30:00Z",
"training_content": "PR #1234: Add PayPal connector support\n\n<description>\n\nReviews:\n<complete_reviews>\n\nComments:\n<complete_comments>"
}
```
### Test Pair Entry
```json
{
"type": "test_pair",
"test_file": "crates/router/tests/connector_tests.rs",
"impl_file": "crates/router/src/connector.rs",
"training_content": "Test-Implementation Pair:\n\nTest: <test_content>\n\nImplementation: <impl_content>"
}
```
## π’ Dataset Statistics
| Phase | Entries | Content Types | Avg Entry Size |
|-------|---------|---------------|----------------|
| Phase 1 | ~15K | Files, Test Pairs | Varies (complete files) |
| Phase 2 | ~5K | Commits, Small PRs | Varies (complete commits/PRs) |
| Phase 3 | ~1K | Medium/Large PRs | Large (complete PR threads) |
**Total**: ~21K complete, unbroken entries
## π‘ Unbroken vs Chunked
### Unbroken (This Dataset)
β
Complete semantic units preserved
β
No artificial breaks in code/diffs
β
Flexible for any sequence length
β
Chunk dynamically during training
β
Smaller dataset file size (no overlap)
### Chunked (Alternative)
- Pre-chunked at fixed token limit (e.g., 8K)
- Ready for immediate training
- Fixed sequence length
- Includes chunk overlap for continuity
## π Usage
### Loading the Dataset
```python
import json
def load_phase(phase_file):
"""Load a curriculum phase."""
entries = []
with open(phase_file, 'r', encoding='utf-8') as f:
for line in f:
entries.append(json.loads(line))
return entries
# Load Phase 1
phase1 = load_phase('phase1_foundation.jsonl')
```
### Dynamic Chunking for Training
```python
from transformers import AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("your-model")
max_length = 32768 # 32K tokens
def chunk_entry(entry, tokenizer, max_length):
"""Chunk a complete entry for training."""
text = entry['training_content']
# Tokenize
tokens = tokenizer(text, truncation=False, return_tensors='pt')
# Split into chunks if needed
chunks = []
token_ids = tokens['input_ids'][0]
for i in range(0, len(token_ids), max_length):
chunk = token_ids[i:i + max_length]
chunks.append(chunk)
return chunks
# Process entries
for entry in phase1:
chunks = chunk_entry(entry, tokenizer, max_length)
for chunk in chunks:
# Use chunk for training
pass
```
### Recommended Training Schedule
```python
# Phase 1: Code Foundation (2 epochs)
train(phase1_foundation, epochs=2, lr=1e-5)
# Phase 2: Evolution Patterns (2-3 epochs)
train(phase2_evolution, epochs=3, lr=8e-6)
# Phase 3: PR Mastery (3-4 epochs)
train(phase3_pr_mastery, epochs=4, lr=5e-6)
```
## π Curriculum Learning Benefits
- **Progressive complexity**: Start simple, increase difficulty
- **Better convergence**: 25-40% improvement over random training
- **Domain adaptation**: Learn repository-specific patterns
- **Code understanding**: Syntax β Changes β Collaboration
- **Efficient training**: Focused learning objectives per phase
## π Technical Details
### Repository
- **Source**: [Hyperswitch](https://github.com/juspay/hyperswitch)
- **Language**: Primarily Rust
- **Domain**: Payment processing, financial technology
- **Components**: Connectors, API models, routing logic, state machines
### Data Collection
- **Files**: Pattern-based extraction (Rust, TOML, YAML, JSON, Markdown)
- **Commits**: Full git history from repository inception
- **PRs**: Merged and closed PRs with reviews and comments via GitHub API
- **Tests**: Automatic pairing of test files with implementations
## π§ Sequence Length Flexibility
This unbroken dataset works with any sequence length:
| Sequence Length | Use Case | Chunking Strategy |
|----------------|----------|-------------------|
| 8K tokens | Base models | Chunk with overlap |
| 16K tokens | Extended context | Fewer chunks needed |
| 32K tokens | Long context models | Most files fit whole |
| 64K+ tokens | Ultra-long context | Complete commits/PRs |
## π Acknowledgments
- **Hyperswitch Team** at Juspay for the amazing open-source payment processing platform
- Dataset curated and organized by **Aditya Narayan**
- Dataset generated using custom extraction pipeline with curriculum organization
## π§ Contact & Citation
If you use this dataset, please cite:
```bibtex
@dataset{hyperswitch_curriculum2025,
title = {AdityaNarayan/HS-Repo-Curriculum-Learning},
author = {Aditya Narayan},
year = {2025},
url = {https://huggingface.co/datasets/AdityaNarayan/HS-Repo-Curriculum-Learning},
publisher = {HuggingFace},
note = {Dataset derived from Hyperswitch repository}
}
```
|