Project Info
This project did not submit a demo video on Devpost.
Inspiration
In the midst of Cal Enrollment and Berkeley college life in general, getting advice on what classes we should take, what spots in Berkeley to explore and what cafe's are the best, are sometimes hard information to come by. Thankfully, the Berkeley Subreddit has tons of Berkeley students just like us, who have their own unique ideas and opinions. The best way to represent all of this information is through language models! This is why we created brOSKI, a chat bot who can be your friend and advisor about all things Berkeley. How We Built it Scrape Reddit. With recent updates Reddit's API no longer permits data scraping, so collecting data from reddit on the scale needed required a unique approach. There is only one comprehensive archive of Reddit's database, "Pushshift." The problem is the archive has been removed from the public by Reddit, so to get the data from Pushshift we had to find an old copy of the database and download it in fragments. Bear in mind, the Pushshift Reddit database contains a recorded history of all of reddit, not just the Berkeley subreddit, meaning we had to grapple with over 20 terabytes of text data, to get the data we needed from the Berkeley subreddit. The smallest fragments the database can be downloaded in is 450GBs. By selectively only downloading posts, not comments we trimmed down the downloaded fragment size to 150GBs. We then filtered the downloaded posts to contain only r/Berkeley posts. Now we also needed the comments for each post, so we queried the API by post ID to collect the comments for the r/Berkeley posts we downloaded. Repeated a few times we managed to download months worth of r/Berkeley data (posts and comments) for usage by our LLM algorithms. Finetune LLM The next step in the process, is to take the scraped and formatted data fine-tune our model of choice. For this project, we decided to use LLaMA 2 13b. We first tested smaller data samples, using both a small amount of epochs and high amount to see the difference in model "sound". We noticed that the model when overfit to the small dataset, became biased and uncensored, answering questions it probably shouldn't. Once we had all our data scraped and formatted correctly, we passed the 3500 lines of Q&A style training data, and chose 2, 4, 6, 8, and 10 epochs. We discovered that mid to low epoch range seems to give the best results for our use case. Front End Initially, we planned to have an opening web page - quite similar to Chat GPT and bing AI with some example inputs along with few animations to make it seem more like iMessages or Instagram Direct Messages. However, due to time constraints, we are leaving that as future work. We designed our front end on Figma and primarily used HTML and CSS for our front end to put things in motion. At the end, we developed an API to connect our back end to the front end.
u/brOSKI
u/brOSKI is a chat bot that attempts to help Berkeley students with everything Cal while trained to sound like the average r/berkeley enjoyer. We accomplish with a dual pronged approach. In order to get the "sound" of a funny berkeley student, I trained LLaMA 2 13b on the r/berkeley subreddit using the together.ai API, and in order to get the knowledge and accuracy of a Cal advisor, LeonShams ustilized prompt engineering and LLama 2 13b to currate our data based on class information, teacher biographies and enrollment information. This way our model could give helpful information to the user. pranavdo implemented the front end, which displays a user interface that interacts with the backend to call LLama 2 12b.
u/brOSKI is finetuned with the help of together.ai, which offers a very easy to use API to train and deploy the model. Unfortunately, the API does not yet support your finetuned models to be used with your local code. So unless you are signed into my account, you cannot YET talk to the finetunened u/brOSKI. Nonetheless, there will be some pictures provided below of some of the funny answers u/brOSKI gave after chating with it for about 10 minutes.
This program was built during CalHacks 2023 so it has only been in development for about 48 hours (as of 10/29/2023). Considering the extremely short time frame, we are extremely happy with the results of our model. All of the code that we used during those 48 hours are provided here in this github. Stay tuned, because we have future visions of expanding the model even more!
Here are some images of just the finetuned model, no contextual analysis is ran here.
Finetuned chat bot, the "brO" side of u/brOSKI
The data we used for this model was about 3500 lines of r/berkeley posts from 2023 formated in Q&A style. Where the title and body are the "question" and the most upvoted comment is the "answer". The model is trained for 6 epochs. There is MUCH MUCH room for improvement here considering our biggest limiting factor was finding and downloading data within the CalHacks time frame. -Note: The data that we curated removes personal user information.
Guide for running context chat bot into a localHost*
Context analysis chat bot, the "u/OSKI" side of u/brOSKI
You need to use your own together.ai API Key to run this program.
Requirements:
pip install together
pip install flask
pip install flask_cors
Step 1> while inside ./CalCompanion run
python api.py
Step 2> open up the index.html fine
Step 3> Chat away!
Analysis
View
Metric
- 5
- 4
- 1
Figures cover GitHub contributors during the hackathon window. A co-authored commit counts in full for each author, so per-member totals add up to more than the whole-team figures.
Technology
- HTMLIn code
- PythonIn code
- JavaScriptClaimed
2 of 3 appear in the indexed code. 1 claimed on Devpost could not be matched to code, which may simply mean the tool leaves no trace in the repository.
AI coding agents
No AI coding agent signals were found in this repository.
Detected from committed agent config files and commit authorship. Absence of a signal is not proof an agent was unused.
Codebase size
Source size
25 KB
Source files
13
Counts recognized source files only; vendored directories, binaries and lockfiles are excluded, so this is smaller than the repository on disk.
Repository
m0zzaR/u-brOSKI
20 files · 1.9 MB · @ b119b8a
Structure
Interface
1 file · 5%Screens, components and styles rendered to the user.
Application logic
14 files · 70%Domain rules, services and shared utilities.
Supporting
Layers are inferred from where files sit in the tree, not from reading the code. A project that names its directories unconventionally will read oddly here — open the file browser to check anything the diagram implies.
Languages
- Python66%
- HTML22%
- Markdown12%
Share of indexed source by file size. Binary and vendored files are excluded.
This project’s features have not been analysed yet.
Export this project's context (description, README, evidence, key source files) to chat with an AI agent elsewhere.