243 lines
9.8 KiB
Markdown
243 lines
9.8 KiB
Markdown
---
|
||
license: apache-2.0
|
||
language:
|
||
- en
|
||
tags:
|
||
- text-to-sql
|
||
- code
|
||
- sql
|
||
- fine-tuned
|
||
- unsloth
|
||
- lora
|
||
base_model: Snowflake/Arctic-Text2SQL-R1-7B
|
||
---
|
||
|
||
# Snowflake/Arctic-Text2SQL-R1-7B Fine-tuned for NL2SQL++ v5.8_rl_cold_start
|
||
|
||
This model is a fine-tuned version of [Snowflake/Arctic-Text2SQL-R1-7B](https://huggingface.co/Snowflake/Arctic-Text2SQL-R1-7B) on the NL2SQL++ v5.8_rl_cold_start dataset with code-with-thought reasoning.
|
||
|
||
## Model Details
|
||
|
||
- **Base Model**: Snowflake/Arctic-Text2SQL-R1-7B
|
||
- **Task**: Text-to-SQL generation
|
||
- **Dataset**: NL2SQL++ v5.8_rl_cold_start with code-with-thought reasoning
|
||
- **Fine-tuning Method**: LoRA (Low-Rank Adaptation) with Unsloth
|
||
- **Quantization**: 16-bit merged weights
|
||
- **Training Dataset Size**: 2104 examples
|
||
- **Validation Dataset Size**: 0 examples
|
||
|
||
## Training Configuration
|
||
|
||
- **output_dir**: ./saved_models
|
||
- **per_device_train_batch_size**: 2
|
||
- **num_train_epochs**: 3
|
||
- **max_steps**: -1
|
||
- **learning_rate**: 1e-05
|
||
- **lr_scheduler_type**: SchedulerType.COSINE
|
||
- **lr_scheduler_kwargs**: None
|
||
- **warmup_steps**: 0.1
|
||
- **optim**: OptimizerNames.ADAMW_TORCH_FUSED
|
||
- **optim_args**: None
|
||
- **weight_decay**: 0.01
|
||
- **adam_beta1**: 0.9
|
||
- **adam_beta2**: 0.999
|
||
- **adam_epsilon**: 1e-08
|
||
- **optim_target_modules**: None
|
||
- **gradient_accumulation_steps**: 8
|
||
- **average_tokens_across_devices**: True
|
||
- **max_grad_norm**: 1.0
|
||
- **label_smoothing_factor**: 0.0
|
||
- **bf16**: True
|
||
- **fp16**: False
|
||
- **bf16_full_eval**: True
|
||
- **fp16_full_eval**: False
|
||
- **tf32**: None
|
||
- **gradient_checkpointing**: True
|
||
- **gradient_checkpointing_kwargs**: None
|
||
- **torch_compile**: False
|
||
- **torch_compile_backend**: None
|
||
- **torch_compile_mode**: None
|
||
- **use_liger_kernel**: False
|
||
- **liger_kernel_config**: None
|
||
- **use_cache**: False
|
||
- **neftune_noise_alpha**: None
|
||
- **torch_empty_cache_steps**: None
|
||
- **auto_find_batch_size**: False
|
||
- **logging_strategy**: IntervalStrategy.STEPS
|
||
- **logging_steps**: 3
|
||
- **logging_first_step**: False
|
||
- **log_on_each_node**: True
|
||
- **logging_nan_inf_filter**: True
|
||
- **include_num_input_tokens_seen**: no
|
||
- **log_level**: passive
|
||
- **log_level_replica**: warning
|
||
- **disable_tqdm**: False
|
||
- **report_to**: ['wandb']
|
||
- **run_name**: None
|
||
- **project**: huggingface
|
||
- **trackio_space_id**: trackio
|
||
- **eval_strategy**: IntervalStrategy.STEPS
|
||
- **eval_steps**: 50
|
||
- **eval_delay**: 0
|
||
- **per_device_eval_batch_size**: 5
|
||
- **prediction_loss_only**: False
|
||
- **eval_on_start**: False
|
||
- **eval_do_concat_batches**: True
|
||
- **eval_use_gather_object**: False
|
||
- **eval_accumulation_steps**: 10
|
||
- **include_for_metrics**: []
|
||
- **batch_eval_metrics**: False
|
||
- **save_only_model**: False
|
||
- **save_strategy**: SaveStrategy.BEST
|
||
- **save_steps**: 50
|
||
- **save_on_each_node**: False
|
||
- **save_total_limit**: 1
|
||
- **enable_jit_checkpoint**: False
|
||
- **push_to_hub**: False
|
||
- **hub_token**: None
|
||
- **hub_private_repo**: None
|
||
- **hub_model_id**: None
|
||
- **hub_strategy**: HubStrategy.EVERY_SAVE
|
||
- **hub_always_push**: False
|
||
- **hub_revision**: None
|
||
- **load_best_model_at_end**: True
|
||
- **metric_for_best_model**: eval_exec_accuracy
|
||
- **greater_is_better**: True
|
||
- **ignore_data_skip**: False
|
||
- **restore_callback_states_from_checkpoint**: False
|
||
- **full_determinism**: False
|
||
- **seed**: 42
|
||
- **data_seed**: None
|
||
- **use_cpu**: False
|
||
- **accelerator_config**: AcceleratorConfig(split_batches=False, dispatch_batches=None, even_batches=True, use_seedable_sampler=True, non_blocking=False, gradient_accumulation_kwargs=None, use_configured_state=False)
|
||
- **parallelism_config**: None
|
||
- **dataloader_drop_last**: False
|
||
- **dataloader_num_workers**: 0
|
||
- **dataloader_pin_memory**: True
|
||
- **dataloader_persistent_workers**: False
|
||
- **dataloader_prefetch_factor**: None
|
||
- **remove_unused_columns**: True
|
||
- **label_names**: None
|
||
- **train_sampling_strategy**: random
|
||
- **length_column_name**: length
|
||
- **ddp_find_unused_parameters**: None
|
||
- **ddp_bucket_cap_mb**: None
|
||
- **ddp_broadcast_buffers**: None
|
||
- **ddp_backend**: None
|
||
- **ddp_timeout**: 1800
|
||
- **fsdp**: []
|
||
- **fsdp_config**: {'min_num_params': 0, 'xla': False, 'xla_fsdp_v2': False, 'xla_fsdp_grad_ckpt': False}
|
||
- **deepspeed**: None
|
||
- **debug**: []
|
||
- **skip_memory_metrics**: True
|
||
- **do_train**: False
|
||
- **do_eval**: True
|
||
- **do_predict**: False
|
||
- **resume_from_checkpoint**: None
|
||
- **warmup_ratio**: 0.1
|
||
- **logging_dir**: None
|
||
- **local_rank**: -1
|
||
- **model_init_kwargs**: None
|
||
- **chat_template_path**: None
|
||
- **dataset_text_field**: text
|
||
- **dataset_kwargs**: None
|
||
- **dataset_num_proc**: None
|
||
- **eos_token**: None
|
||
- **pad_token**: None
|
||
- **max_length**: 26000
|
||
- **packing**: False
|
||
- **packing_strategy**: bfd
|
||
- **padding_free**: False
|
||
- **pad_to_multiple_of**: None
|
||
- **eval_packing**: None
|
||
- **completion_only_loss**: None
|
||
- **assistant_only_loss**: False
|
||
- **loss_type**: nll
|
||
- **activation_offloading**: False
|
||
- **vllm_sampling_params**: None
|
||
- **unsloth_num_chunks**: -1
|
||
- **unsloth_logit_chunk_multiplier**: None
|
||
- **unsloth_grpo_mini_batch**: None
|
||
- **max_seq_length**: 26000
|
||
- **model_name**: Snowflake/Arctic-Text2SQL-R1-7B
|
||
- **model_specs**: ModelSpecs(instruction_part='<|im_start|>user', response_part='<|im_start|>assistant', target_modules=['q_proj', 'k_proj', 'v_proj', 'o_proj', 'gate_proj', 'up_proj', 'down_proj'], chat_template=None)
|
||
- **lora_use_rslora**: True
|
||
- **lora_r**: 64
|
||
- **lora_alpha**: 128
|
||
- **lora_dropout**: 0.1
|
||
- **early_stopping_patience**: 5
|
||
|
||
|
||
## Train Dataset Example
|
||
```
|
||
<|im_start|>system
|
||
You are a helpful AI Assistant that provides well-reasoned and detailed responses. You first
|
||
think about the reasoning process as an internal monologue and then provide the user with
|
||
the answer. Respond in the following format: <think>
|
||
...
|
||
</think>
|
||
<answer>
|
||
...
|
||
</answer>
|
||
<|im_end|>
|
||
<|im_start|>user
|
||
You are a Couchbase SQL++ query expert. Given a database schema and a natural language question, generate a syntactically valid SQL++ query that precisely answers the question.
|
||
|
||
Rules:
|
||
- SELECT only the columns explicitly asked for — nothing more, nothing less
|
||
- Use the exact bucket, scope, and collection names provided in the database schema
|
||
|
||
Bucket Name:
|
||
`nan`
|
||
|
||
Scope Name:
|
||
`nan`
|
||
|
||
Database Schema:
|
||
{}
|
||
|
||
This schema describes the structure of the data in the specified bucket and scope. It includes information about the collections, fields, and their data types.
|
||
|
||
Question:
|
||
Build the special_flights list with two objects and return the values from each object.
|
||
<|im_end|>
|
||
<|im_start|>assistant
|
||
<think>
|
||
I start by noticing there is no schema at all. So this is not a normal “read from a collection” question. There are no buckets, scopes, collections, or existing fields to join together. That means I need to construct the data inline inside the query itself.
|
||
|
||
The wording is: “Build the special_flights list with two objects and return the values from each object.”
|
||
|
||
A few pieces matter here.
|
||
|
||
First, “build the special_flights list” suggests I should create a named list, not just throw an anonymous array into the SELECT. In SQL++ / N1QL, a clean way to do that is a WITH binding. So I want a common expression named special_flights.
|
||
|
||
Second, it says “with two objects.” So special_flights should be an array containing exactly two object literals.
|
||
|
||
Since there is no schema, I have to invent the object structure and values myself. The list name special_flights makes flight-oriented fields feel natural. I need a clear identifier for each object, so using a field named flight makes sense. I also want some time-like field; utc is a natural label for that. Then I can add one more descriptive field to each object to make them feel like richer objects rather than just two identical key sets.
|
||
|
||
Now I need actual literal values. Because these are made-up demo rows, I want them to be memorable and obviously different. For the first one, a flight value like AI444 is easy to recognize, and I can pair it with a matching time-like string 4:44:44. For the extra descriptive field, codename with value green works well. For the second object, I can mirror that pattern with flight AI333 and utc 3:33:33, then use a different status-style key alert with value red. That also shows that the two objects do not have to share every non-core field, which is interesting for an object-values operation.
|
||
|
||
So the array I am binding to special_flights is two objects:
|
||
- one with flight AI444, utc 4:44:44, codename green
|
||
- one with flight AI333, utc 3:33:33, alert red
|
||
|
||
Next I need to “return the values from each object.” I should think about what that means in N1QL terms.
|
||
|
||
One possibility is to UNNEST the array and call OBJECT_VALUES on each object individually, which would give one row per object. But the question says “build the special_flights list” first, and then “return the values from each object,” which sounds more like operating on the list as a whole rather than exploding it into separate rows. So I lean toward applying an object-values function to the list’s contents directly.
|
||
|
||
The N1QL function for extracting an object’s values is OBJECT_VALUES. To apply it to the objects inside the array, I need the array-star form special_flights[*]. That notation refers to the objects in the list. Using OBJECT_VALUES on that expression gives me the values drawn from the objects in the list.
|
||
|
||
Since the SELECT is just returning that one derived expression, I should give it an alias. A name like outer_values fits, because I am returning the values produced from the outer list binding.
|
||
|
||
There is also no need for a FROM clause, because I am not querying any stored collection; everything comes from the WITH-defined array literal.
|
||
|
||
So the final shape is: a WITH clause naming special_flights and assigning it the two-object array, then a SELECT that applies OBJECT_VALUES to special_flights[*] and aliases the result as outer_values.
|
||
</think>
|
||
|
||
<answer>
|
||
WITH special_flights AS ([{"flight":"AI444","utc":"4:44:44","codename":"green"},{"flight":"AI333","utc":"3:33:33","alert":"red"}]) SELECT OBJECT_VALUES(special_flights[*]) AS outer_values;
|
||
</answer>
|
||
<|im_end|>
|
||
|
||
```
|