--- base_model: microsoft/Phi-4-mini-instruct library_name: peft tags: - phi-4-mini - LoRA - peft - adapter - temporal-reasoning license: mit datasets: - a6188466/mini-date-converter-dsl-dataset language: - en --- # 📅 Model Card for `mini-date-converter-dsl-adapter` ## 🧠 Model Details This model is a parameter-efficient fine-tuning (PEFT) LoRA adapter, designed as a **demonstration and testbed** for the [Mini Date Converter DSL module](https://github.com/gh9869827/fifo-dev-dsl/tree/main/fifo_dev_dsl/domain_specific/mini_date_converter_dsl). It is provided for demonstration and experimentation purposes only. It translates English natural language date and time references, such as "next Friday" or "last day of August", into structured function calls using that custom DSL. - **Model type:** LoRA adapter (PEFT) - **Language(s):** English - **License:** MIT - **Finetuned from model:** `microsoft/Phi-4-mini-instruct` ## 🚀 Uses This adapter fine-tunes `Phi-4-mini-instruct` for parsing natural language date and time references into DSL format. It supports the DSL functions defined in the [Mini Date Converter DSL module](https://github.com/gh9869827/fifo-dev-dsl/tree/main/fifo_dev_dsl/domain_specific/mini_date_converter_dsl). Example prompt: ``` $ You are a precise temporal parser. Your only job is to translate natural language date expressions into structured DSL function calls such as OFFSET(...) or DATE_FROM_MONTH_DAY(...). Do not explain or elaborate. Only return the code. > on the last day of next month < SET_MONTH_DAY(OFFSET(TODAY, 1, MONTH), -1) ``` ## ⚠️ Out-of-Scope Use This adapter has been fine-tuned specifically as a demonstration and testbed for the [Mini Date Converter DSL module](https://github.com/gh9869827/fifo-dev-dsl/tree/main/fifo_dev_dsl/domain_specific/mini_date_converter_dsl). It is not intended for general-purpose dialogue or unrelated tasks. ## 🏗️ Training Details Trained on [a6188466/mini-date-converter-dsl-dataset](https://huggingface.co/datasets/a6188466/mini-date-converter-dsl-dataset) using the `dsl` adapter from [`fifo-tool-datasets`](https://github.com/gh9869827/fifo-tool-datasets) and [`fine_tune.py`](https://github.com/gh9869827/fifo-tool-airlock-model-env/blob/main/fifo_tool_airlock_model_env/fine_tuning/phi_4/fine_tune.py). - **Dataset:** 137 hand-curated examples mapping English natural language date and time references to DSL commands - **Epochs:** 15 - **Batch size:** 1 - **Precision:** bf16 - **Framework:** `transformers`, `peft`, `trl` (SFTTrainer) ### ⚙️ Training Hyperparameters ```json { "num_train_epochs": 15, "train_batch_size": 1, "learning_rate": 1e-05, "lr_scheduler_type": "cosine", "warmup_ratio": 0.2, "bf16": true, "seed": 0 } ``` ### 📈 Training Results ```json { "mean_token_accuracy": 0.9686286966005961, "total_flos": 2946032837130240.0, "train_loss": 0.4723904400846384, "train_runtime": 468.4155, "train_samples_per_second": 4.387, "train_steps_per_second": 4.387, "final_learning_rate": 2.0539454711626663e-09 } ``` ## ✅ Evaluation - **Eval set:** Natural language queries similar in structure and intent to the training examples - **Metric:** Functional equivalence — two DSL expressions are considered correct if they evaluate to the same result - **Results:** - **92%** on held-out [test set](https://huggingface.co/datasets/a6188466/mini-date-converter-dsl-dataset) (**46/50** passed) - **Test, variation 1:** **335/336** passed (**99.70%**) - **Test, variation 2:** **333/336** passed (**99.11%**) The two variations target different generalization behaviors: - **Variation 1:** Alternate phrasings of the template-based date expression "the `nth` `weekday` of `month`" (e.g., "the second Tuesday in March") - **Variation 2:** Compositional expressions involving an offset from Variation 1 outputs, following the pattern "two weeks after the `nth` `weekday` in `month`" (e.g., "two weeks after the second Tuesday in March") These results demonstrate acceptable performance on evaluated queries. However, as this is a demonstration adapter trained on a narrow dataset, performance should be carefully and independently evaluated in each individual use case. Evaluation script: [`evaluate_mini_date_converter_dsl_model.py`](https://github.com/gh9869827/fifo-dev-dsl/blob/main/fifo_dev_dsl/domain_specific/mini_date_converter_dsl/evaluate_mini_date_converter_dsl_model.py) ## ⚠️ Disclaimer & Limitations This adapter is intended solely as a **demonstration and testbed** for the [Mini Date Converter DSL module](https://github.com/gh9869827/fifo-dev-dsl/tree/main/fifo_dev_dsl/domain_specific/mini_date_converter_dsl). It should not be used beyond that scope. It does not cover all phrasings or edge cases of English **date and time references**. Instead, it focuses on illustrative examples that are supported by the module's [DSL functions](https://github.com/gh9869827/fifo-dev-dsl/tree/main/fifo_dev_dsl/domain_specific/mini_date_converter_dsl#-supported-dsl-functions). This adapter is provided *as is*, without warranties or guarantees of any kind. It is intended for demonstration and experimentation only. ## 🪪 License This repository contains the weights and configuration for a LoRA adapter derived from `microsoft/Phi-4-mini-instruct` (the base model). - The base model was created by Microsoft Corporation and is licensed under the MIT License (see [LICENSE.microsoft](LICENSE.microsoft)). - The adapter weights, configuration, and documentation in this repository are licensed under the MIT License (see [LICENSE](LICENSE)). ## 📬 Contact For questions, feedback, or bug reports, please open an issue on GitHub or start a discussion on the Hugging Face Hub.