Natural Reasoning Bot π€
A lightweight QA chatbot built using Hugging Face's facebook/natural_questions
dataset and a fine-tuned distilgpt2
model. This project provides a simple Streamlit interface to interact with the model in a clean, animated UI.
β¨ Features
- Reasoning-based natural language answers
- Animated Streamlit UI with gradient layout
- Fine-tuned GPT-style language model
- Clean prompt formatting with context handling
- Ready for deployment on GitHub or Streamlit Cloud
π Example Questions That Work Best
Use questions that require factual understanding, calculation, or reasoning:
Question Example | Why It Works |
---|---|
What is the total work done on an object lifted 5m? | Physics-based factual reasoning |
Why is work zero in circular motion? | Conceptual explanation |
If a car moves 60km/h for 2 hours, what is distance? | Simple arithmetic reasoning |
Avoid vague or one-word questions like "gravity" or "work".
Always format your prompt like this:
### Question: <your question>
### Answer:
π Accuracy Evaluation (Optional)
To evaluate model performance, you can measure accuracy or BLEU/ROUGE scores if using a validation dataset. Here's a simple accuracy graph generation using matplotlib:
import matplotlib.pyplot as plt
# Sample accuracy values per epoch
epochs = [1, 2, 3, 4, 5]
train_acc = [0.52, 0.65, 0.72, 0.78, 0.81]
val_acc = [0.50, 0.63, 0.70, 0.75, 0.79]
plt.plot(epochs, train_acc, label='Train Accuracy', marker='o')
plt.plot(epochs, val_acc, label='Validation Accuracy', marker='x')
plt.xlabel("Epoch")
plt.ylabel("Accuracy")
plt.title("Training vs Validation Accuracy")
plt.legend()
plt.grid(True)
plt.show()
π How to Run
- Install requirements
pip install -r requirements.txt
- Run Streamlit App
streamlit run app.py
π Folder Structure
project/
βββ app.py # Streamlit UI app
βββ model/ # Fine-tuned model directory
βββ utils.py # Utility functions for prompt formatting
βββ requirements.txt # Dependencies
βββ README.md # Project readme
πͺ Credits
- Hugging Face Transformers
- Streamlit
- Dataset:
facebook/natural_questions
- Model:
distilgpt2
For deployment on GitHub/Streamlit Cloud, keep model size small and test on CPU mode.
Made with β€οΈ by [Vardaan Shukla]
Inference Providers
NEW
This model isn't deployed by any Inference Provider.
π
Ask for provider support
Model tree for Vardaan98/Reasoning_model
Base model
distilbert/distilgpt2