Skip to content

Few-shot In-context Learning for Knowledge Base Question Answering

License

Notifications You must be signed in to change notification settings

TIGER-AI-Lab/KB-BINDER

Repository files navigation

KB-BINDER

The implementation for paper Few-shot In-context Learning for Knowledge Base Question Answering KBQA-BINDER

Set up

  1. Set up the knowledge base server: Follow Freebase Setup to set up a Virtuoso triplestore service. After starting your virtuoso service, replace the url in sparql_executer.py with your own.
  2. Download GrailQA/WebQSP/GraphQA/MetaQA and other required files from the link and put them under data/.
  3. Install all required libraries:
$ pip install -r requirements.txt

You can download the index file and put it under contriever_fb_relation /freebase_contriever_index/ with this link.

Run Experiments

KB-BINDER:

$ python3 few_shot_kbqa.py --shot_num 40 --temperature 0.3 \
 --api_key [your api key] --engine [engine model name] \
 --train_data_path [your train data path] --eva_data_path [your eva data path] \
 --fb_roles_path [your freebase roles file path] --surface_map_path [your surface map file path]

KB-BINDER-R:

$ python3 few_shot_kbqa.py --shot_num 40 --temperature 0.3 \
 --api_key [your api key] --engine [engine model name] --retrieval \
 --train_data_path [your train data path] --eva_data_path [your eva data path] \
 --fb_roles_path [your freebase roles file path] --surface_map_path [your surface map file path]

As the codex API has been closed, you may use other engine.

About

Few-shot In-context Learning for Knowledge Base Question Answering

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published