markrodrigo/Llama-3.2-3B-Instruct-Spatial-SQL-1.1
The markrodrigo/Llama-3.2-3B-Instruct-Spatial-SQL-1.1 model is a 3.2 billion parameter, instruction-tuned language model developed by Mark Rodrigo. It is specifically fine-tuned for natural language to PostGIS spatial SQL conversion, adapting English questions and coordinate injections into SQL queries. This model excels at generating spatial SQL for geographic functions like area, centroid, buffer, length, and distance calculations. It is built on a QLoRA / Supervised Fine Tuning (SFT) architecture and processes inputs and outputs in meters or WGS 84 coordinates.
Loading preview...
Overview
The markrodrigo/Llama-3.2-3B-Instruct-Spatial-SQL-1.1 is a specialized 3.2 billion parameter model developed by Mark Rodrigo, designed for a narrow use case: converting natural language commands into PostGIS spatial SQL. It leverages a QLoRA / Supervised Fine Tuning (SFT) architecture to achieve this. The model's primary function is to interpret English questions, combined with coordinate prompt injections (e.g., from mapping systems), and output corresponding PostGIS SQL statements.
Key Capabilities
- Natural Language to Spatial SQL: Translates English questions about geographic functions into executable PostGIS SQL.
- Specific Geographic Functions: Supports five core spatial operations:
- Area: Calculates the area of a polygon.
- Centroid: Determines the center point of a polygon.
- Buffer: Creates a buffer zone around a point.
- Length: Measures the length of a line.
- Distance: Computes the distance between two geometries (points, lines, or polygons).
- Coordinate Handling: Processes inputs and outputs in meters or WGS 84 geographic decimal degrees.
- Instruction-Tuned: Optimized for instruction-following, making it suitable for direct query generation.
Good For
- Developers and GIS professionals needing to automate spatial SQL query generation from natural language.
- Integrating natural language interfaces into mapping applications that utilize PostGIS databases.
- Specific tasks involving the calculation of geographic properties like area, distance, and centroids without manual SQL writing.
Training Details
The model was trained with a learning rate of 2e-4 over 5 epochs, using an Adam 8bit optimizer. It achieved a final validation loss of 0.2508, indicating effective learning for its specialized task. The training data was custom synthetic, focusing on the specific spatial SQL use cases.