Archangel-system's picture
fix: data licence is CC BY-NC 4.0 (upstream DATA_LICENSE), not CC BY 4.0
b5b6800 verified
|
Raw History Blame Contribute Delete
7.1 kB
metadata
license: cc-by-nc-4.0
language:
  - en
task_categories:
  - text-generation
tags:
  - code
  - non-commercial
  - sft
  - chatml
pretty_name: CodeAlpaca OpenAI Native
size_categories:
  - 10K<n<100K
configs:
  - config_name: default
    data_files:
      - split: train
        path: data/train.parquet
      - split: test
        path: data/test.parquet

CodeAlpaca OpenAI Native

This is a deterministic, lossless-formatting derivative of sahil2801/CodeAlpaca-20k, modernized with a typed OpenAI/TRL messages column and decontaminated against the HumanEval and MBPP test sets. The original Alpaca columns remain available for backward compatibility.

Intended use

from datasets import load_dataset
from trl import SFTTrainer

dataset = load_dataset("Archangel-system/codealpaca-openai-native")
trainer = SFTTrainer(model="your-model", train_dataset=dataset["train"])

No row-level JSON parsing or prompt concatenation is required. Choose a model whose tokenizer has an appropriate chat template.

Schema and conversion rule

Each row has:

  • messages: a typed list of two records, strictly user then assistant;
  • instruction, input, and output: the unchanged source strings.

The user message equals instruction when input.strip() is empty. Otherwise it equals instruction + "\n\n" + input (exactly two newline characters). The assistant message equals output. No answer was rewritten or generated.

Source audit

The build downloaded the source's Hub auto-converted Parquet shard directly.

Measurement Count
Source rows 20022
Non-empty input rows 10258
Empty output rows 6
Exact duplicate instruction rows 0
Aggressively normalized duplicate instruction rows 0
Exact output == instruction rows 0
Normalized output == instruction rows 0

Decontamination

Two criteria are applied to CodeAlpaca instruction strings against benchmark test prompts. The benchmark sets are never modified.

  1. Exact normalized equality: re.sub(r"[^a-z0-9]+", "", s.lower()).
  2. Shared 13-gram after lowercasing and tokenizing with [a-z0-9]+.
Benchmark Test items Exact-normalized source rows 13-gram source rows
HumanEval 164 0 0
MBPP (full, test, field text) 500 1 2

Any source row matching either criterion was removed before splitting. Complete row-to-benchmark evidence is in rejections.jsonl. A row touching multiple items or criteria is rejected once but retains every hit in that log.

Filtering, deduplication, and split

Stage / reason Rows removed
Empty output 6
Benchmark contamination (union) 2
Duplicate normalized (instruction, input) 0
Train/test signature purge from train 0
Total removed 8
Rejection rate 0.0400%

Rows are deduplicated on the tuple (normalize_text(instruction), normalize_text(input)), where normalize_text is the same exact-normalization function used by verification. The first source occurrence is retained.

The remaining rows are shuffled with Python's random.Random(42). The test size is min(1000, round(0.05 * n)); test receives the first shuffled indices. Any normalized pair crossing train/test would be purged from train, never test. The measured post-build intersection is 0.

Split Rows
train 19014
test 1000
total 20014

Lengths and diversity

Lengths below are lexical token counts using [a-z0-9]+.

Field Min Median Mean P95 Max
User message 4 16.0 17.5716 31.0 110
Assistant message 0 20.0 28.4568 82.0 633

The final dataset contains 20014 exactly unique instructions and 20014 unique aggressively normalized (instruction, input) pairs. It preserves 10252 rows with non-empty inputs. No semantic-quality filter, language classifier, code execution, or model-based judgment was applied; this release intentionally does not rewrite source data.

Reproducibility and files

  • Seed: 42.
  • Build script: build.py.
  • Independent Hub verification script: verify.py.
  • Machine-readable measurements: stats.json.
  • Rejection evidence: rejections.jsonl.
  • Validation report: validation_report.json.
  • Source revision: sahil2801/CodeAlpaca-20k@152bb5e9a29651266b018106053980070a0521a1.
  • HumanEval revision: openai/openai_humaneval@7dce6050a7d6d172f3cc5c32aa97f52fa1a2e544.
  • MBPP revision: google-research-datasets/mbpp@4bb6404fdc6cacfda99d4ac4205087b89d32030c.
File SHA-256
Source Parquet as downloaded 5a2fa0c510d42843292c583f357086abb59f95796e0f55727b97e449aa93bed9
data/train.parquet c00b9902c25983f60ebadb0a08905f42d44c5954ca0c8d5b4e0044e527adac5e
data/test.parquet 1200ef59fdc5854a2c571857c3695488754a783b6e17d778e392f05f60455864
rejections.jsonl bf88205147fb3074152c43849408aa9476f44441d8f91b99d213980b7d0c3ac7

Run python build.py to rebuild locally or python build.py --publish to rebuild and upload. Publication reads HF_TOKEN from the environment or from the profile .env; the token is never written to an artifact.

License and attribution

This dataset is CC BY-NC 4.0 — non-commercial use only.

The upstream repository sahil280114/codealpaca ships two separate licence files, and they do not say the same thing:

File Covers Licence
LICENSE the training/generation code Apache-2.0
DATA_LICENSE data/code_alpaca_20k.json, i.e. the data used here CC BY-NC 4.0

The Hugging Face mirror sahil2801/CodeAlpaca-20k is tagged cc-by-4.0, which drops the NonCommercial clause present in the upstream DATA_LICENSE. We verified both files directly rather than trusting the mirror's tag, and this derivative follows the stricter upstream data licence: CC BY-NC 4.0.

Practical consequence: you may use, modify and redistribute this dataset for non-commercial purposes with attribution. Training a model on it for a commercial product is not covered. If you need a commercially usable code-instruction set, this is not the right dataset.

Attribution:

  • Data: Sahil Chaudhary, Code Alpaca, sahil280114/codealpaca, DATA_LICENSE (CC BY-NC 4.0).
  • Outputs were generated with OpenAI text-davinci-003; OpenAI's terms of use apply to the generated content independently of this licence.

Limitations

The original outputs were generated with text-davinci-003; this release does not independently validate their correctness, security, language, or executability. Decontamination is limited to exact normalized equality and lexical 13-gram overlap against the pinned HumanEval and MBPP test prompts; it does not prove absence of semantic paraphrases. The test split measures this source distribution and is not a replacement for external code benchmarks.