# Grok Synthetic Generation Prompt For 400GB Dataset Target Give this document to each interactive Grok session when more synthetic data is needed. Grok should generate only staging JSONL. Final dedup, balancing, checkpointing, Hugging Face upload, and Google Drive backup are handled outside Grok. ## Mission Generate high-quality, non-duplicated synthetic code training records for the FABLE 5 code completion and FIM dataset. Output JSONL only. The target system will combine this synthetic stream with public real-code sources into twenty balanced 20GB single-JSONL checkpoints, for 400GB total mirrored to Hugging Face and Google Drive. ## Absolute Safety Rules - Do not load the whole corpus into memory. - Do not scan all existing dataset files. - Do not build an in-memory global set of hashes. - Write small JSONL files incrementally. - Keep one process below 1.2GiB RSS; stop immediately above 1.5GiB RSS. - Stop if disk free space drops below 95GiB. - Never write into `dataset/`; only write staging output. - Never delete source datasets. - Never create binary, parquet, sqlite, zip, tar, or cache files unless explicitly requested. ## Output Directory Write generated files under: ```text data/grok_outbox/.inprogress/ ``` When a run is complete and all files are flushed, rename the folder to: ```text data/grok_outbox/.final/ ``` Use file names: ```text w-part-.jsonl ``` Each file should be about 512MiB to 1GiB. Smaller files are acceptable. Do not create one huge file. ## JSONL Schema Each line must be one UTF-8 JSON object: ```json {"text":"...","domain":"code_fim","difficulty":"medium","meta":{"lang":"python","source":"grok","mode":"psm","synthetic_kind":"api_usage"}} ``` Required fields: - `text`: non-empty training string. - `domain`: `code_fim` or `code_gen`. - `difficulty`: `easy`, `medium`, or `hard`. - `meta.lang`: one of the target languages. - `meta.source`: always `grok`. - `meta.synthetic_kind`: one of the categories below. FIM records must use one of: ```text <|fim_prefix|>{prefix}<|fim_suffix|>{suffix}<|fim_middle|>{middle} <|fim_suffix|>{suffix}<|fim_prefix|>{prefix}<|fim_middle|>{middle} ``` Do not include markdown fences inside `text` unless the training record is intentionally a markdown/documentation example. ## Target Mix For Synthetic Output Across each Grok run, approximate this mix: | Category | Share | | --- | ---: | | Realistic repository FIM | 35% | | API/library usage FIM | 20% | | Bug fix / refactor FIM | 15% | | Tests and edge cases | 10% | | Algorithmic code generation | 8% | | Systems/concurrency/performance | 7% | | Documentation/comment aware completion | 5% | Language mix: | Language | Share | | --- | ---: | | Python | 24% | | TypeScript/JavaScript | 22% | | Java | 14% | | Rust | 12% | | C/C++ | 12% | | Go | 8% | | Kotlin/Swift/C# mixed | 8% | Difficulty mix: | Difficulty | Share | | --- | ---: | | easy | 20% | | medium | 50% | | hard | 30% | FIM mode mix: | Mode | Share | | --- | ---: | | psm | 70% | | spm | 20% | | gen | 10% | ## Quality Bar Generate useful code that looks like it came from real projects: - Complete functions, classes, modules, tests, configs, and migrations. - Realistic imports and dependency boundaries. - Meaningful variable names and project structure. - Edge cases, error handling, logging, type hints, and validation. - Korean and English comments are allowed, but code should remain idiomatic. - Include tests for tricky logic where appropriate. - Prefer medium-length examples. Avoid tiny toy snippets as bulk data. Reject or avoid: - Near-duplicate templates with only renamed variables. - Repeated boilerplate. - Fake secrets, API keys, private keys, passwords, tokens, or credentials. - Copyrighted source copied from real projects. - Broken syntax unless the record is explicitly a bug-fix example and the completion repairs it. - Long natural-language explanations replacing code. ## Dedup Discipline Inside Grok Within a single Grok run, keep a small bounded rolling hash set only for recent outputs to avoid immediate repeats. Do not attempt global dedup across all datasets. The external pipeline handles global out-of-core dedup. For each generated record, vary at least three of: - language - library/API family - problem shape - repository path - data structure - error handling - tests - FIM split location - naming style ## Record Examples Good `meta.synthetic_kind` values: - `repository_fim` - `api_usage` - `bugfix_refactor` - `unit_tests` - `algorithmic` - `systems_concurrency` - `performance` - `docs_comments` - `config_infra` - `data_processing` Example shape: ```json {"text":"<|fim_prefix|>def normalize_path(raw: str) -> str:\n cleaned = raw.strip()\n<|fim_suffix|>\n return cleaned\n<|fim_middle|> if not cleaned:\n raise ValueError(\"path is empty\")\n","domain":"code_fim","difficulty":"easy","meta":{"lang":"python","source":"grok","mode":"psm","synthetic_kind":"bugfix_refactor","path":"src/pathing/normalize.py"}} ``` ## Run Completion Report At the end of a run, write: ```text data/grok_outbox/.final/RUN_REPORT.md ``` Include: - total files - total bytes - approximate records - category counts - language counts - difficulty counts - max observed RSS - disk free at start and end - any files intentionally skipped or stopped early The report is metadata only. Do not put dataset records in the report.