Awesome-Text2SQL/README.zh.md

112 lines
8.6 KiB
Markdown
Raw Normal View History

2023-09-06 10:53:18 +08:00
# **Awesome Text2SQL**🎉🎉🎉
[![GitHub Repo stars](https://img.shields.io/github/stars/eosphoros-ai/Awesome-Text2SQL?style=social)](https://github.com/eosphoros-ai/Awesome-Text2SQL/)
[![GitHub Repo forks](https://img.shields.io/github/forks/eosphoros-ai/Awesome-Text2SQL?style=social)](https://github.com/eosphoros-ai/Awesome-Text2SQL/)
[![Awesome](https://camo.githubusercontent.com/64f8905651212a80869afbecbf0a9c52a5d1e70beab750dea40a994fa9a9f3c6/68747470733a2f2f617765736f6d652e72652f62616467652e737667)](https://github.com/eosphoros-ai/Awesome-Text2SQL/)
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](https://opensource.org/licenses/MIT)
![](https://img.shields.io/github/last-commit/eosphoros-ai/Awesome-Text2SQL?color=green)
[**English**](README.md) | **中文版**
这里收集了针对大型语言模型、Text2SQL 等的精选教程和资源。
## 📜 目录
- [👋 简介](#-简介)
- [📖 综述](#-综述)
- [🔥 基础模型](#-基础模型)
- [💡 微调](#-微调)
- [💪 数据集](#-数据集)
- [🌈 评测指标](#-评测指标)
- [🔧 实践项目](#-实践项目)
- [🤝 友情链接](#-友情链接)
## 👋 简介
- Text-to-SQL或者Text2SQL顾名思义就是把文本转化为SQL语言更学术一点的定义是把数据库领域下的自然语言Natural LanguageNL问题转化为在关系型数据库中可以执行的结构化询语言Structured Query LanguageSQL因此Text-to-SQL也可以被简写为NL2SQL。
- 输入:自然语言问题,比如“*查询表t_user的相关信息结果按id降序排序只保留前10个数据*”
- 输出SQL比如“*SELECT * FROM t_user ORDER BY id DESC LIMIT 10*
## 📖 综述
- (2023-International Conference on Very Large Data Bases, VLDB, CCF-AA survey on deep learning approaches for text-to-SQL [[paper](https://link.springer.com/article/10.1007/s00778-022-00776-8)]
- (2022-IEEE Transactions on Knowledge and Data Engineering, TKDE, CCF-A) A Survey on Text-to-SQL Parsing: Concepts, Methods, and Future Directions [[paper](https://arxiv.org/pdf/2208.13629.pdf)]
- (2022-International Conference on Computational Linguistics, COLOING, CCF-B) Recent Advances in Text-to-SQL: A Survey of What We Have and What We Expect [[paper](https://arxiv.org/pdf/2208.10099v1.pdf)]
- (2022-arXiv)Deep Learning Driven Natural Languages Text to SQL Query Conversion: A Survey [[paper](https://arxiv.org/pdf/2208.04415.pdf)]
## 🔥 基础模型
- Llama [[paper](https://arxiv.org/pdf/2302.13971.pdf)] [[code](https://github.com/facebookresearch/llama)] [[model](https://huggingface.co/meta-llama)]
- 2023年2月Meta AI提出开源大模型Llama有7b、13b、33b、65b共4种规模。
- Alpaca [[paper](https://crfm.stanford.edu/2023/03/13/alpaca.html)] [[code](https://github.com/lm-sys/FastChat)] [[model](https://huggingface.co/lmsys)]
- 2023年3月斯坦福大学提出基于Llama 7b模型微调的开源大模型Alpaca有7b共1种规格训练更简单和便宜。
- Vicuna [[paper](https://lmsys.org/blog/2023-03-30-vicuna/)] [[code](https://github.com/tatsu-lab/stanford_alpaca)] [[model](https://github.com/tatsu-lab/stanford_alpaca)]
- 2023年3月UC伯克利大学联合CMU、斯坦福大学提出的开源大模型Vicuna有7b、13b共2种规格。
- WizardLM [[paper](https://arxiv.org/pdf/2304.12244.pdf)] [[code](https://github.com/nlpxucan/WizardLM)] [[model](https://huggingface.co/WizardLM)]
- 2023年4月北京大学和微软提出进化指令大模型WizardLM有7b、13b、30b共3种规格2023年6月提出了数学领域的大模型WizardMath2023年8月提出了代码领域的大模型WizardCoder。
- Llama 2 [[paper](https://ai.meta.com/research/publications/llama-2-open-foundation-and-fine-tuned-chat-models/)] [[code](https://github.com/facebookresearch/llama)] [[model](https://huggingface.co/meta-llama)]
- 2023年7月Meta AI提出第二代Llama系列开源大模型Llama 2和Llama 1相比训练数据多40%上下文长度翻倍模型有7b、13b、34b、70b共4种规格但是34b没有开源。
- Code LLama [[paper](https://arxiv.org/pdf/2308.12950.pdf)] [[code](https://github.com/facebookresearch/codellama)] [[model](https://huggingface.co/codellama)]
- 2023年8月Meta AI 在 Llama 2 的基础上提出 Code LLama。Code Llama 在多个代码基准测试中达到了开放模型中最先进的性能。有基础模型 (Code Llama)、Python 专业化 (Code Llama - Python) 和指令跟踪模型instruction-following models每个模型都有 7B、13B 和 34B 参数。
## 💡 微调
- P-Tuning [[paper](https://arxiv.org/pdf/2103.10385.pdf)] [[code](https://github.com/THUDM/P-tuning)]
- 2021年3月清华大学等提出了针对大模型微调方法P-Tuning采用可训练的连续提示词嵌入降低了微调成本。
- LoRA [[paper](https://arxiv.org/pdf/2106.09685.pdf)] [[code](https://github.com/microsoft/LoRA)]
- 2021年6月微软提出的针对大模型微调的Low-Rank AdaptationLoRA方法冻结预训练权重。
- P-Tuning V2 [[paper](https://arxiv.org/pdf/2110.07602.pdf)] [[code](https://github.com/THUDM/P-tuning-v2)]
- 2021年10月清华大学提出了P-Tuning的改进版本P-Tuning V2性能更优。
- RLHF [[paper](https://huggingface.co/blog/rlhf)] [[code](https://github.com/huggingface/blog/blob/main/zh/rlhf.md)]
- 2022年12月OpenAI使用RLHF方法训练ChatGPT利用人类反馈信号直接优化语言模型表现优异。
- QLoRA [[paper](https://arxiv.org/pdf/2305.14314.pdf)] [[code](https://github.com/artidoro/qlora)]
- 2023年5月华盛顿大学基于冻结的4bit量化模型结合LoRA方法训练进一步降低了微调门槛。
## 💪 数据集
- WikiSQL [[paper](https://arxiv.org/pdf/1709.00103.pdf)] [[code](https://github.com/salesforce/WikiSQL)] [[dataset](https://github.com/salesforce/WikiSQL)]
- 2017年9月Salesforce提出的一个大型的Text-to-SQL数据集数据来源于Wikipedia属于单领域包含了80654个自然语言问题77840个SQL语句SQL语句形式比较简单不包含排序、分组、子查询等复杂操作。
- Spider [[paper](https://arxiv.org/pdf/1809.08887.pdf)] [[code](https://github.com/taoyds/spider))] [[dataset](https://yale-lily.github.io/spider)]
- 2018年9月耶鲁大学提出的多数据库、多表、单轮查询的Text-to-SQL数据集也是业界公认难度最大的大规模跨领域评测榜单包含了10181个自然语言问题5693个SQL语句涉及138个不同领域的200多个数据库难易程度分为简单、中等、困难、特别困难。
- CHASE [[paper](https://aclanthology.org/2021.acl-long.180.pdf)] [[code](https://github.com/xjtu-intsoft/chase))] [[dataset](https://github.com/xjtu-intsoft/chase/tree/page/data)]
- 2021年西安交通大学和微软等提出了首个跨领域、多轮Text-to-SQL中文数据集包含了5459个多轮问题组成的列表17940个<query, SQL>二元组。
## 🌈 评测指标
- Execution Accuracy (EX) [[paper](https://arxiv.org/pdf/2208.13629.pdf)]
- 定义计算SQL执行结果正确的数量在数据集中的比例结果存在高估的可能。
- Exact Match (EM) [[paper](https://arxiv.org/pdf/2208.13629.pdf)]
- 定义计算模型生成的SQL和标注SQL的匹配程度结果存在低估的可能。
## 🔧 实践项目
- [DB-GPT-Hub](https://github.com/eosphoros-ai/DB-GPT-Hub)
- eosphoros组织提出的专注于大模型Text-to-SQL微调的开源项目包含了大模型下载、数据集预处理、LoRA和QLoRA等微调技术、模型预测、模型评估等步骤。
- [sqlcoder](https://github.com/defog-ai/sqlcoder)
- Defog组织提出的先进的Text-to-SQL的大模型表现亮眼效果优于GPT3.5、wizardcoder和starcoder等仅次于GPT4。
- [modal_finetune_sql](https://github.com/run-llama/modal_finetune_sql)
- 项目基于LLaMa 2 7b模型进行Text-to-SQL微调有完整的训练、微调、评估流程。
## 🤝 友情链接
- [eosphoros](https://github.com/eosphoros-ai)
- 他们是一支由来自互联网公司的技术爱好者和热衷于开源项目的NLP研究生组成的团队。他们的重点是开发保护数据库和大型语言模型的隐私和安全的解决方案。他们的目标是确保这些模型的能力保持绝对私密、安全和受控。
- [Awesome-AIGC-Tutorials](https://github.com/luban-agi/Awesome-AIGC-Tutorials)
- Awesome AIGC Tutorials 包含一系列精选的教程和资源涵盖大型语言模型、AI 绘画和相关领域。探索适合初学者和高级人工智能爱好者的深入见解和知识。