File size: 3,801 Bytes
190b59d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
pretty_name: Repository learning training dataset
tags:
- code-review
- github-data
- contrastive-learning
- fine-tuning
- semantic-indexing
- multi-modal
- jsonl
- faiss-index
- tree-sitter
license: mit
language:
- en
size_categories:
- 10K<n<100K
task_categories:
- text-generation
- text-classification
- text-retrieval
- feature-extraction
source_datasets:
- github-repositories
annotations_creators:
- machine-generated
- expert-reviewed
---

# Repository Learning Training Dataset

This dataset contains training data extracted from GitHub repositories for training context-aware code review models. The dataset supports three primary machine learning tasks: contrastive learning, fine-tuning, and semantic indexing.

## Dataset Overview

**Purpose**: Enable training of AI models that understand repository-specific code review patterns and provide contextual feedback.

**Source**: GitHub repositories with rich pull request history and review comments.

## Dataset Structure

```
{repository-name}/
β”œβ”€β”€ contrastive/
β”‚   β”œβ”€β”€ changed_files_001.json      # Files changed together (positive pairs)
β”‚   β”œβ”€β”€ changed_files_002.json   
β”‚   └── ...
β”œβ”€β”€ fine_tune/
β”‚   β”œβ”€β”€ pr_reviews_001.jsonl        # Instruction-following format
β”‚   β”œβ”€β”€ pr_reviews_002.jsonl
β”‚   └── ...
β”œβ”€β”€ index/
β”‚   β”œβ”€β”€ functions.json              # AST-extracted function metadata
└── manifest.json                   # Processing metadata
```

## Data Components

### 1. Contrastive Learning Data (`/contrastive/`)

**Format**: JSON files containing file groupings for contrastive learning.

**Purpose**: Learn semantic relationships between code files based on change patterns.

**Structure**:
```json
{
  "pr_12345": [
    "src/components/Button.tsx",
    "src/styles/button.css", 
    "tests/Button.test.tsx"
  ],
  "pr_12346": [
    "src/api/user.py",
    "src/models/user.py",
    "tests/test_user.py"
  ]
}
```

**Usage**: Files changed together form positive pairs; files from different PRs form negative pairs for contrastive learning.

### 2. Fine-Tuning Data (`/fine_tune/`)

**Format**: JSONL files with instruction-following examples.

**Purpose**: Adapt language models to repository-specific review patterns and conventions.

**Structure**:
```json
{
  "prompt": "Code diff:\n```diff\n+def calculate_score(user_data):\n+    return sum(user_data.values())\n```\nPrevious comments:\n- alice: Consider input validation\n\nPlease write a code review comment:",
  "completion": "Good addition! I'd suggest adding type hints and handling edge cases where user_data might be empty or contain non-numeric values."
}
```

**Features**:
- Chronological conversation context
- Multi-turn review discussions
- Repository-specific terminology and patterns
- Code diff context with surrounding discussion

### 3. Semantic Index Data (`/index/`)

**Format**: JSON metadata with function definitions and embeddings.

**Purpose**: Enable fast semantic search across repository functions and documentation.

**Structure** (`functions.json`):
```json
[
  {
    "file": "src/utils/parser.py",
    "name": "parse_diff_hunk", 
    "start_line": 45,
    "end_line": 67,
    "code": "def parse_diff_hunk(hunk_text: str) -> DiffHunk:\n    # Function implementation...",
  }
]
```

**Components**:
- **AST Extraction**: Tree-sitter parsers for different programming languages

## Data Generation Pipeline

### Data Statistics

| Repository | PRs | Review Comments | Functions | Languages |
|------------|-----|-----------------|-----------|-----------|
| dotnet/xharness | 100 | 50 | 1500 | C# |
| dotnet/runtime | N/A | N/A | N/A | C#, c, c++ |

## Usage Examples

If you use this dataset, please refer to https://github.com/kotlarmilos/repository-learning