How crespina/llm4cp works
Project type and purpose
• CP-Model-Zoo is a standalone “intelligent tutoring” / retrieval tool that lets users enter natural-language descriptions of combinatorial problems and retrieves the closest expert-written MiniZinc model.
• It comprises two main pipelines (indexing and inference) plus both GUI (Gradio) and CLI front-ends.
Main components
A. Data Layer (storage)
• Raw MiniZinc models (data/input/…)
• Generated text descriptions (data/output/generated_descriptions)
• Vector databases (data/vector_dbs)
• Experiment results (data/results)
B. Indexing Service (app/data_processing + run_indexing.py)
• Loads raw models and descriptions
• Generates multi-level descriptions (beginner/medium/expert)
• Calls external Embedding API (GROQ)
• Writes vector stores to disk (JSON-based vector DBs)
C. Inference Service (app/inference + run_inference.py)
• Accepts user NL query
• Embeds query via Embedding API
• Performs similarity search against vector DBs
• Retrieves matching MiniZinc code & description
D. GUI Front-end (app/gui + run_gui.py)
• Gradio interface for query input and displaying results
E. Utilities & Config (app/utils + configuration.py)
• Shared constants, helper functions, CLI/config parsing
Relationships and data flows
Indexing flow (one-time or on-demand):
Raw Models → Data Loaders → Description Generator → Embedding API → Vector DB + Text Stores
Inference flow (per-query):
User (GUI/CLI) → Inference Service → Embedding API → Vector DB (NN search) → Inference Service → UI
Architectural patterns & principles
• Layered: UI Layer → Service Layer → Data Layer → External Service
• Modular pipelines: clear separation of indexing vs. inference
• ETL-style data processing (in indexing)
• Dependency inversion: services depend on storage abstractions and external API