A self-learning, autonomous RAG (Retrieval-Augmented Generation) system powered by the Paradox ecosystem. Parag eliminates heavy ML dependencies (PyTorch, FAISS, transformers) and replaces them with custom, self-learning frameworks.
- Paradma - Self-learning mathematical operations (learns from NumPy, graduates to native Python)
- ParadoxLF - Autonomous memory engine with creative capabilities
- modules.framework - Custom PyTorch replacement with Tensor and autograd
- HyperMatrix - Quantum-like superposition for uncertain knowledge
- Minimal Dependencies: Only ~15MB (NumPy + PyPDF2 + tqdm) vs ~2GB with traditional stack
- Progressive Learning: Operations start with NumPy, evolve to native implementations
- Creative Features: Concept blending via
imagine(), temporal prediction - Quantum-Like Reasoning: Superposition support for conflicting facts
- Autonomous Optimization: Memory engine evolves independently
- Full Explainability: Deterministic responses without LLM when appropriate
# Clone the repository
git clone https://github.com/ethcocoder/parag.git
cd parag
# Install minimal dependencies
pip install -r requirements.txt
# Ensure Paradox ecosystem is available# (Paradma, ParadoxLF, modules should be in parent directory)- Before: ~2GB (PyTorch + FAISS + transformers)
- After: ~15MB (NumPy + PyPDF2 + tqdm)
- Reduction: 98.5% smaller! 🎉
fromparag.coreimportKnowledgeUnitfromparag.embeddingsimportParadoxEmbeddings# Self-learning embeddings!fromparag.vectorstoreimportParadoxVectorStore# Autonomous memoryfromparag.retrievalimportRetrieverfromparag.reasoningimportStateManagerfromparag.generationimportDeterministicGenerator# 1. Ingest documentsdocuments=load_document("path/to/document.pdf")
chunked_docs=chunk_documents(documents)
# 2. Create embeddingsembedding_model=SentenceTransformerEmbeddings()
embedding_dim=embedding_model.get_embedding_dim()
# 3. Initialize vector storevector_store=FAISSVectorStore(dimension=embedding_dim)
# 4. Create knowledge units and add to retrieval systemretriever=Retriever(embedding_model, vector_store)
units= [
KnowledgeUnit(
content=doc["content"],
metadata=doc["metadata"]
)
fordocinchunked_docs
]
retriever.add_knowledge_units(units)
# 5. Retrieve relevant informationquery="What is the main topic?"result=retriever.retrieve(query, top_k=5)
# 6. Build state and reasonstate_manager=StateManager()
state=state_manager.build_from_retrieval(result)
state.detect_conflicts()
# 7. Generate responsegenerator=DeterministicGenerator()
response=generator.generate_from_state(query, state)
print(response)parag/
├── core/ # Core data models
│ ├── knowledge_unit.py
│ ├── retrieval_result.py
│ └── rag_state.py
├── ingestion/ # Document processing
│ ├── loaders.py
│ ├── chunker.py
│ └── metadata.py
├── embeddings/ # Embedding generation
│ ├── base.py
│ └── sentence_transformer.py
├── vectorstore/ # Vector database
│ ├── faiss_store.py
│ └── index_manager.py
├── retrieval/ # Retrieval engine
│ ├── retriever.py
│ └── ranker.py
├── reasoning/ # Reasoning layer
│ ├── state_manager.py
│ ├── conflict_detector.py
│ └── uncertainty.py
└── generation/ # Response generation
├── prompt_builder.py
└── llm_adapter.py
All retrieved data is wrapped in a standard structure:
KnowledgeUnit:
content# text / image / tensorembedding# vector representationmetadata# source, timestamp, tagsconfidence# optional confidence scoreInternal state representation for reasoning:
RAGState:
facts# aggregated facts from knowledge unitsknowledge_units# all contributing unitsconflicts# detected contradictionsuncertainty# uncertainty measurementStructured container for retrieval outputs:
RetrievalResult:
units# list of KnowledgeUnitsscores# relevance scoresquery# original querymetadata# retrieval metadata- Classic RAG foundation
- Structured retrieval with KnowledgeUnit
- RAG state and reasoning layer
- Deterministic generation
- Concept blending hooks
- Temporal retrieval
- Paradma law-based reasoning
- Entropy thresholds
- Curiosity-driven re-query
- Human feedback ingestion
# Run tests
pytest tests/
# With coverage
pytest tests/ --cov=paragMIT License - See LICENSE file for details
Contributions are welcome! Please feel free to submit a Pull Request.
- Documentation: See
doc/directory - Roadmap:
doc/roadmap.md - Todo:
doc/todo.md
Parag is built on the principle that reasoning should happen in structured state, not in prompts. By separating retrieval, reasoning, and generation:
- Retrieval finds relevant knowledge
- Reasoning operates on structured facts
- Generation is the final, optional step
This enables:
- Transparency: Every decision is traceable
- Scalability: Each layer can evolve independently
- Reliability: Deterministic behavior when needed
- Future-proofing: Ready for advanced cognitive engines
Built with ❤️ by ethcocoder