# KStack

- **ID:** 280
- **Kind:** dataset
- **URL:** https://huggingface.co/datasets/JetBrains/KStack
- **Authors:** JetBrains (Mikhail Evtikhiev, Sergey Titov, Anton Shapkin, Oleg Smirnov, Sergey Boytsov, Dariia Karaeva, et al.)
- **Venue:** JetBrains (HuggingFace)
- **Published:** 2024
- **Source:** huggingface
- **Language:** Kotlin, Java, English
- **Access:** free
- **License:** other (permissively licensed Kotlin code, varies per file; Apache 2.0 common)
- **License family:** Other (auto-classified)
- **Topics:** Code
- **Added:** 2026-07-17
- **Verified:** 2026-07-17
- **Research status:** done
- **Page:** https://papers.projxon.ai/entries/280

## Summary

KStack is the largest collection of permissively licensed Kotlin source code, containing 5.52 million files scraped from GitHub repositories with metadata like owner, repo ID, language distribution, license, and commit SHA. It is part of JetBrains' Kotlin ML Pack (alongside the curated KStack-clean and KExercises datasets) and is intended for pretraining and fine-tuning code generation models for Kotlin, demonstrating that even small high-quality subsets can yield up to a 16-point increase in HumanEval pass rate.

## Attributes

- **Purpose:** Providing the largest permissively licensed Kotlin code corpus for pretraining and fine-tuning code generation models
- **Scale:** 5.52M rows, 1M-10M size category
- **Used for:** Fine-tuning CodeLlama and DeepSeek models for Kotlin code generation (Kotlin ML Pack)
- **Time period:** 2022-2024
- **Author type:** human

## From the source (fetched 2026-10-03)

- **Repository:** JetBrains/KStack (Hugging Face)
- **Created:** May 13, 2024 (Hugging Face)
- **Last updated:** Apr 22, 2025 (Hugging Face)
- **Downloads (last month):** 1,686 (Hugging Face)
- **Likes:** 14 (Hugging Face)
- **Size:** 1M to 10M rows (Hugging Face)
- **Modalities:** text (Hugging Face)
- **Tasks:** text-generation (Hugging Face)
- **Formats:** parquet (Hugging Face)

## Dataset profile

- **Scale:** Card comparison table: 4M files / 168,902 repos / 292M lines / 3.1B tokens vs Stack v2 Kotlin 2M / 109,457 / 162M / 1.7B. dataset_info train: 5,517,601 examples; 16,332,255,331 bytes (~16.33 GB) uncompressed / download_size 5,891,399,337 (~5.89 GB parquet). usedStorage 14,463,919,198 bytes (~14.46 GB). 33 parquet shards (~176–182 MB). YAML size_categories 100M<n<1B conflicts with Hub tags 1M<n<10M and the 5.52M-row split — tags/split used here. gated=false. HF 326 downloads / 14 likes at check.
- **Format:** parquet (33 shards). Fields: path, owner, repo_id, is_fork, languages_distribution, content, issues, main_language, forks, stars, commit_sha, size, name, license.
- **Type:** Pretraining corpus / permissively licensed Kotlin files
- **License:** other (card): mix of per-file permissive licenses in licenses.json (MIT, Apache-2.0, BSD-2/3-Clause, Unlicense, CC0-1.0, CC-BY-4.0, …). Not a single dataset license. Upstream GitHub terms still apply.
- **Cost:** Free
- **Languages:** Kotlin source (card language:code). Files .kt / .kts / .gradle.kts via go-enry. Comments mixed-language; repos may list other languages in languages_distribution. Not natural-language English text.
- **Modality:** Text (Kotlin source)
- **Domain:** Kotlin source-code pretraining; permissively licensed GitHub
- **Time period:** GitHub Kotlin snapshot as of February 2024 plus The Stack v1.2 Kotlin files. HF createdAt 2024-05-13; lastModified 2025-04-22. Paper Kotlin ML Pack arXiv 2405.19250 (2024-05-29). Discord posted 2026-03-23.
- **Purpose:** Largest public permissively licensed Kotlin file collection for code LM pretrain/finetune, denser than The Stack v2 Kotlin slice
- **Used for:** Kotlin ML Pack (arXiv 2405.19250): CodeLlama/DeepSeek Kotlin finetunes; KStack-clean (25k) and KExercises are the high-quality/synth siblings (paper: up to +16 HumanEval-Kotlin pass). Hub 326 downloads / 14 likes at check. JetBrains Kotlin ML collection.
- **Authors:** GitHub Kotlin repo owners (main-language Kotlin, or any Kotlin file with ≥10 stars as of Feb 2024, plus Stack v1.2). JetBrains Research (Sergey Titov, Mikhail Evtikhiev, Anton Shapkin et al.). PII stripped with star-pii.
- **Bias:** Open GitHub only (paper: private Kotlin unseen). Permissive-license filter (MIT/Apache-2.0/BSD/CC-BY/Unlicense/…; full list licenses.json). Star≥10 auxiliary crawl plus main-language-Kotlin repos; popularity skew. Near-dedup keeps the highest-star file per cluster. Forks flagged via is_fork. YAML pretty_name is wrongly KExercises (copy-paste); this repo is the large file dump, not the 25k clean set.
- **Text quality:** Exact hash dedup + Stack v1.2-style near-dedup; star-pii PII rewrite. Permissive-license detector (GitHub then go-license-detector). Residual noisy/generated Kotlin, build scripts (.kts/.gradle.kts), and incomplete files remain. Paper treats KStack as the broad corpus and KStack-clean as the algorithmic-quality subset.
- **Sample size:** Single train split (5,517,601 rows / 33 parquet parts). No val/test. Sister JetBrains/KStack-clean is 25,000 rows (~23M CodeLlama-7B tokens), not a config here.
- **Long context:** Mixed (per-file; mean ~3.0 KB / file from dataset_size/n). Not repo-level packing.
- **Intermediate steps:** Yes (GitHub + Stack v1.2 Kotlin harvest → exact/near dedup → permissive license filter → star-pii). Paper also builds KStack-clean (Mistral pairwise edu rank → CodeT5p classifier) and KExercises; those are separate repos.
- **Idea quality:** High
- **Novelty:** High (public Kotlin dump ~2× Stack v2 Kotlin files/tokens, fully permissive)
- **Text conversion:** Ready parquet. load_dataset('JetBrains/KStack'). Full dump is small vs web corpora (~5.9 GB download).
- **Collection method:** Download
- **Static:** Unknown (HF lastModified 2025-04-22; Feb 2024 GitHub snapshot)
- **Processed:** Unknown

## Links

- Dataset: https://huggingface.co/datasets/JetBrains/KStack
- Related: https://arxiv.org/abs/2405.19250
- Related: https://huggingface.co/datasets/JetBrains/KStack
- Related: https://huggingface.co/datasets/JetBrains/KStack-clean
- Related: https://huggingface.co/datasets/JetBrains/KStack/blob/main/licenses.json
- Related: https://arxiv.org/abs/2211.15533
- Related: https://arxiv.org/abs/2402.19173

## Research notes

- Part of JetBrains' Kotlin ML Pack. Associated papers: arXiv:2211.15533 (2022) and arXiv:2402.19173 / arXiv:2405.19250 (Kotlin ML Pack Technical Report, 2024). KStack-clean is a filtered 25k-example subset for higher-quality training.
- Discord posted the HF pointer. Cite Titov et al. 2024 Kotlin ML Pack arXiv 2405.19250. gated=false; public. Substituted as the code-pretrain pick vs gated bigcode/the-stack and the-stack-v2 (CuratorBote still no access 2026-08-14). Card YAML pretty_name/size_categories look copied from KExercises — use dataset_info + Hub tags. Not in papers_local.csv. Not on the Aug 13 live Datasets sheet export.

## Similar entries

- [UltraData-Code (OpenBMB L0–L3 tiered code pretrain: L2 algorithmic + L3 synthesis)](https://papers.projxon.ai/entries/1035) (dataset, #1035)
- [BigO(Bench): Can LLMs Generate Code with Controlled Time and Space Complexity?](https://papers.projxon.ai/entries/777) (paper, #777)
- [Cross-Benchmark Transfer from RL on Agentic Coding Tasks](https://papers.projxon.ai/entries/1245) (paper, #1245)
- [CodeGenLink: A Tool to Find the Likely Origin and License of Automatically Generated Code](https://papers.projxon.ai/entries/966) (paper, #966)
- [Regression Language Models for Code](https://papers.projxon.ai/entries/943) (paper, #943)
- [RLEF: Grounding Code LLMs in Execution Feedback with Reinforcement Learning](https://papers.projxon.ai/entries/923) (paper, #923)
