Thesis Methodology Prototype
A focused research demonstration for Verification-Informed Weighted Fine-Tuning for Misconception-Resistant Claim Classification.
It compares Condition A (uniform cross-entropy) with Condition D (combined verification, TF-IDF rarity, and dynamic difficulty weighting). It is intentionally presented as a research prototype, not a deployment-ready fact checker.
Stack
- React + Vite + TypeScript
- FastAPI
- PyTorch + Hugging Face Transformers
- One Docker image for Hugging Face Spaces
Add the checkpoints
Copy matching FEVER 1:10 checkpoints from the same seed into:
artifacts/models/condition_a/artifacts/models/condition_d/
Each directory should contain config.json, model weights (model.safetensors or pytorch_model.bin), and tokenizer files. Confirm that labels map 0/1/2 to SUPPORTS/REFUTES/NOT ENOUGH INFO. Seed 123 is recommended, but keeping A and D on the same seed is the essential requirement.
The app never generates proxy or mock predictions. Until both checkpoints are ready, the interface explicitly runs in results-only mode.
Local development
Backend:
cd backend
python -m venv .venv
.\.venv\Scripts\Activate.ps1
pip install -r requirements-local.txt
uvicorn app.main:app --reload --port 8000
Frontend, in another terminal:
cd frontend
npm install
npm run dev
Open http://localhost:5173.
Hugging Face Space
Create a Docker Space and upload this folder. The included Dockerfile builds the frontend and serves it with the FastAPI backend on port 7860. The two checkpoint files total about 1.42 GB. Use the hf upload CLI, which handles large files automatically, or install Git Xet when pushing with Git.
API
GET /api/healthGET /api/statusGET /api/findingsPOST /api/predict
Exact Hugging Face Spaces setup
- Create or sign in to a Hugging Face account.
- Open Spaces β Create new Space.
- Choose:
- SDK: Docker
- Visibility: Public for a shareable defense URL, or Private while testing
- Hardware: CPU Basic initially; CPU Upgrade is recommended for defense-day responsiveness
- Install the official CLI on Windows:
powershell -ExecutionPolicy ByPass -c "irm https://hf.co/cli/install.ps1 | iex"
hf auth login
- From this prototype folder, upload the complete folder. Replace the repository ID below:
hf upload-large-folder YOUR_USERNAME/YOUR_SPACE_NAME . --repo-type space
The upload includes approximately 1.42 GB of model weights and can resume if interrupted. The YAML header at the top of this README already sets sdk: docker and app_port: 7860.
No Space secret or API token is required by the running application because both checkpoints are stored in the Space repository. The login token is only used locally to upload the files.
After the build reaches Running:
- Open
/api/statuson the Space URL and confirmmodels_readyistrue. - Open the main interface.
- Select False endorsement corrected.
- Run the comparison and confirm Condition A predicts SUPPORTS while Condition D predicts REFUTES.
- Keep the Space open and run one example before the defense. Free hardware sleeps after inactivity and must reload both checkpoints after waking.
The free CPU Basic environment has enough memory for these two models, but CPU Upgrade is the better short-term defense setting because it provides more CPU cores. A GPU is not required for this prototype.