Prompt Ranking Lab - A minimal Python server with SQLite and vanilla HTML/CSS/JS for ranking prompts
Repository: prompt-ranking-lab | Default branch: main
A private, local browser app for learning how a small model can rank candidate prompt suggestions by context. It trains its own weights with CPU-only sparse logistic regression. It does not call an AI provider or use pretrained model weights.
The project now has two isolated experiments:
Each experiment has separate training data and model weights. Nothing here reads CodePinion accounts, connects to its app, or changes CodePinion code. The CodePinion mode is an offline prototype that can help develop and evaluate a later adapter; it is not ready to deploy based on synthetic starter judgments alone.
Requires Python 3.10 or newer. The server, ranker, and interface use the Python standard library; there are no package installs.
cd "LLM Models/prompt-suggestion-ranker"
python3 -m promptlab
Open http://127.0.0.1:8765. Stop the server with Ctrl+C. It only binds to localhost. The application does not make remote requests or send analytics, uploaded data, or ranking requests off this computer.
The Train tab includes hand-authored preference examples for realistic CodePinion contexts. Choose CodePinion starter judgments + my feedback, train, then open CodePinion context. Load a sample state or edit the fields to represent a current page, file, task, workspace, branch, changed files, conflicts, or build failure. The model ranks only eligible prompt cards. Expand a card's learned features to inspect its score, then mark suggestions useful or not useful. The next training run includes your latest correction for each context/prompt pair.
The CodePinion context schema follows the assistant's current frontend and read-only workspace-tool contract, including the PageContext page label and workspace facts such as active task, branch, dirty files, and conflicts. It deliberately doesn't accept code content, credentials, account IDs, or private chat history. Contexts are held in browser memory; only context/prompt pairs you explicitly rate are saved to local SQLite. Metrics on starter examples measure agreement with authored labels, not real-world usefulness. Collect consented, representative CodePinion feedback before treating the model as a product signal.
The UI accepts the official tab-separated files directly. Download them from Microsoft’s MIMICS data folder, then import ClickExplore in the Train tab. Manual labels are optional and used as an independent quality check.
If the machine running the app has internet access, the project also includes a streaming downloader:
python3 scripts/fetch_mimics.py all
In this environment, outbound DNS resolution is unavailable, so the downloader cannot be exercised here. The UI upload path works without the server having network access. Raw data is stored under data/raw/ and ignored by Git. The MIMICS repository includes its data terms and citation; review them before using any research output outside this learning project.
MIMICS-ClickExplore.tsv.MIMICS-Manual.tsv.The target for ClickExplore is whether a clarification pane received any engagement (engagement_level > 0). Scores are learned estimates, not calibrated truth. Test ranking is compared with token-overlap scoring using top-1 positive rate, nDCG@3, and pairwise accuracy. Manual question labels are also reported when available.
promptlab/ SQLite data pipeline, CodePinion context adapter, sparse feature encoder, ranker, local HTTP server
promptlab/static Browser interface
scripts/ Official MIMICS downloader
tests/ Standard-library unit and integration tests
data/raw/ Downloaded source TSVs (ignored)
data/processed/ SQLite database (ignored)
artifacts/ Separate compressed model weights for each experiment (ignored)
The repository uses CodePinion's SSH host on port 2223. Set the remote from the project root:
git remote set-url origin ssh://git@codepinion.co.ke:2223/alexmeta517-754a34e3/prompt-ranking-lab.git
To fetch and merge the remote main branch into your current branch:
git pull --no-rebase origin main
Resolve any marked conflicts, then commit the resolution. To publish local commits:
git push -u origin main
If SSH cannot resolve codepinion.co.ke, the machine cannot reach the repository host through DNS. Restore host/network connectivity before retrying; Git credentials are not checked until the host is reachable.
python3 -m unittest discover -s tests -v
Training and public data are not included in tests. Tests use tiny in-memory TSV fixtures only to verify parsing, split integrity, sparse model training, artifact round trips, endpoint validation, and local UI delivery.
Prompt Ranking Lab - A minimal Python server with SQLite and vanilla HTML/CSS/JS for ranking prompts