The Continuous Learning Assistant is an intelligent chat-based system designed to interact with users, process their inputs, retrieve relevant knowledge, generate meaningful responses, collect feedback, and continuously improve its performance through ongoing training. Leveraging advanced technologies such as transformer models, FAISS for efficient knowledge retrieval, and Direct Preference Optimization (DPO) for fine-tuning, this assistant aims to provide accurate and contextually aware assistance.
- User Interface: Interactive chat interface for seamless user interaction.
- Processing Pipeline: Handles preprocessing, context management, and Named Entity Recognition (NER) extraction.
- Response Generation: Utilizes GPT models enhanced with Low-Rank Adaptation (LoRA) for generating responses.
- Knowledge Retrieval: Employs FAISS for efficient retrieval from a comprehensive knowledge store.
- Feedback Collection: Gathers explicit and implicit user feedback to refine responses.
- Continuous Training: Asynchronously fine-tunes the model based on accumulated interactions and feedback using DPO.
graph TD
UI["User Interface (Chat Interface)"] --> PP["Processing Pipeline (Preprocessing, Context Management, NER Extraction)"]
PP --> RG["Response Generation (GPT Model + LoRA)"]
PP --> RK["Retrieval Knowledge Store (FAISS Index)"]
RG --> FBC["Feedback Collection (Explicit/Implicit)"]
RG --> TKS["Training Knowledge Store (User Inputs, Responses, Feedback, Metadata)"]
FBC --> ATP["Asynchronous Training Pipeline (Fine-Tuning with Backpropagation)"]
RK --> ATP
- User Interface: The front-end chat interface where users interact with the assistant.
- Processing Pipeline: Preprocesses user inputs, manages context, and extracts named entities.
- Response Generation: Generates responses using a GPT model integrated with LoRA for adaptability.
- Knowledge Retrieval: Retrieves relevant information from the FAISS-indexed knowledge store to inform responses.
- Feedback Loop: Collects user feedback to assess and improve response quality.
- Training Pipeline: Periodically fine-tunes the model using collected data to enhance performance.
- Python 3.8+
- CUDA-enabled GPU (optional, for accelerated processing)
- FAISS installed
-
Clone the Repository
git clone https://github.com/peytontolbert/continuous-learning-assistant.git cd continuous-learning-assistant
-
Create a Virtual Environment
python -m venv venv source venv/bin/activate # On Windows: venv\Scripts\activate
-
Install Dependencies
pip install -r requirements.txt
-
Configure Models and Indexes
- Ensure that the necessary transformer models are downloaded.
- Initialize or place the FAISS index files in the project directory.
Run the main application:
bash
python main.py
Interact with the assistant through the command-line interface. Type your messages and receive responses in real-time. To exit the application, type exit
or quit
.
All configurations are managed within main.py
, including:
- Embedding Model: Defined by
EMBEDDING_MODEL_NAME
. - FAISS Index Files: Paths specified for retrieval and training knowledge stores.
- Training Parameters: Includes training intervals and minimum sample requirements.
- Model Directories: Specifies where fine-tuned models are saved.
main.py
: Entry point of the application handling user interactions and orchestrating components.models/transformer.py
: Handles response generation using transformer models.training/fine_tune_dpo.py
: Manages the fine-tuning process using DPO based on user interactions.util_scripts/knowledge.py
: Functions for managing knowledge stores and retrieval processes.prompts/
: Contains prompt templates for semantic and episodic knowledge extraction.workflow.md
: Visual representation of the system's workflow..gitignore
: Specifies files and directories to be ignored by Git.
Contributions are welcome! Please follow these steps:
- Fork the repository.
- Create a new feature branch.
- Commit your changes with clear messages.
- Push to your forked repository.
- Submit a pull request detailing your enhancements.
This project is licensed under the MIT License.