MartialTerran commited on
Commit
8878724
·
verified ·
1 Parent(s): 1349619

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +127 -1
README.md CHANGED
@@ -1,4 +1,130 @@
1
  ---
2
  license: apache-2.0
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
4
- This folder presents some examinations of datasets produced by synthetic Datasets (for use in training or evaluating LLMs/Transformers or subcomponents thereof). First entry is script that examines the numberspace of Pi (ratio of Circumference to Diameter of Circle) in hexadecimal (base16). The inspection determines the existence of repeat-sequences of increasing lengths, to demonstrate index regions where the data is non-repeating and psuedorandom. Hint: Can an ML model or LLM detect a pattern in a sequence of numerals of Pi and construct an approximation that predicts the next-numerals? Maybe not.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: apache-2.0
3
+ tags:
4
+ - mathematics
5
+ - pi
6
+ - hexadecimal
7
+ - synthetic-data
8
+ - pseudorandomness
9
+ - sequence-modeling
10
+ - transformers
11
+ task_categories:
12
+ - text-generation
13
+ - tabular-to-text
14
+ size_categories:
15
+ - 1M<n<10M
16
  ---
17
+
18
+ # $\pi$ Hexadecimal Repetition & Entropy Analysis Suite
19
+
20
+ A data science testbed and synthetic dataset generator examining the distribution, collision statistics, and pseudorandom sequence properties of $\pi$ in **hexadecimal (Base 16)**.
21
+
22
+ This repository explores the limits of sequence modeling, token predictability, and structural entropy in mathematically generated sequences—specifically testing whether modern Autoregressive Transformers and Large Language Models (LLMs) can discover latent structure in mathematically deterministic yet pseudorandom streams.
23
+
24
+ ---
25
+
26
+ ## 📌 Research Motivation: Can LLMs Learn $\pi$?
27
+
28
+ > **Core Hypothesis:**
29
+ > Can an ML model or LLM detect patterns in an arbitrary sequence of hexadecimal numerals of $\pi$ and predict the subsequent digits?
30
+
31
+ Because $\pi$ is conjectured to be a normal number in Base 16, its fractional expansion exhibits statistical properties virtually indistinguishable from an ideal pseudorandom sequence. Evaluating models on this data serves several key machine learning and data science purposes:
32
+
33
+ 1. **Synthetic Sequence Probing:** Testing the inductive biases and context-window dynamics of Transformers on truly non-periodic streams.
34
+ 2. **Memorization vs. Generalization:** Evaluating whether models are merely memorizing known chunks of $\pi$ or attempting to synthesize algorithmic computation.
35
+ 3. **Entropy & Compressibility:** Verifying that substring repetition frequencies conform to expected random walk and birthday-problem bounds rather than compressible tokens.
36
+
37
+ ---
38
+
39
+ ## 🚀 Key Features of `Pi_Hex_DataScience_V1.0.py`
40
+
41
+ The repository includes a self-contained, high-performance Python engine designed to generate and audit Base 16 digits of $\pi$:
42
+
43
+ - **Fast Chudnovsky Binary-Splitting Engine:** Pure Python arbitrary-precision integer arithmetic optimized for standard CPUs (zero external dependencies like `gmpy2` required).
44
+ - **Exhaustive Substring Collision Engine:** Scans for exact sequence repetitions across configurable length horizons ($L \in [4, 64]$).
45
+ - **Exponential Horizon Doubling:** Automatically doubles the search horizon $N$ when no collisions are detected for target sequence lengths.
46
+ - **Detailed Telemetry:** Tracks incident coordinates ($i_1, i_2$), distances ($\Delta$), and generates `0–F` digit distribution histograms for repeating sequences.
47
+ - **Safety & Persistence:** Checkpoints progress every 30 minutes, supports auto-download within Google Colab, and enforces an optional hard runtime ceiling (default: 3 hours).
48
+
49
+ ---
50
+
51
+ ## 📁 Repository Structure
52
+
53
+ ```plaintext
54
+ ├── Pi_Hex_DataScience_V1.0.py # Core generation & collision engine
55
+ ├── pi_datascience_checkpoint.json # Saved state & intermediate analysis
56
+ ├── pi_repetition_report.txt # Plaintext summary table
57
+ ├── pi_repetition_report.md # Markdown report with collision coordinates
58
+ ├── pi_repetition_report.html # Interactive HTML report with mini histograms
59
+ └── README.md # Dataset card & documentation
60
+ ```
61
+
62
+ ---
63
+
64
+ ## 🛠️ Usage Quickstart
65
+
66
+ ### 1. Requirements
67
+
68
+ The script uses standard library modules only:
69
+ ```bash
70
+ python --version # Python 3.8+ recommended
71
+ ```
72
+
73
+ ### 2. Run the Analysis
74
+
75
+ ```bash
76
+ python Pi_Hex_DataScience_V1.0.py
77
+ ```
78
+
79
+ ### 3. Google Colab Support
80
+
81
+ The script includes built-in detection for Google Colab environments (`sys.modules["google.colab"]`). When run in Colab, intermediate checkpoints and reports (`.json`, `.txt`, `.md`, `.html`) are automatically downloaded to your local machine every 30 minutes.
82
+
83
+ ---
84
+
85
+ ## ⚙️ Configuration Parameters
86
+
87
+ The generation horizon and substring lengths can be modified directly inside `CONFIG`:
88
+
89
+ ```python
90
+ CONFIG = {
91
+ "min_length": 4, # Smallest substring length to inspect
92
+ "max_length": 64, # Longest substring length to inspect
93
+ "initial_n": 2000, # Initial digit search horizon (N)
94
+ "max_n_limit": 2000000, # Safety limit (2 million hex digits)
95
+ "checkpoint_interval_sec": 1800, # 30-minute state checkpointing
96
+ "max_runtime_sec": 10800, # 3-hour runtime budget ceiling
97
+ "checkpoint_file": "pi_datascience_checkpoint.json",
98
+ "report_txt": "pi_repetition_report.txt",
99
+ "report_md": "pi_repetition_report.md",
100
+ "report_html": "pi_repetition_report.html",
101
+ }
102
+ ```
103
+
104
+ ---
105
+
106
+ ## 📊 Sample Report Output
107
+
108
+ When executed, the engine outputs structured reports summarizing whether sequences of length $L$ have repeated within the search window:
109
+
110
+ | Length ($L$) | Repeat Detected? | Unique Repeats | First Repeated Sequence | First Index ($i_1$) | Repeat Index ($i_2$) | Distance ($\Delta$) |
111
+ | :---: | :---: | :---: | :--- | :---: | :---: | :---: |
112
+ | **4** | **YES** | 12 | `2B4C` | 148 | 892 | 744 |
113
+ | **5** | **YES** | 1 | `A0E18` | 420 | 1850 | 1430 |
114
+ | **6** | **NO** | 0 | — | — | — | — |
115
+
116
+ *(If repeats are absent, the engine automatically doubles the search window $N \to 2N$ and re-evaluates until collision thresholds are met or limits are reached).*
117
+
118
+ ---
119
+
120
+ ## 🔬 Use Cases in Machine Learning
121
+
122
+ - **Next-Token Prediction Baselines:** Use hex sequences of $\pi$ as a negative control benchmark against autoregressive sequence models.
123
+ - **Tokenizer Stress Testing:** Evaluate how Byte-Pair Encoding (BPE) and subword tokenizers partition high-entropy, non-repeating alphanumeric series.
124
+ - **Synthetic Pretraining Experiments:** Measure whether exposure to algorithmic number-theoretic streams affects transformer attention entropy.
125
+
126
+ ---
127
+
128
+ ## 📜 License
129
+
130
+ This project and associated datasets are distributed under the [Apache 2.0 License](LICENSE).