Skip to content

In development. Expect rough edges and changes. The source code is not public yet.

Hugging Face 18 min read Deep dive mediumAdept

Large-scale Near-deduplication Behind BigCode

BigCode deduplicates massive code and text corpora for LLM training with MinHash plus locality-sensitive hashing: word n-gram shingles, permuted-hash fingerprints, banding into LSH buckets, then clustering candidate pairs into connected components. Experiments on The Stack showed that treating all LSH candidate pairs as duplicates, without verifying exact Jaccard similarity, gave the best downstream model performance and saved time. For clustering, a union-find structure works for medium datasets. At larger scale the pipeline moves to Spark, using distributed groupBy and a connected-components algorithm, while keeping a Datasketch-compatible hashing implementation. Parameter tables compare deduplication setups across datasets such as C4, ROOTS, CodeParrot and The Stack.

Assumes: hashing basicsJaccard similaritygraph connected componentsLLM training data

Related posts

  • Training CodeParrot 🦜 from Scratch

    Hugging Face mediumAdept

    CodeParrot is a GPT-2 model (110M and 1.5B parameters) trained from scratch for Python code completion, using a 180 GB GitHub Python dump from BigQuery. Heavy duplication in that dump (10% of unique files made up 66% of all files) hurt model quality, so deduplication plus Codex-style filtering cut it to a 50 GB clean dataset. The guide walks through training a code-specific tokenizer, initializing a GPT-2-large config with attention stability flags, a streaming constant-length dataset, and a ~150-line distributed training loop with 🤗 Accelerate using gradient accumulation and checkpoints pushed to the Hub. Training ran on 16 A100s for 1 day (small) and 1 week (large) on about 25-30B tokens, and the models were evaluated on HumanEval with the pass@k metric.

  • tokenizers v1: encode, decode and scaling, measured

    Hugging Face mediumAdept

    tokenizers v1 encodes text 3 to 30 times faster than v0.23 single-threaded on an Apple M4 Max and scales at 76% of linear across eight cores, while producing identical token IDs and keeping the same API. The gains come from replacing regex pre-tokenization with SIMD bitstream operations (bitcannon) for common BPE patterns, a thread-local word cache for repeated pre-tokens, an allocation-free merge loop using an intrusive linked list in a scratch buffer with ranks packed into 64-bit integers, batched model calls, and per-thread sub-pools for parallel encoding. The benchmark methodology separates load time, verifies output by hashing IDs, pins to physical cores, and warns that 'warm' benchmarks on repeated versus distinct documents measure very different workloads.

  • StarCoder: A State-of-the-Art LLM for Code

    Hugging Face easyNovice

    StarCoder and StarCoderBase are ~15B-parameter code LLMs trained on 1 trillion tokens of permissively licensed GitHub data from The Stack 1.2, covering 80+ languages, commits, issues and notebooks, with StarCoder further fine-tuned on 35B Python tokens. With an 8K+ token context, they beat other open code models and match or exceed OpenAI's code-cushman-001 on HumanEval, MBPP, MultiPL-E and DS-1000. A solution-file prompt prefix lifts StarCoder's HumanEval score from 34% to 40.8%, and prompting alone turns the model into a technical assistant. The release includes weights under OpenRAIL-M, training code, an evaluation harness, a PII-redaction dataset and a code attribution tool.

  • Huggy Lingo: Using Machine Learning to Improve Language Metadata on the Hugging Face Hub

    Hugging Face mediumAdept

    Roughly 87% of the ~50K public datasets on the Hugging Face Hub lack language metadata, so Hugging Face samples 20 rows from likely text columns via the dataset viewer API and runs Meta's fastText language-identification model (217 languages) on each row. Per-dataset predictions are grouped by language, and a language is kept only if it appears in at least 20% of rows with a mean confidence of at least 80%. ISO 639-3 codes are converted to ISO 639-1 with the script dropped, and some codes are mapped by hand. Librarian-Bot then opens pull requests adding the language tags, which repo owners can merge to make datasets discoverable through the Hub's language filters.

  • Building LLMs for Code Repair

    Replit hardMaster

    Replit finetuned a 7B code model (DeepSeek-Coder-Instruct-v1.5) to repair Python errors flagged by LSP diagnostics. Only 10% of these diagnostics come with deterministic fixes, while hundreds of millions are logged daily. Training data comes from replaying Operational Transformation histories to reconstruct the project state at each diagnostic. LLM-synthesized numbered line diffs are then generated with DSPy, verified, and distilled. Sentinel-token schemas replace natural-language instructions, and training ran on 8xH100 with LLM Foundry, FSDP and 4 epochs. Evaluation uses a new Replit repair benchmark plus a contamination-resistant Leetcode set built from DebugBench and recent LiveCodeBench-style problems.

The quest for software engineering knowledge.

Look:
Layout: