entropyguard 1.22.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- entropyguard-1.22.0/LICENSE +23 -0
- entropyguard-1.22.0/PKG-INFO +368 -0
- entropyguard-1.22.0/README.md +322 -0
- entropyguard-1.22.0/pyproject.toml +87 -0
- entropyguard-1.22.0/src/entropyguard/__init__.py +14 -0
- entropyguard-1.22.0/src/entropyguard/chunking/__init__.py +13 -0
- entropyguard-1.22.0/src/entropyguard/chunking/splitter.py +318 -0
- entropyguard-1.22.0/src/entropyguard/cli/__init__.py +13 -0
- entropyguard-1.22.0/src/entropyguard/cli/main.py +1096 -0
- entropyguard-1.22.0/src/entropyguard/core/__init__.py +37 -0
- entropyguard-1.22.0/src/entropyguard/core/checkpoint.py +325 -0
- entropyguard-1.22.0/src/entropyguard/core/config_loader.py +200 -0
- entropyguard-1.22.0/src/entropyguard/core/config_validator.py +123 -0
- entropyguard-1.22.0/src/entropyguard/core/constants.py +26 -0
- entropyguard-1.22.0/src/entropyguard/core/error_messages.py +201 -0
- entropyguard-1.22.0/src/entropyguard/core/errors.py +78 -0
- entropyguard-1.22.0/src/entropyguard/core/exit_codes.py +39 -0
- entropyguard-1.22.0/src/entropyguard/core/logger.py +116 -0
- entropyguard-1.22.0/src/entropyguard/core/memory_profiler.py +230 -0
- entropyguard-1.22.0/src/entropyguard/core/metrics.py +132 -0
- entropyguard-1.22.0/src/entropyguard/core/pipeline.py +918 -0
- entropyguard-1.22.0/src/entropyguard/core/progress_tracker.py +157 -0
- entropyguard-1.22.0/src/entropyguard/core/resource_guards.py +296 -0
- entropyguard-1.22.0/src/entropyguard/core/retry.py +157 -0
- entropyguard-1.22.0/src/entropyguard/core/sanitization_lazy.py +165 -0
- entropyguard-1.22.0/src/entropyguard/core/types.py +69 -0
- entropyguard-1.22.0/src/entropyguard/deduplication/__init__.py +13 -0
- entropyguard-1.22.0/src/entropyguard/deduplication/embedder.py +102 -0
- entropyguard-1.22.0/src/entropyguard/deduplication/index.py +257 -0
- entropyguard-1.22.0/src/entropyguard/ingestion/__init__.py +11 -0
- entropyguard-1.22.0/src/entropyguard/ingestion/loader.py +203 -0
- entropyguard-1.22.0/src/entropyguard/sanitization/__init__.py +21 -0
- entropyguard-1.22.0/src/entropyguard/sanitization/core.py +228 -0
- entropyguard-1.22.0/src/entropyguard/validation/__init__.py +13 -0
- entropyguard-1.22.0/src/entropyguard/validation/validator.py +186 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Damian Siuta
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
22
|
+
|
|
23
|
+
|
|
@@ -0,0 +1,368 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: entropyguard
|
|
3
|
+
Version: 1.22.0
|
|
4
|
+
Summary: High-Performance Semantic Deduplication Tool for RAG Pipelines
|
|
5
|
+
License: MIT
|
|
6
|
+
License-File: LICENSE
|
|
7
|
+
Keywords: rag,llm,deduplication,data-engineering,nlp,cli,ai
|
|
8
|
+
Author: Damian Siuta
|
|
9
|
+
Author-email: dami.siuta@gmail.com
|
|
10
|
+
Requires-Python: >=3.10,<4.0
|
|
11
|
+
Classifier: Development Status :: 5 - Production/Stable
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Intended Audience :: Science/Research
|
|
14
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
15
|
+
Classifier: Operating System :: OS Independent
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
22
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
23
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
24
|
+
Classifier: Topic :: Text Processing :: Linguistic
|
|
25
|
+
Provides-Extra: all
|
|
26
|
+
Provides-Extra: gpu
|
|
27
|
+
Provides-Extra: logging
|
|
28
|
+
Provides-Extra: metrics
|
|
29
|
+
Requires-Dist: faiss-cpu (>=1.7.4,<2.0.0)
|
|
30
|
+
Requires-Dist: fastexcel (>=0.11.6,<0.12.0)
|
|
31
|
+
Requires-Dist: numpy (>=1.24.0,<2.0.0)
|
|
32
|
+
Requires-Dist: polars (>=0.20.0,<0.21.0)
|
|
33
|
+
Requires-Dist: prometheus-client (>=0.19.0,<0.20.0) ; extra == "metrics" or extra == "all"
|
|
34
|
+
Requires-Dist: pyarrow (>=15.0.0,<16.0.0)
|
|
35
|
+
Requires-Dist: pydantic (>=2.5.0,<3.0.0)
|
|
36
|
+
Requires-Dist: sentence-transformers (>=2.0.0,<3.0.0)
|
|
37
|
+
Requires-Dist: structlog (>=24.1.0,<25.0.0) ; extra == "logging" or extra == "all"
|
|
38
|
+
Requires-Dist: torch (>=2.1.0,<3.0.0) ; extra == "gpu" or extra == "all"
|
|
39
|
+
Requires-Dist: tqdm (>=4.66.0,<5.0.0)
|
|
40
|
+
Requires-Dist: typing-extensions (>=4.8.0,<5.0.0)
|
|
41
|
+
Requires-Dist: xxhash (>=3.4.0,<4.0.0)
|
|
42
|
+
Project-URL: Homepage, https://github.com/DamianSiuta/entropyguard
|
|
43
|
+
Project-URL: Repository, https://github.com/DamianSiuta/entropyguard
|
|
44
|
+
Description-Content-Type: text/markdown
|
|
45
|
+
|
|
46
|
+
# 🛡️ EntropyGuard v1.22.0
|
|
47
|
+
|
|
48
|
+
<div align="center">
|
|
49
|
+
|
|
50
|
+
**The Unbreakable RAG Data Cleaner**
|
|
51
|
+
|
|
52
|
+
[](https://opensource.org/licenses/MIT)
|
|
53
|
+
[](https://www.python.org/downloads/)
|
|
54
|
+
[](https://www.docker.com/)
|
|
55
|
+
[](https://github.com/DamianSiuta/entropyguard)
|
|
56
|
+
|
|
57
|
+
**Enterprise-grade semantic data deduplication and sanitization engine for LLM training data.**
|
|
58
|
+
|
|
59
|
+
[Features](#-key-features) • [Quick Start](#-quick-start) • [Installation](#-installation) • [Documentation](#-documentation)
|
|
60
|
+
|
|
61
|
+
</div>
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Why EntropyGuard?
|
|
66
|
+
|
|
67
|
+
### The Problem: Dirty Data = Hallucinations & Wasted Money
|
|
68
|
+
|
|
69
|
+
Training Large Language Models on contaminated, redundant, or low-quality data leads to:
|
|
70
|
+
- **Model Collapse** — Degraded performance from duplicate content
|
|
71
|
+
- **Hallucinations** — Inaccurate outputs from poor training data
|
|
72
|
+
- **Wasted Compute** — Paying for processing duplicate data multiple times
|
|
73
|
+
- **Compliance Risks** — PII and sensitive data in training sets
|
|
74
|
+
|
|
75
|
+
### The Solution: Local CPU Processing with Hybrid Deduplication
|
|
76
|
+
|
|
77
|
+
EntropyGuard runs **100% locally** on your CPU—no data ever leaves your machine. Perfect for:
|
|
78
|
+
- **Air-gapped environments** (no cloud dependencies)
|
|
79
|
+
- **Privacy compliance** (GDPR, HIPAA, SOC 2)
|
|
80
|
+
- **Cost efficiency** (no API calls, no cloud fees)
|
|
81
|
+
- **Enterprise security** (complete data sovereignty)
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## ✨ Key Features
|
|
86
|
+
|
|
87
|
+
### 🛡️ **Fault Tolerant**
|
|
88
|
+
- **Checkpoint/Resume System** — Automatic recovery from failures
|
|
89
|
+
- **Memory Safety** — Chunked processing prevents OOM errors
|
|
90
|
+
- **Graceful Shutdown** — SIGINT/SIGTERM handling (Windows + Unix)
|
|
91
|
+
- **Error Recovery** — Automatic retry with exponential backoff
|
|
92
|
+
|
|
93
|
+
### 🚀 **High Performance**
|
|
94
|
+
- **Hybrid Engine** — Hash-based exact dedup + AI semantic similarity
|
|
95
|
+
- **Unix Pipes Support** — Stream processing for data engineering workflows
|
|
96
|
+
- **Lazy Evaluation** — Polars LazyFrame for datasets larger than RAM
|
|
97
|
+
- **Optimized Memory** — Pre-materialization checks prevent OOM
|
|
98
|
+
|
|
99
|
+
### 📉 **Memory Safe**
|
|
100
|
+
- **Chunked Processing** — Process datasets larger than available RAM
|
|
101
|
+
- **Memory Profiling** — Track memory usage per pipeline stage
|
|
102
|
+
- **Resource Guards** — Disk space and memory checks before operations
|
|
103
|
+
|
|
104
|
+
### 📊 **Observability**
|
|
105
|
+
- **Prometheus Metrics** — Export pipeline metrics for monitoring
|
|
106
|
+
- **Structured Logging** — JSON logs with correlation IDs
|
|
107
|
+
- **Progress Tracking** — Real-time ETA and throughput estimation
|
|
108
|
+
- **Audit Logs** — Complete audit trail of all operations
|
|
109
|
+
|
|
110
|
+
### 🔒 **Enterprise Ready**
|
|
111
|
+
- **Standard Exit Codes** — sysexits.h compliant for automation
|
|
112
|
+
- **Type Safety** — Full type hints (MyPy strict compatible)
|
|
113
|
+
- **Configuration Validation** — Pydantic-based schema validation
|
|
114
|
+
- **Input Validation** — Format detection and consistency checks
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## ⚡ Quick Start
|
|
119
|
+
|
|
120
|
+
### The "Magic" Command
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
# Unix pipe example (the most common use case)
|
|
124
|
+
cat data.jsonl | entropyguard --dedup-threshold 0.95 > clean.jsonl
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
### Basic Usage
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
# File-to-file processing
|
|
131
|
+
entropyguard \
|
|
132
|
+
--input data.jsonl \
|
|
133
|
+
--output clean.jsonl \
|
|
134
|
+
--text-column text \
|
|
135
|
+
--dedup-threshold 0.95
|
|
136
|
+
|
|
137
|
+
# With custom settings
|
|
138
|
+
entropyguard \
|
|
139
|
+
--input data.ndjson \
|
|
140
|
+
--output cleaned.ndjson \
|
|
141
|
+
--text-column content \
|
|
142
|
+
--min-length 100 \
|
|
143
|
+
--dedup-threshold 0.9 \
|
|
144
|
+
--chunk-size 500
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Advanced: Checkpoint & Resume
|
|
148
|
+
|
|
149
|
+
```bash
|
|
150
|
+
# Enable automatic checkpoint recovery
|
|
151
|
+
entropyguard \
|
|
152
|
+
--input large_dataset.jsonl \
|
|
153
|
+
--output clean.jsonl \
|
|
154
|
+
--checkpoint-dir ./checkpoints \
|
|
155
|
+
--text-column text
|
|
156
|
+
|
|
157
|
+
# Resume from checkpoint manually
|
|
158
|
+
entropyguard \
|
|
159
|
+
--input large_dataset.jsonl \
|
|
160
|
+
--output clean.jsonl \
|
|
161
|
+
--checkpoint-dir ./checkpoints \
|
|
162
|
+
--resume \
|
|
163
|
+
--text-column text
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## 📦 Installation
|
|
169
|
+
|
|
170
|
+
### Option 1: pip from PyPI (Recommended)
|
|
171
|
+
|
|
172
|
+
```bash
|
|
173
|
+
pip install entropyguard
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
**Requirements:**
|
|
177
|
+
- Python 3.10, 3.11, or 3.12 (3.13 not supported yet)
|
|
178
|
+
|
|
179
|
+
### Option 2: Install from Git
|
|
180
|
+
|
|
181
|
+
```bash
|
|
182
|
+
pip install "git+https://github.com/DamianSiuta/entropyguard.git"
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
**Requirements:**
|
|
186
|
+
- Python 3.10, 3.11, or 3.12 (3.13 not supported yet)
|
|
187
|
+
- `git` available on your system
|
|
188
|
+
|
|
189
|
+
### Option 3: Docker
|
|
190
|
+
|
|
191
|
+
```bash
|
|
192
|
+
# Build image
|
|
193
|
+
docker build -t entropyguard:latest .
|
|
194
|
+
|
|
195
|
+
# Run container
|
|
196
|
+
docker run -v $(pwd):/data entropyguard:latest \
|
|
197
|
+
--input /data/input.jsonl \
|
|
198
|
+
--output /data/output.jsonl \
|
|
199
|
+
--text-column text
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Option 4: Development Setup
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
git clone https://github.com/DamianSiuta/entropyguard.git
|
|
206
|
+
cd entropyguard
|
|
207
|
+
poetry install
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
## 🏢 Enterprise / Advanced Usage
|
|
213
|
+
|
|
214
|
+
### Configuration File (`.entropyguardrc.json`)
|
|
215
|
+
|
|
216
|
+
Create a configuration file in your home directory or project root:
|
|
217
|
+
|
|
218
|
+
```json
|
|
219
|
+
{
|
|
220
|
+
"text_column": "text",
|
|
221
|
+
"min_length": 100,
|
|
222
|
+
"dedup_threshold": 0.95,
|
|
223
|
+
"chunk_size": 500,
|
|
224
|
+
"chunk_overlap": 50,
|
|
225
|
+
"remove_pii": true,
|
|
226
|
+
"normalize_text": true,
|
|
227
|
+
"show_progress": true
|
|
228
|
+
}
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
Then run:
|
|
232
|
+
|
|
233
|
+
```bash
|
|
234
|
+
entropyguard --input data.jsonl --output clean.jsonl
|
|
235
|
+
```
|
|
236
|
+
|
|
237
|
+
### Monitoring & Observability
|
|
238
|
+
|
|
239
|
+
```bash
|
|
240
|
+
# Enable Prometheus metrics
|
|
241
|
+
entropyguard \
|
|
242
|
+
--input data.jsonl \
|
|
243
|
+
--output clean.jsonl \
|
|
244
|
+
--metrics-port 9090 \
|
|
245
|
+
--text-column text
|
|
246
|
+
|
|
247
|
+
# Enable memory profiling
|
|
248
|
+
entropyguard \
|
|
249
|
+
--input data.jsonl \
|
|
250
|
+
--output clean.jsonl \
|
|
251
|
+
--profile-memory \
|
|
252
|
+
--text-column text
|
|
253
|
+
|
|
254
|
+
# JSON logs for machine parsing
|
|
255
|
+
entropyguard \
|
|
256
|
+
--input data.jsonl \
|
|
257
|
+
--output clean.jsonl \
|
|
258
|
+
--json-logs \
|
|
259
|
+
--text-column text
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
### Exit Codes
|
|
263
|
+
|
|
264
|
+
EntropyGuard follows the sysexits.h standard:
|
|
265
|
+
|
|
266
|
+
| Code | Meaning |
|
|
267
|
+
|------|---------|
|
|
268
|
+
| `0` | Success |
|
|
269
|
+
| `1` | General error |
|
|
270
|
+
| `2` | Usage error (invalid arguments) |
|
|
271
|
+
| `64` | Data format error |
|
|
272
|
+
| `65` | Input file error |
|
|
273
|
+
| `66` | Output file error |
|
|
274
|
+
| `70` | Software error (internal bug) |
|
|
275
|
+
| `130` | Process interrupted (SIGINT/Ctrl+C) |
|
|
276
|
+
|
|
277
|
+
---
|
|
278
|
+
|
|
279
|
+
## 📊 Comparison
|
|
280
|
+
|
|
281
|
+
| Feature | EntropyGuard | Basic Scripts | Vector DBs |
|
|
282
|
+
|---------|-------------|---------------|------------|
|
|
283
|
+
| **Exact Deduplication** | ✅ Hash-based (fast) | ⚠️ Manual | ❌ |
|
|
284
|
+
| **Semantic Deduplication** | ✅ AI-powered | ❌ | ✅ |
|
|
285
|
+
| **Local Processing** | ✅ 100% local | ✅ | ⚠️ Requires DB |
|
|
286
|
+
| **Memory Safety** | ✅ Chunked processing | ⚠️ Manual | ⚠️ Depends on DB |
|
|
287
|
+
| **Fault Tolerance** | ✅ Checkpoint/Resume | ❌ | ⚠️ Depends on DB |
|
|
288
|
+
| **Unix Pipes** | ✅ Native support | ⚠️ Manual | ❌ |
|
|
289
|
+
| **Observability** | ✅ Metrics + Logs | ❌ | ⚠️ Depends on DB |
|
|
290
|
+
| **Configuration** | ✅ Pydantic validation | ❌ | ⚠️ DB-specific |
|
|
291
|
+
| **Type Safety** | ✅ Full type hints | ❌ | ⚠️ Depends on language |
|
|
292
|
+
|
|
293
|
+
---
|
|
294
|
+
|
|
295
|
+
## 🛠️ Tech Stack
|
|
296
|
+
|
|
297
|
+
- **Core:** Python 3.10+, Polars (LazyFrame)
|
|
298
|
+
- **AI/ML:** PyTorch (CPU), FAISS, Sentence-Transformers
|
|
299
|
+
- **Validation:** Pydantic v2
|
|
300
|
+
- **Logging:** structlog (optional)
|
|
301
|
+
- **Metrics:** Prometheus Client (optional)
|
|
302
|
+
- **Infrastructure:** Poetry, Docker-ready
|
|
303
|
+
|
|
304
|
+
---
|
|
305
|
+
|
|
306
|
+
## 📋 Edition Comparison
|
|
307
|
+
|
|
308
|
+
EntropyGuard is available in two editions:
|
|
309
|
+
|
|
310
|
+
| Feature | **Community (Open Source)** | **Enterprise** |
|
|
311
|
+
|---------|----------------------------|----------------|
|
|
312
|
+
| **CLI Tool** | ✅ Full-featured | ✅ Full-featured |
|
|
313
|
+
| **Semantic Deduplication** | ✅ Unlimited | ✅ Unlimited |
|
|
314
|
+
| **PII Removal** | ✅ Unlimited | ✅ Unlimited |
|
|
315
|
+
| **Data Formats** | ✅ All formats | ✅ All formats |
|
|
316
|
+
| **Docker Support** | ✅ Yes | ✅ Yes |
|
|
317
|
+
| **Audit Logs** | ✅ Yes | ✅ Enhanced |
|
|
318
|
+
| **Web Dashboard** | ❌ | ✅ Professional Analytics Platform |
|
|
319
|
+
| **Real-time Monitoring** | ❌ | ✅ Live telemetry & metrics |
|
|
320
|
+
| **Alert System** | ❌ | ✅ Custom alert rules (Watchtower) |
|
|
321
|
+
| **API Access** | ❌ | ✅ RESTful API |
|
|
322
|
+
| **SSO Integration** | ❌ | ✅ SAML 2.0, OAuth 2.0 |
|
|
323
|
+
| **Support** | Community | Priority support with SLA |
|
|
324
|
+
| **License** | MIT License | Commercial license required |
|
|
325
|
+
|
|
326
|
+
> **📌 Legal Notice:** Enterprise features (Control Plane, Dashboard, API, Alerting System) are **proprietary software** covered by a commercial license. These components are **NOT included** in the Open Source release and are **NOT** subject to the MIT license terms.
|
|
327
|
+
|
|
328
|
+
---
|
|
329
|
+
|
|
330
|
+
## 📚 Documentation
|
|
331
|
+
|
|
332
|
+
- [Checkpoint & Resume Guide](./CHECKPOINT_RESUME_GUIDE.md)
|
|
333
|
+
- [Project Comprehensive Documentation](./PROJECT_COMPREHENSIVE_DOCUMENTATION.md)
|
|
334
|
+
- [Open Core Strategy](./OPEN_CORE_STRATEGY.md)
|
|
335
|
+
|
|
336
|
+
---
|
|
337
|
+
|
|
338
|
+
## 🤝 Contributing
|
|
339
|
+
|
|
340
|
+
Contributions are welcome! Please read our contributing guidelines and code of conduct before submitting pull requests.
|
|
341
|
+
|
|
342
|
+
---
|
|
343
|
+
|
|
344
|
+
## 📄 License
|
|
345
|
+
|
|
346
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
347
|
+
|
|
348
|
+
---
|
|
349
|
+
|
|
350
|
+
## 🙏 Acknowledgments
|
|
351
|
+
|
|
352
|
+
Built with ❤️ by the EntropyGuard Team
|
|
353
|
+
|
|
354
|
+
**Special thanks to:**
|
|
355
|
+
- [Polars](https://www.pola.rs/) for the amazing DataFrame library
|
|
356
|
+
- [Sentence-Transformers](https://www.sbert.net/) for semantic embeddings
|
|
357
|
+
- [FAISS](https://github.com/facebookresearch/faiss) for vector similarity search
|
|
358
|
+
|
|
359
|
+
---
|
|
360
|
+
|
|
361
|
+
<div align="center">
|
|
362
|
+
|
|
363
|
+
**[⬆ Back to Top](#-entropyguard-v1220)**
|
|
364
|
+
|
|
365
|
+
Made with ❤️ for the LLM community
|
|
366
|
+
|
|
367
|
+
</div>
|
|
368
|
+
|
|
@@ -0,0 +1,322 @@
|
|
|
1
|
+
# 🛡️ EntropyGuard v1.22.0
|
|
2
|
+
|
|
3
|
+
<div align="center">
|
|
4
|
+
|
|
5
|
+
**The Unbreakable RAG Data Cleaner**
|
|
6
|
+
|
|
7
|
+
[](https://opensource.org/licenses/MIT)
|
|
8
|
+
[](https://www.python.org/downloads/)
|
|
9
|
+
[](https://www.docker.com/)
|
|
10
|
+
[](https://github.com/DamianSiuta/entropyguard)
|
|
11
|
+
|
|
12
|
+
**Enterprise-grade semantic data deduplication and sanitization engine for LLM training data.**
|
|
13
|
+
|
|
14
|
+
[Features](#-key-features) • [Quick Start](#-quick-start) • [Installation](#-installation) • [Documentation](#-documentation)
|
|
15
|
+
|
|
16
|
+
</div>
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Why EntropyGuard?
|
|
21
|
+
|
|
22
|
+
### The Problem: Dirty Data = Hallucinations & Wasted Money
|
|
23
|
+
|
|
24
|
+
Training Large Language Models on contaminated, redundant, or low-quality data leads to:
|
|
25
|
+
- **Model Collapse** — Degraded performance from duplicate content
|
|
26
|
+
- **Hallucinations** — Inaccurate outputs from poor training data
|
|
27
|
+
- **Wasted Compute** — Paying for processing duplicate data multiple times
|
|
28
|
+
- **Compliance Risks** — PII and sensitive data in training sets
|
|
29
|
+
|
|
30
|
+
### The Solution: Local CPU Processing with Hybrid Deduplication
|
|
31
|
+
|
|
32
|
+
EntropyGuard runs **100% locally** on your CPU—no data ever leaves your machine. Perfect for:
|
|
33
|
+
- **Air-gapped environments** (no cloud dependencies)
|
|
34
|
+
- **Privacy compliance** (GDPR, HIPAA, SOC 2)
|
|
35
|
+
- **Cost efficiency** (no API calls, no cloud fees)
|
|
36
|
+
- **Enterprise security** (complete data sovereignty)
|
|
37
|
+
|
|
38
|
+
---
|
|
39
|
+
|
|
40
|
+
## ✨ Key Features
|
|
41
|
+
|
|
42
|
+
### 🛡️ **Fault Tolerant**
|
|
43
|
+
- **Checkpoint/Resume System** — Automatic recovery from failures
|
|
44
|
+
- **Memory Safety** — Chunked processing prevents OOM errors
|
|
45
|
+
- **Graceful Shutdown** — SIGINT/SIGTERM handling (Windows + Unix)
|
|
46
|
+
- **Error Recovery** — Automatic retry with exponential backoff
|
|
47
|
+
|
|
48
|
+
### 🚀 **High Performance**
|
|
49
|
+
- **Hybrid Engine** — Hash-based exact dedup + AI semantic similarity
|
|
50
|
+
- **Unix Pipes Support** — Stream processing for data engineering workflows
|
|
51
|
+
- **Lazy Evaluation** — Polars LazyFrame for datasets larger than RAM
|
|
52
|
+
- **Optimized Memory** — Pre-materialization checks prevent OOM
|
|
53
|
+
|
|
54
|
+
### 📉 **Memory Safe**
|
|
55
|
+
- **Chunked Processing** — Process datasets larger than available RAM
|
|
56
|
+
- **Memory Profiling** — Track memory usage per pipeline stage
|
|
57
|
+
- **Resource Guards** — Disk space and memory checks before operations
|
|
58
|
+
|
|
59
|
+
### 📊 **Observability**
|
|
60
|
+
- **Prometheus Metrics** — Export pipeline metrics for monitoring
|
|
61
|
+
- **Structured Logging** — JSON logs with correlation IDs
|
|
62
|
+
- **Progress Tracking** — Real-time ETA and throughput estimation
|
|
63
|
+
- **Audit Logs** — Complete audit trail of all operations
|
|
64
|
+
|
|
65
|
+
### 🔒 **Enterprise Ready**
|
|
66
|
+
- **Standard Exit Codes** — sysexits.h compliant for automation
|
|
67
|
+
- **Type Safety** — Full type hints (MyPy strict compatible)
|
|
68
|
+
- **Configuration Validation** — Pydantic-based schema validation
|
|
69
|
+
- **Input Validation** — Format detection and consistency checks
|
|
70
|
+
|
|
71
|
+
---
|
|
72
|
+
|
|
73
|
+
## ⚡ Quick Start
|
|
74
|
+
|
|
75
|
+
### The "Magic" Command
|
|
76
|
+
|
|
77
|
+
```bash
|
|
78
|
+
# Unix pipe example (the most common use case)
|
|
79
|
+
cat data.jsonl | entropyguard --dedup-threshold 0.95 > clean.jsonl
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Basic Usage
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
# File-to-file processing
|
|
86
|
+
entropyguard \
|
|
87
|
+
--input data.jsonl \
|
|
88
|
+
--output clean.jsonl \
|
|
89
|
+
--text-column text \
|
|
90
|
+
--dedup-threshold 0.95
|
|
91
|
+
|
|
92
|
+
# With custom settings
|
|
93
|
+
entropyguard \
|
|
94
|
+
--input data.ndjson \
|
|
95
|
+
--output cleaned.ndjson \
|
|
96
|
+
--text-column content \
|
|
97
|
+
--min-length 100 \
|
|
98
|
+
--dedup-threshold 0.9 \
|
|
99
|
+
--chunk-size 500
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Advanced: Checkpoint & Resume
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
# Enable automatic checkpoint recovery
|
|
106
|
+
entropyguard \
|
|
107
|
+
--input large_dataset.jsonl \
|
|
108
|
+
--output clean.jsonl \
|
|
109
|
+
--checkpoint-dir ./checkpoints \
|
|
110
|
+
--text-column text
|
|
111
|
+
|
|
112
|
+
# Resume from checkpoint manually
|
|
113
|
+
entropyguard \
|
|
114
|
+
--input large_dataset.jsonl \
|
|
115
|
+
--output clean.jsonl \
|
|
116
|
+
--checkpoint-dir ./checkpoints \
|
|
117
|
+
--resume \
|
|
118
|
+
--text-column text
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## 📦 Installation
|
|
124
|
+
|
|
125
|
+
### Option 1: pip from PyPI (Recommended)
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
pip install entropyguard
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
**Requirements:**
|
|
132
|
+
- Python 3.10, 3.11, or 3.12 (3.13 not supported yet)
|
|
133
|
+
|
|
134
|
+
### Option 2: Install from Git
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
pip install "git+https://github.com/DamianSiuta/entropyguard.git"
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
**Requirements:**
|
|
141
|
+
- Python 3.10, 3.11, or 3.12 (3.13 not supported yet)
|
|
142
|
+
- `git` available on your system
|
|
143
|
+
|
|
144
|
+
### Option 3: Docker
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
# Build image
|
|
148
|
+
docker build -t entropyguard:latest .
|
|
149
|
+
|
|
150
|
+
# Run container
|
|
151
|
+
docker run -v $(pwd):/data entropyguard:latest \
|
|
152
|
+
--input /data/input.jsonl \
|
|
153
|
+
--output /data/output.jsonl \
|
|
154
|
+
--text-column text
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Option 4: Development Setup
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
git clone https://github.com/DamianSiuta/entropyguard.git
|
|
161
|
+
cd entropyguard
|
|
162
|
+
poetry install
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
---
|
|
166
|
+
|
|
167
|
+
## 🏢 Enterprise / Advanced Usage
|
|
168
|
+
|
|
169
|
+
### Configuration File (`.entropyguardrc.json`)
|
|
170
|
+
|
|
171
|
+
Create a configuration file in your home directory or project root:
|
|
172
|
+
|
|
173
|
+
```json
|
|
174
|
+
{
|
|
175
|
+
"text_column": "text",
|
|
176
|
+
"min_length": 100,
|
|
177
|
+
"dedup_threshold": 0.95,
|
|
178
|
+
"chunk_size": 500,
|
|
179
|
+
"chunk_overlap": 50,
|
|
180
|
+
"remove_pii": true,
|
|
181
|
+
"normalize_text": true,
|
|
182
|
+
"show_progress": true
|
|
183
|
+
}
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
Then run:
|
|
187
|
+
|
|
188
|
+
```bash
|
|
189
|
+
entropyguard --input data.jsonl --output clean.jsonl
|
|
190
|
+
```
|
|
191
|
+
|
|
192
|
+
### Monitoring & Observability
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
# Enable Prometheus metrics
|
|
196
|
+
entropyguard \
|
|
197
|
+
--input data.jsonl \
|
|
198
|
+
--output clean.jsonl \
|
|
199
|
+
--metrics-port 9090 \
|
|
200
|
+
--text-column text
|
|
201
|
+
|
|
202
|
+
# Enable memory profiling
|
|
203
|
+
entropyguard \
|
|
204
|
+
--input data.jsonl \
|
|
205
|
+
--output clean.jsonl \
|
|
206
|
+
--profile-memory \
|
|
207
|
+
--text-column text
|
|
208
|
+
|
|
209
|
+
# JSON logs for machine parsing
|
|
210
|
+
entropyguard \
|
|
211
|
+
--input data.jsonl \
|
|
212
|
+
--output clean.jsonl \
|
|
213
|
+
--json-logs \
|
|
214
|
+
--text-column text
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### Exit Codes
|
|
218
|
+
|
|
219
|
+
EntropyGuard follows the sysexits.h standard:
|
|
220
|
+
|
|
221
|
+
| Code | Meaning |
|
|
222
|
+
|------|---------|
|
|
223
|
+
| `0` | Success |
|
|
224
|
+
| `1` | General error |
|
|
225
|
+
| `2` | Usage error (invalid arguments) |
|
|
226
|
+
| `64` | Data format error |
|
|
227
|
+
| `65` | Input file error |
|
|
228
|
+
| `66` | Output file error |
|
|
229
|
+
| `70` | Software error (internal bug) |
|
|
230
|
+
| `130` | Process interrupted (SIGINT/Ctrl+C) |
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## 📊 Comparison
|
|
235
|
+
|
|
236
|
+
| Feature | EntropyGuard | Basic Scripts | Vector DBs |
|
|
237
|
+
|---------|-------------|---------------|------------|
|
|
238
|
+
| **Exact Deduplication** | ✅ Hash-based (fast) | ⚠️ Manual | ❌ |
|
|
239
|
+
| **Semantic Deduplication** | ✅ AI-powered | ❌ | ✅ |
|
|
240
|
+
| **Local Processing** | ✅ 100% local | ✅ | ⚠️ Requires DB |
|
|
241
|
+
| **Memory Safety** | ✅ Chunked processing | ⚠️ Manual | ⚠️ Depends on DB |
|
|
242
|
+
| **Fault Tolerance** | ✅ Checkpoint/Resume | ❌ | ⚠️ Depends on DB |
|
|
243
|
+
| **Unix Pipes** | ✅ Native support | ⚠️ Manual | ❌ |
|
|
244
|
+
| **Observability** | ✅ Metrics + Logs | ❌ | ⚠️ Depends on DB |
|
|
245
|
+
| **Configuration** | ✅ Pydantic validation | ❌ | ⚠️ DB-specific |
|
|
246
|
+
| **Type Safety** | ✅ Full type hints | ❌ | ⚠️ Depends on language |
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
## 🛠️ Tech Stack
|
|
251
|
+
|
|
252
|
+
- **Core:** Python 3.10+, Polars (LazyFrame)
|
|
253
|
+
- **AI/ML:** PyTorch (CPU), FAISS, Sentence-Transformers
|
|
254
|
+
- **Validation:** Pydantic v2
|
|
255
|
+
- **Logging:** structlog (optional)
|
|
256
|
+
- **Metrics:** Prometheus Client (optional)
|
|
257
|
+
- **Infrastructure:** Poetry, Docker-ready
|
|
258
|
+
|
|
259
|
+
---
|
|
260
|
+
|
|
261
|
+
## 📋 Edition Comparison
|
|
262
|
+
|
|
263
|
+
EntropyGuard is available in two editions:
|
|
264
|
+
|
|
265
|
+
| Feature | **Community (Open Source)** | **Enterprise** |
|
|
266
|
+
|---------|----------------------------|----------------|
|
|
267
|
+
| **CLI Tool** | ✅ Full-featured | ✅ Full-featured |
|
|
268
|
+
| **Semantic Deduplication** | ✅ Unlimited | ✅ Unlimited |
|
|
269
|
+
| **PII Removal** | ✅ Unlimited | ✅ Unlimited |
|
|
270
|
+
| **Data Formats** | ✅ All formats | ✅ All formats |
|
|
271
|
+
| **Docker Support** | ✅ Yes | ✅ Yes |
|
|
272
|
+
| **Audit Logs** | ✅ Yes | ✅ Enhanced |
|
|
273
|
+
| **Web Dashboard** | ❌ | ✅ Professional Analytics Platform |
|
|
274
|
+
| **Real-time Monitoring** | ❌ | ✅ Live telemetry & metrics |
|
|
275
|
+
| **Alert System** | ❌ | ✅ Custom alert rules (Watchtower) |
|
|
276
|
+
| **API Access** | ❌ | ✅ RESTful API |
|
|
277
|
+
| **SSO Integration** | ❌ | ✅ SAML 2.0, OAuth 2.0 |
|
|
278
|
+
| **Support** | Community | Priority support with SLA |
|
|
279
|
+
| **License** | MIT License | Commercial license required |
|
|
280
|
+
|
|
281
|
+
> **📌 Legal Notice:** Enterprise features (Control Plane, Dashboard, API, Alerting System) are **proprietary software** covered by a commercial license. These components are **NOT included** in the Open Source release and are **NOT** subject to the MIT license terms.
|
|
282
|
+
|
|
283
|
+
---
|
|
284
|
+
|
|
285
|
+
## 📚 Documentation
|
|
286
|
+
|
|
287
|
+
- [Checkpoint & Resume Guide](./CHECKPOINT_RESUME_GUIDE.md)
|
|
288
|
+
- [Project Comprehensive Documentation](./PROJECT_COMPREHENSIVE_DOCUMENTATION.md)
|
|
289
|
+
- [Open Core Strategy](./OPEN_CORE_STRATEGY.md)
|
|
290
|
+
|
|
291
|
+
---
|
|
292
|
+
|
|
293
|
+
## 🤝 Contributing
|
|
294
|
+
|
|
295
|
+
Contributions are welcome! Please read our contributing guidelines and code of conduct before submitting pull requests.
|
|
296
|
+
|
|
297
|
+
---
|
|
298
|
+
|
|
299
|
+
## 📄 License
|
|
300
|
+
|
|
301
|
+
This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
|
|
302
|
+
|
|
303
|
+
---
|
|
304
|
+
|
|
305
|
+
## 🙏 Acknowledgments
|
|
306
|
+
|
|
307
|
+
Built with ❤️ by the EntropyGuard Team
|
|
308
|
+
|
|
309
|
+
**Special thanks to:**
|
|
310
|
+
- [Polars](https://www.pola.rs/) for the amazing DataFrame library
|
|
311
|
+
- [Sentence-Transformers](https://www.sbert.net/) for semantic embeddings
|
|
312
|
+
- [FAISS](https://github.com/facebookresearch/faiss) for vector similarity search
|
|
313
|
+
|
|
314
|
+
---
|
|
315
|
+
|
|
316
|
+
<div align="center">
|
|
317
|
+
|
|
318
|
+
**[⬆ Back to Top](#-entropyguard-v1220)**
|
|
319
|
+
|
|
320
|
+
Made with ❤️ for the LLM community
|
|
321
|
+
|
|
322
|
+
</div>
|