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
3 |
+
metrics:
|
4 |
+
- accuracy
|
5 |
---
|
6 |
+
|
7 |
+
<div align="center">
|
8 |
+
|
9 |
+
<a href="https://github.com/netease-youdao/QAnything">
|
10 |
+
<!-- Please provide path to your logo here -->
|
11 |
+
<img src="https://cdn-uploads.huggingface.co/production/uploads/63aa90473453852ef5458cd3/SX_dH-aww0WV7Aa7MTdJm.png" alt="Logo" width="800">
|
12 |
+
</a>
|
13 |
+
</div>
|
14 |
+
|
15 |
+
# **Q**uestion and **A**nswer based on **Anything**
|
16 |
+
|
17 |
+
|
18 |
+
<div alin="center">
|
19 |
+
<p align="center">
|
20 |
+
<a href="https://github.com/netease-youdao/QAnything">Github</a> |
|
21 |
+
<a href="./README.md">English</a> |
|
22 |
+
<a href="./README_zh.md">简体中文</a>
|
23 |
+
</p>
|
24 |
+
</div>
|
25 |
+
|
26 |
+
<div align="center">
|
27 |
+
<a href="https://qanything.ai"><img src="https://img.shields.io/badge/try%20online-qanything.ai-purple"></a>
|
28 |
+
<a href="https://read.youdao.com#/home"><img src="https://img.shields.io/badge/try%20online-read.youdao.com-purple"></a>
|
29 |
+
<a href="./LICENSE"><img src="https://img.shields.io/badge/license-Apache--2.0-yellow"></a>
|
30 |
+
<a href="https://github.com/netease-youdao/QAnything/pulls"><img src="https://img.shields.io/badge/PRs-welcome-red"></a>
|
31 |
+
<a href="https://twitter.com/YDopensource"><img src="https://img.shields.io/badge/follow-%40YDOpenSource-1DA1F2?logo=twitter&style={style}"></a>
|
32 |
+
</div>
|
33 |
+
|
34 |
+
|
35 |
+
<details open="open">
|
36 |
+
<summary>Table of Contents</summary>
|
37 |
+
|
38 |
+
- [What is QAnything](#What-is-QAnything)
|
39 |
+
- [Key features](#Key-features)
|
40 |
+
- [Architecture](#Architecture)
|
41 |
+
- [Getting Started](#getting-started)
|
42 |
+
- [Prerequisites](#prerequisites)
|
43 |
+
- [Installation](#installation)
|
44 |
+
- [Usage](#usage)
|
45 |
+
- [API Document](#API-Document)
|
46 |
+
- [WeChat Group](#WeChat-Group)
|
47 |
+
- [Support](#support)
|
48 |
+
- [License](#license)
|
49 |
+
- [Acknowledgements](#Acknowledgments)
|
50 |
+
|
51 |
+
</details>
|
52 |
+
|
53 |
+
## What is QAnything?
|
54 |
+
**Q**uestion and **A**nswer based on **Anything** (`QAnything`) is a local knowledge base question-answering system designed to support a wide range of file formats and databases, allowing for offline installation and use.
|
55 |
+
|
56 |
+
With `QAnything`, you can simply drop any locally stored file of any format and receive accurate, fast, and reliable answers.
|
57 |
+
|
58 |
+
Currently supported formats include: **PDF, Word (doc/docx), PPT, Markdown, Eml, TXT, Images (jpg, png, etc.), Web links** and more formats coming soon…
|
59 |
+
|
60 |
+
|
61 |
+
### Key features
|
62 |
+
|
63 |
+
- **Data Security**, supports installation and usage with network cable unplugged throughout the process.
|
64 |
+
- **Cross-language QA support**, freely switch between Chinese and English QA, regardless of the language of the document.
|
65 |
+
- **Supports massive data QA**, two-stage retrieval ranking, solving the degradation problem of large-scale data retrieval; the more data, the better the performance.
|
66 |
+
- **High-performance production-grade system**, directly deployable for enterprise applications.
|
67 |
+
- **User-friendly**, no need for cumbersome configurations, one-click installation and deployment, ready to use.
|
68 |
+
- **Multi knowledge base QA** Support selecting multiple knowledge bases for Q&A
|
69 |
+
|
70 |
+
### Architecture
|
71 |
+
<div align="center">
|
72 |
+
<img src="https://cdn-uploads.huggingface.co/production/uploads/63aa90473453852ef5458cd3/KDeEwzOcI_EUd1-k860k9.png" width = "700" alt="qanything_system" align=center />
|
73 |
+
</div>
|
74 |
+
|
75 |
+
#### Why 2 stage retrieval?
|
76 |
+
In scenarios with a large volume of knowledge base data, the advantages of a two-stage approach are very clear. If only a first-stage embedding retrieval is used, there will be a problem of retrieval degradation as the data volume increases, as indicated by the green line in the following graph. However, after the second-stage reranking, there can be a stable increase in accuracy, **the more data, the better the performance**.
|
77 |
+
<div align="center">
|
78 |
+
<img src="https://cdn-uploads.huggingface.co/production/uploads/63aa90473453852ef5458cd3/lmXhf9sM3q0o7Y-BZsqOW.jpeg" width = "500" alt="two stage retrievaal" align=center />
|
79 |
+
</div>
|
80 |
+
</br>
|
81 |
+
|
82 |
+
QAnything uses the retrieval component [BCEmbedding](https://github.com/netease-youdao/BCEmbedding), which is distinguished for its bilingual and crosslingual proficiency. BCEmbedding excels in bridging Chinese and English linguistic gaps, which achieves
|
83 |
+
- **A high performence on <a href="https://github.com/netease-youdao/BCEmbedding/tree/master?tab=readme-ov-file#evaluate-semantic-representation-by-mteb" target="_Self">Semantic Representation Evaluations in MTEB</a>**;
|
84 |
+
- **A new benchmark in the realm of <a href="https://github.com/netease-youdao/BCEmbedding/tree/master?tab=readme-ov-file#evaluate-rag-by-llamaindex" target="_Self">RAG Evaluations in LlamaIndex</a>**.
|
85 |
+
|
86 |
+
|
87 |
+
#### 1st Retrieval(embedding)
|
88 |
+
| Model | Retrieval | STS | PairClassification | Classification | Reranking | Clustering | Avg |
|
89 |
+
|:-------------------------------|:--------:|:--------:|:--------:|:--------:|:--------:|:--------:|:--------:|
|
90 |
+
| bge-base-en-v1.5 | 37.14 | 55.06 | 75.45 | 59.73 | 43.05 | 37.74 | 47.20 |
|
91 |
+
| bge-base-zh-v1.5 | 47.60 | 63.72 | 77.40 | 63.38 | 54.85 | 32.56 | 53.60 |
|
92 |
+
| bge-large-en-v1.5 | 37.15 | 54.09 | 75.00 | 59.24 | 42.68 | 37.32 | 46.82 |
|
93 |
+
| bge-large-zh-v1.5 | 47.54 | 64.73 | **79.14** | 64.19 | 55.88 | 33.26 | 54.21 |
|
94 |
+
| jina-embeddings-v2-base-en | 31.58 | 54.28 | 74.84 | 58.42 | 41.16 | 34.67 | 44.29 |
|
95 |
+
| m3e-base | 46.29 | 63.93 | 71.84 | 64.08 | 52.38 | 37.84 | 53.54 |
|
96 |
+
| m3e-large | 34.85 | 59.74 | 67.69 | 60.07 | 48.99 | 31.62 | 46.78 |
|
97 |
+
| ***bce-embedding-base_v1*** | **57.60** | **65.73** | 74.96 | **69.00** | **57.29** | **38.95** | ***59.43*** |
|
98 |
+
|
99 |
+
- More evaluation details please check [Embedding Models Evaluation Summary](https://github.com/netease-youdao/BCEmbedding/blob/master/Docs/EvaluationSummary/embedding_eval_summary.md)。
|
100 |
+
|
101 |
+
#### 2nd Retrieval(rerank)
|
102 |
+
| Model | Reranking | Avg |
|
103 |
+
|:-------------------------------|:--------:|:--------:|
|
104 |
+
| bge-reranker-base | 57.78 | 57.78 |
|
105 |
+
| bge-reranker-large | 59.69 | 59.69 |
|
106 |
+
| ***bce-reranker-base_v1*** | **60.06** | ***60.06*** |
|
107 |
+
|
108 |
+
- More evaluation details please check [Reranker Models Evaluation Summary](https://github.com/netease-youdao/BCEmbedding/blob/master/Docs/EvaluationSummary/reranker_eval_summary.md)
|
109 |
+
|
110 |
+
#### RAG Evaluations in LlamaIndex(embedding and rerank)
|
111 |
+
|
112 |
+
<div align="center">
|
113 |
+
<img src="https://cdn-uploads.huggingface.co/production/uploads/63aa90473453852ef5458cd3/vs-dxcGpjzVQileTd1JOO.jpeg" width = "800" alt="rag evaluation in llamaindex" align=center />
|
114 |
+
</div>
|
115 |
+
|
116 |
+
***NOTE:***
|
117 |
+
|
118 |
+
- In `WithoutReranker` setting, our `bce-embedding-base_v1` outperforms all the other embedding models.
|
119 |
+
- With fixing the embedding model, our `bce-reranker-base_v1` achieves the best performence.
|
120 |
+
- **The combination of `bce-embedding-base_v1` and `bce-reranker-base_v1` is SOTA**.
|
121 |
+
- If you want to use embedding and rerank separately, please refer to [BCEmbedding](https://github.com/netease-youdao/BCEmbedding)
|
122 |
+
|
123 |
+
#### LLM
|
124 |
+
|
125 |
+
The open source version of QAnything is based on QwenLM and has been fine-tuned on a large number of professional question-answering datasets. It greatly enhances the ability of question-answering.
|
126 |
+
If you need to use it for commercial purposes, please follow the license of QwenLM. For more details, please refer to: [QwenLM](https://github.com/QwenLM/Qwen)
|
127 |
+
|
128 |
+
|
129 |
+
## Getting Started
|
130 |
+
[👉try QAnything online](https://qanything.ai)
|
131 |
+
### Prerequisites
|
132 |
+
|
133 |
+
| **Required item** | **Minimum Requirement** | **Note** |
|
134 |
+
| -------------- | ------------------------- | --------------------------------- |
|
135 |
+
| NVIDIA GPU Memory | >= 16GB | NVIDIA 3090 recommended |
|
136 |
+
| NVIDIA Driver Version | >= 525.105.17 | |
|
137 |
+
| CUDA Version | >= 12.0 | |
|
138 |
+
| docker compose version| >=1.27.4 | [docker compose install](https://docs.docker.com/compose/install/)|
|
139 |
+
|
140 |
+
|
141 |
+
|
142 |
+
### Installation
|
143 |
+
#### step1: pull qanything repository
|
144 |
+
```
|
145 |
+
git clone https://github.com/netease-youdao/QAnything.git
|
146 |
+
```
|
147 |
+
#### step2: download the model and unzip it to the root directory of the current project.
|
148 |
+
```
|
149 |
+
cd QAnything
|
150 |
+
git lfs install
|
151 |
+
git clone https://www.modelscope.cn/netease-youdao/qanything_models.git
|
152 |
+
|
153 |
+
unzip qanything_models/models.zip # in root directory of the current project
|
154 |
+
```
|
155 |
+
#### step3: change config
|
156 |
+
in the Windows system
|
157 |
+
```
|
158 |
+
vim docker-compose-windows.yaml # change CUDA_VISIBLE_DEVICES to your gpu device id
|
159 |
+
|
160 |
+
```
|
161 |
+
in the Linux system
|
162 |
+
```
|
163 |
+
vim docker-compose-linux.yaml # change CUDA_VISIBLE_DEVICES to your gpu device id
|
164 |
+
```
|
165 |
+
#### step4: start server
|
166 |
+
in the Windows system
|
167 |
+
```
|
168 |
+
docker-compose -f docker-compose-windows.yaml up -d
|
169 |
+
```
|
170 |
+
in the Linux system
|
171 |
+
```
|
172 |
+
docker-compose -f docker-compose-linux.yaml up -d
|
173 |
+
```
|
174 |
+
|
175 |
+
After successful installation, you can experience the application by entering the following addresses in your web browser.
|
176 |
+
|
177 |
+
- Frontend address: http://{your_host}:5052/qanything
|
178 |
+
|
179 |
+
- API address: http://{your_host}:5052/api/
|
180 |
+
|
181 |
+
For detailed API documentation, please refer to [QAnything API 文档](docs/API.md)
|
182 |
+
|
183 |
+
|
184 |
+
## Usage
|
185 |
+
|
186 |
+
### Cross-lingual: Multiple English paper Q&A
|
187 |
+
<div align="center">
|
188 |
+
<video controls autoplay src="https://cdn-uploads.huggingface.co/production/uploads/63aa90473453852ef5458cd3/Iz-Tp5DCb1cpwjGZKei05.mp4" width = "800" alt="multi English paper" align=center></video>
|
189 |
+
</div>
|
190 |
+
|
191 |
+
### Information extraction
|
192 |
+
<div align="center">
|
193 |
+
<video controls autoplay src="https://cdn-uploads.huggingface.co/production/uploads/63aa90473453852ef5458cd3/KBXAReIo_fYyV9hsQXCm_.mp4" width = "800" alt="information extraction" align=center></video>
|
194 |
+
</div>
|
195 |
+
|
196 |
+
### Various files
|
197 |
+
<div align="center">
|
198 |
+
<video controls autoplay src="https://cdn-uploads.huggingface.co/production/uploads/63aa90473453852ef5458cd3/KoX1g-lWJEtZpiD2ItOnw.mp4" width = "800" alt="various files" align=center></video>
|
199 |
+
</div>
|
200 |
+
|
201 |
+
### Web Q&A
|
202 |
+
<div align="center">
|
203 |
+
<video controls autoplay src="https://cdn-uploads.huggingface.co/production/uploads/63aa90473453852ef5458cd3/_Uijrg055LlChJykjnC37.mp4" width = "800" alt="web qa" align=center></video>
|
204 |
+
</div>
|
205 |
+
|
206 |
+
### API Document
|
207 |
+
If you need to access the API, please refer to the [QAnything API documentation](docs/API.md).
|
208 |
+
|
209 |
+
## WeChat Group
|
210 |
+
|
211 |
+
Welcome to scan the QR code below and join the WeChat group.
|
212 |
+
|
213 |
+
<img src="https://cdn-uploads.huggingface.co/production/uploads/63aa90473453852ef5458cd3/7rfhUkkgwIJwSu903ZZvo.jpeg" width="20%" height="auto">
|
214 |
+
|
215 |
+
## Support
|
216 |
+
Reach out to the maintainer at one of the following places:
|
217 |
+
|
218 |
+
- [Github issues](https://github.com/netease-youdao/QAnything/issues)
|
219 |
+
- Contact options listed on [this GitHub profile](https://github.com/netease-youdao)
|
220 |
+
|
221 |
+
## License
|
222 |
+
|
223 |
+
`QAnything` is licensed under [Apache 2.0 License](./LICENSE)
|
224 |
+
|
225 |
+
## Acknowledgments
|
226 |
+
`QAnything` adopts dependencies from the following:
|
227 |
+
- Thanks to our [BCEmbedding](https://github.com/netease-youdao/BCEmbedding) for the excellent embedding and rerank model.
|
228 |
+
- Thanks to [Qwen](https://github.com/QwenLM/Qwen) for strong base language models.
|
229 |
+
- Thanks to [Triton Inference Server](https://github.com/triton-inference-server/server) for providing great open source inference serving.
|
230 |
+
- Thanks to [FasterTransformer](https://github.com/NVIDIA/FasterTransformer) for highly optimized LLM inference backend.
|
231 |
+
- Thanks to [Langchain](https://github.com/langchain-ai/langchain) for the wonderful llm application framework.
|
232 |
+
- Thanks to [Langchain-Chatchat](https://github.com/chatchat-space/Langchain-Chatchat) for the inspiration provided on local knowledge base Q&A.
|
233 |
+
- Thanks to [Milvus](https://github.com/milvus-io/milvus) for the excellent semantic search library.
|
234 |
+
- Thanks to [PaddleOCR](https://github.com/PaddlePaddle/PaddleOCR) for its ease-to-use OCR library.
|
235 |
+
- Thanks to [Sanic](https://github.com/sanic-org/sanic) for the powerful web service framework.
|