Skip to content

An incentivized crowd-sourcing platform to train LLM's with Bitcoin. Bitcoin-PAL is our proof of concept.

License

Notifications You must be signed in to change notification settings

ecurrencyhodler/Bitcoin-PAL

Repository files navigation



Bitcoin-PAL

📚 Personal Learning Assistant for Bitcoin


Problem

Where do users go for trusted Bitcoin educational resources? In the ever-changing and evolving world of Bitcoin, false information, distrust, and confusion about complex topics is common. This makes navigating the Bitcoin landscape challenging for many, especially for new users.

Solution

We believe open-source LLMs will develop exponentially faster than closed-source LLMs. In light of this our team created Bitcoin-PAL, a bitcoin focused AI chatbot coupled with an incentivized crowd-sourcing platform to train LLMs with bitcoin.

Using Bitcoin-PAL, bitcoiners can rely on and contribute to trusted and vetted bitcoin documentation rather than query the general internet and GPT models.

Bitcoin-PAL is a proof of concept and was built during the #Ai4ALL Hackathon presented by Bolt.fun, which ran from July 1 - August 1, 2023. The project also were the winners of the Training Track!

Resources

  1. Project Charter and User Stories
  2. Backend Documentation
  3. Project Board
  4. Figma designs
  5. GitHub Actions
  6. Demo Video
  7. Presentation Deck

Demo and Presentation Video

Bitcoin-PAL Demo

Setup

Back End - Console

The backend can be used as a standalone console or a python flask based webservice.

Install and Usage - General

  1. git clone this repo

  2. pip3 install -r requirements.txt - install python dependencies

  3. Then, download the LLM model and place it in a directory of your choice:

    • LLM: default to ggml-gpt4all-j-v1.3-groovy.bin. If you prefer a different GPT4All-J compatible model, just download it and reference it in your .env file.
  4. Copy the example.env template into .env

    cp example.env .env

    and edit the variables appropriately in the .env file.

    MODEL_TYPE: supports LlamaCpp or GPT4All
    PERSIST_DIRECTORY: is the folder you want your vectorstore in
    MODEL_PATH: Path to your GPT4All or LlamaCpp supported LLM
    MODEL_N_CTX: Maximum token limit for the LLM model
    MODEL_N_BATCH: Number of tokens in the prompt that are fed into the model at a time. Optimal value differs a lot depending on the model (8 works well for GPT4All, and 1024 is better for LlamaCpp)
    EMBEDDINGS_MODEL_NAME: SentenceTransformers embeddings model name (see https://www.sbert.net/docs/pretrained_models.html)
    TARGET_SOURCE_CHUNKS: The amount of chunks (sources) that will be used to answer a question
    

    Note: because of the way langchain loads the SentenceTransformers embeddings, the first time you run the script it will require internet connection to download the embeddings model itself.

Usage - Ingestion

To ingest custom documentation the source_documents folder must be populated first and ingestion must be ran.

  1. python3 ingest.py

A console based AI document ingestion tool

Usage - Console

  1. python3 bitcoinPAL.py
  2. Ask your question on the command line

A console based AI chat tool for bitcoin education

Usage - Server

  1. python3 server.py
  2. Ask a question by submitting a curl command with a json payload to localhost:8000 curl -X POST -H "Content-Type: application/json" -d '{"query":"What is bitcoin?"}' http://localhost:8000

A console based curl query to the back end server

Front End - Client

The back end server is required to be running also in order for the front end to talk to API for querying.

Install and Usage - Console

  1. git clone this repo
  2. cd to this repo directory
  3. cd frontend - change directory to the front end
  4. npm install - installs all node modules
  5. npm start- starts front end on localhost:3000
  6. Navigate to http://localhost:3000 and ask your question

Screenshot

A react based front end for querying user input

Standing on the shoulders of giants

In addition to the libraries listed in requirements.txt and npm packages, this project also uses:

Note

This software has no guarantees and was created during a hackathon. All software should be considered beta unless otherwise explicitly specified. The user assumes all risk by executing any code contained in this repository.

License

Bitcoin PAL is released under the terms of the MIT license. See LICENSE for more information or see https://opensource.org/licenses/MIT

About

An incentivized crowd-sourcing platform to train LLM's with Bitcoin. Bitcoin-PAL is our proof of concept.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •