4 ms·
> Thus, you may expect that effective prompting for Text-to-SQL should include structured schema definitions; indeed. I found that the simpler the better, when
by l5870uoo9y 2y ago
> Thus, you may expect that effective prompting for Text-to-SQL should include structured schema definitions; indeed.
I found that the simpler the better, when testing lots of different SQL schema formats on https://www.sqlai.ai/ https://www.sqlai.ai/. CSV (table name, table column, data type) outperformed both a JSON formatted and SQL schema dump. And not to mention consumed fewer tokens.
If you need the database schema in a consistent format (e.g. CSV) just have LLM extract data and convert whatever the user provides into CSV. It shines at this.
- FrostKiwi 2y agoInteresting, thanks for sharing! I was wondering about this. When starting out with feeding Tabular data, I instinctively went with CSV, but always worried: What if there is a better choice? What if longer tables, the LLMs forgets the column order?
- firejake308 2y agoThat's exactly what happened to me when I tried to get the open-source models to extract a CSV from textual data with a lot of yes/no fields; i.e., the model forgot the column order and started confusing the cell values. I found I had to use more powerful models like Mistral Large or ChatGPT. So I think that is a valid thing to worry about with smaller models, but maybe less of a concern with larger ones.
- a_bonobo 2y agoHave you ever figured out a way to annotate the CSV columns to the model? Or do you write a long prefix explaining the columns? I found that similarly-named columns easily confused GPTs