News for hackers. Stuff that matters.

MrezaPourreza

Re:Show HN: Natural Language to SQL "Text-to-SQL" API on Thursday February 15, 2024 @11:38AM (#39384842)
Rather than converting the entirety of structured data into unstructured text, we opt to provide the language model with sample rows and the database schema. Utilizing this approach, the LLM is then tasked with generating a SQL query to address the posed question. An alternative strategy, as you've suggested, involves transforming all structured data into textual format and subsequently training an LLM to directly respond to queries. This method, however, presents several challenges:

Linearizing structured data into text risks losing the inherent organization by columns and rows, potentially obfuscating the structured information.

The amount of information encapsulated within large tables poses significant challenges for training or fine-tuning models, attributable to the extensive number of tokens required, which may prove prohibitive for many due to resource constraints.

Re:How to connect OpenAI's Assistant API to your SQL database on Friday November 10, 2023 @12:36PM (#38221817)
Yes, based on what I've experimented with OpenAI's assistants, it still requires engineering and developing tools to get the best performance on large databases.
Re:Fine-tuning GPT-3.5-turbo for natural language to SQL on Thursday August 31, 2023 @09:17PM (#37345630)
Hello, thank you very much for your meticulous comment. The 85.3% accuracy reported in our paper (I'm one of the authors of the DIN-SQL paper) pertains to the test set. However, in the blog post, we are reporting the performance on the development set, which stands at 74.2%.
Re:Fine-tuning GPT-3.5-turbo for natural language to SQL on Thursday August 31, 2023 @03:42PM (#37342678)
Yes, we have already submitted the model for evaluation on the Spider holdout test set. While your suggestion is certainly intriguing, implementing a universal solution could be quite challenging, as it would heavily depend on the specifics of the dataset.
Re:Fine-tuning GPT-3.5-turbo for natural language to SQL on Thursday August 31, 2023 @03:25PM (#37342421)
I believe this article underscores the significance and efficacy of fine-tuning for specific tasks. Looking ahead, I envision the integration of fine-tuned models with RAG agents and models, further enhancing overall performance.
A tutorial on how to fine-tune a GPT3.5 model for Natural Language to SQL tasks and a comparison of its performance vs Retrieval Augmented Generation.

Based on the results, fine-tuning can match and outperform RAG (the approach matches the state of the art on accuracy while being far faster and cheaper). The big challenge for fine-tuning tasks like this is building the training datasets. Things should get even more interesting when GPT-4 is opened for fine-tuning.

Re:Show HN: Dataherald AI – Natural Language to SQL Engine on Thursday August 24, 2023 @01:36PM (#37252031)
Hello, and thank you for your positive feedback on our work with Dataherald.

I'm currently in the process of tidying up the DIN-SQL repository, and I apologize for any inconvenience this may cause :).

Regarding the usage of other Large Language Models (LLMs), we offer support for OpenAI, Anthropic, Google, and Cohere models. However, it's important to note that our testing and optimization efforts have primarily been concentrated on OpenAI models. If you intend to utilize other models, it's advisable to proceed with caution and be mindful of potential variations in performance and behavior.

Re:Show HN: Dataherald AI – Natural Language to SQL Engine on Thursday August 24, 2023 @12:58PM (#37251408)
Thank you for your interest in our work. The schema linking approach employed in our agent significantly differs from the one described in my paper. In the paper, we utilized a method that involved breaking down questions and matching entities with the table schema. However, when dealing with large datasets, the approach outlined in the DIN-SQL paper is no longer feasible, as we cannot feasibly provide all table names and columns within the prompt. As a result, we opted for an alternative method, leveraging table embeddings along with the NL question embedding to facilitate the schema linking process.

Regarding the context store you mentioned, it plays a vital role in our system. We use the context store to retrieve previously verified questions from earlier interactions. This functionality assists the agent in locating the correct tables and columns based on the knowledge gained from past interactions with our system.

Re:Show HN: Dataherald AI – Natural Language to SQL Engine on Thursday August 24, 2023 @09:18AM (#37248399)
For schema matching, we leverage embeddings. We create embeddings for the tables within the database and generate one for the natural language question provided. We then calculate the cosine similarity between these embeddings to determine a relevance score. This score is then forwarded to the agent, which uses it to identify the pertinent tables.

To minimize the token count used by Large Language Models (LLMs), we've designed our tools to handle most of the computational work internally. Consequently, only a small number of tokens are transmitted to the agent. The agent focuses solely on decision-making, while the tools handle the heavy lifting and similarity assessments.

Re:Show HN: Dataherald AI – Natural Language to SQL Engine on Wednesday August 23, 2023 @04:23PM (#37241478)
I'd be delighted to assist you with your inquiries. Indeed, the context store interacts with vector databases to retrieve samples based on vector embeddings and cosine similarity.
Re:Evaluate LLMs Generated SQL on Monday July 10, 2023 @06:06PM (#36673644)
This link contains some methods to get a confidence score for SQL queries.