--- license: cc-by-4.0 language: - en pretty_name: Udgam Logic Puzzles size_categories: - 10K **knights_knaves** · On an island, knights always tell the truth and knaves always lie. Juan says: "Prakash is a knight." Carlos says: "Lakshmi and I are different kinds." Lakshmi says: "Carlos and I are the same kind." Prakash says: "Juan and I are different kinds." Who are the knights? Answer with their names in alphabetical order, comma-separated, or 'none'. > Answer: `Carlos` > **water_jugs** · You have an empty 5-litre jug and an empty 8-litre jug, and a tap. In one step you can fill a jug completely, empty a jug completely, or pour from one jug into the other until the first is empty or the second is full. What is the smallest number of steps needed to have exactly 1 litres in one of the jugs? Answer with the number only. > Answer: `8` > **task_schedule** · A project has these tasks: task A takes 3 hours; task B takes 5 hours; task C takes 6 hours; task D takes 1 hours and can start only after A is finished; task E takes 5 hours. Any number of tasks can run at the same time. What is the shortest time, in hours, to finish the whole project? Answer with the number only. > Answer: `6` ## What we checked - **Every answer, twice.** The generator computes each answer while it builds the puzzle. A second program, `verify.py`, written separately and not importing the generator, parses only the question text and solves it again, often with a different method (Floyd-Warshall instead of Dijkstra, listing every grid path instead of dynamic programming, algebra instead of search for ages, counting every number instead of combining digits). It agrees with the published answer on **92,507 of 92,507** puzzles. Run `python verify.py data/train.parquet data/test.parquet` to repeat this. To test the checker itself, we changed every answer in a 5,087-puzzle sample; it rejected all 5,087. - **One answer per puzzle.** For the families where a second solution could exist (knights and knaves, height orders, zebra houses, cryptarithms, ages), both programs search all possibilities and keep a puzzle only if exactly one solution fits. For number sequences, the checker tries six kinds of rule (constant difference, constant second difference, sum of the previous two, multiply-and-add, constant ratio, two interleaved sequences); on every puzzle, all rules that fit the shown terms predict the same next number. - **Exact match works.** All answers are short canonical strings: integers (70,403), lists of names (10,437), single names (6,100), weekdays (3,084), the word `none` (1,763), decimal or whole numbers (clock angles) (720). The longest answer is 47 characters. - **No duplicates, no leaks between splits.** Each question text appears once in the whole dataset; no test question appears in train. - **Overlap with public benchmarks.** We compared every question with BIG-Bench Hard (all 27 tasks), the Knights and Knaves benchmark and ZebraLogic, which use similar puzzle types. No question matches a benchmark item, and none shares a run of 13 words with one (the standard contamination test). The only shared 8-word runs are stock phrases such as "knights always tell the truth and knaves always lie" and "numbered 1 to 4 from left to right". - **Secret scan.** Every file and every text cell was scanned for credentials, keys and email addresses: none found. ## Where it falls short - **Templates, not free text.** Each family uses one fixed wording. Variety comes from the numbers, names and structure, not the phrasing, so a model can learn the template rather than the skill. Paraphrase the questions if you need robustness to wording. - **Some families are small.** At these settings there are only 287 distinct water-jug puzzles (100 test, 187 train) and about 720 clock-angle puzzles; number sequences repeat often for some rule kinds. A model can memorise these families; read their test scores with that in mind. - **Modest and unlabelled difficulty.** Puzzles are small (3 to 6 people, grids up to 6 by 6, up to 8 tasks, boards up to 8 by 8). They separate small models but are easy for large ones, and there is no difficulty label. Raise the ranges in the generator for harder puzzles. - **Answers only, no worked solutions.** There is no step-by-step reasoning. For supervised fine-tuning you need to write or sample solutions yourself and keep the ones whose final answer matches. - **Sequences assume a simple rule.** "Next number" puzzles follow one of six simple rules, and our checker found no puzzle where two of those rules disagree. Some other rule could still fit the shown terms. - **Exact match is strict.** `is_correct` forgives case, spacing, quotes, a final full stop and number formatting, but not other wording ("Lars and Ana" is marked wrong). Ask for the answer in the stated form. - **Look-alike benchmarks.** Public benchmarks such as BIG-Bench Hard (date understanding, logical deduction, web of lies), Knights and Knaves and ZebraLogic test similar skills. Training on this data can raise scores there without an equal gain in general reasoning; say so when you report such scores. - **English only.** Names come from a list of 197 first names from many cultures. ## How it was made `logic_puzzles.py` holds one function per family. Each draws random parameters, builds the puzzle text from a template, computes the answer by exhaustive search, breadth-first search, dynamic programming or exact arithmetic, and discards draws that do not give a well-posed puzzle (for example, clues that allow two orders). Each family has its own random stream, seeded by a string and the family name, so the same seed always gives the same puzzles on any machine. `make_release.py` rebuilds these exact files: the test split first (100 per family, seed `udgam-logic-puzzles-v1/test`), then the train split (up to 6,000 per family, seed `udgam-logic-puzzles-v1/train`), skipping any question already used. A family stops early when 3,000 draws in a row give nothing new. ### Make more ```bash python logic_puzzles.py --seed my-seed --per-family 1000 --out more.jsonl python logic_puzzles.py --seed my-seed --per-family 500 --families zebra,cryptarithm --out hard.jsonl python verify.py more.jsonl # optional: re-solve every new puzzle independently ``` Standard library only, Python 3.9 or newer. Use a new seed to get puzzles that are not in this dataset (questions can still repeat by chance in the small families; drop any that appear here if you need a clean held-out set). ### Fields | Field | Type | Meaning | |---|---|---| | `id` | string | family name and the first 12 hex characters of the SHA-256 of the question | | `family` | string | one of the 17 family names above | | `question` | string | the puzzle, including the form the answer must take | | `answer` | string | the one correct answer, in canonical form | | `answer_type` | string | `integer`, `number`, `weekday`, `name`, `names` or `none` | ## Intended use and limitations Use it to train or test reasoning with rewards that a program can check: reinforcement learning with verifiable rewards, rejection sampling, curricula of growing difficulty, or a quick held-out test of small models (the test split). Do not use scores on it alone as evidence of general reasoning ability; the families are narrow and templated. ## Licence The puzzles (the files in `data/`) are licensed under [CC-BY-4.0](https://creativecommons.org/licenses/by/4.0/): reuse them for any purpose, including commercial, with attribution to "Udgam Logic Puzzles by Udgam Labs". The code (`logic_puzzles.py`, `verify.py`, `make_release.py`) is licensed under Apache-2.0 (see `LICENSE-CODE`). ## Citation ```bibtex @misc{udgamlabs2026logicpuzzles, title = {Udgam Logic Puzzles: 17 families of generated logic puzzles with exactly checkable answers}, author = {Prasad, Jitesh K and {Udgam Labs}}, year = {2026}, howpublished = {\url{https://huggingface.co/datasets/udgamlabs/logic-puzzles}} } ``` --- **About Udgam Labs.** Udgam Labs is an independent AI research lab. We work from first principles: before we build, we understand why things work, whether we are training a model, fine-tuning one or applying AI to a new problem. Udgam (उद्गम) is Sanskrit for origin. [udgamlabs.com](https://udgamlabs.com)