https://github.com/tiger-ai-lab/kb-binder
"Few-shot In-context Learning for Knowledge Base Question Answering" [ACL2023]
https://github.com/tiger-ai-lab/kb-binder
Last synced: about 1 year ago
JSON representation
"Few-shot In-context Learning for Knowledge Base Question Answering" [ACL2023]
- Host: GitHub
- URL: https://github.com/tiger-ai-lab/kb-binder
- Owner: TIGER-AI-Lab
- License: mit
- Created: 2023-05-04T01:29:30.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2025-01-27T03:47:10.000Z (over 1 year ago)
- Last Synced: 2025-01-27T04:25:42.142Z (over 1 year ago)
- Language: Python
- Homepage:
- Size: 1.66 MB
- Stars: 60
- Watchers: 6
- Forks: 8
- Open Issues: 6
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# KB-BINDER
The implementation for ACL2023 paper [Few-shot In-context Learning for Knowledge Base Question Answering](http://arxiv.org/abs/2305.01750)

## Set up
1. Set up the knowledge base server: Follow [Freebase Setup](https://github.com/dki-lab/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](https://drive.google.com/drive/folders/1g8ZpMLSw95KwjisXEw07rVVC3TJ1LZdn?usp=sharing) 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](https://drive.google.com/file/d/1hnyW-_k0YaAUZDTdYzhbKDTnFuLEW-W2/view?usp=sharing).
## 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.