Instructions to use FinaPolat/phi4_adaptableIE_v2-gguf with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- llama-cpp-python
How to use FinaPolat/phi4_adaptableIE_v2-gguf with llama-cpp-python:
# !pip install llama-cpp-python from llama_cpp import Llama llm = Llama.from_pretrained( repo_id="FinaPolat/phi4_adaptableIE_v2-gguf", filename="phi-4.Q4_K_M.gguf", )
llm.create_chat_completion( messages = "No input example has been defined for this model task." )
- Notebooks
- Google Colab
- Kaggle
- Local Apps
- llama.cpp
How to use FinaPolat/phi4_adaptableIE_v2-gguf with llama.cpp:
Install from brew
brew install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf FinaPolat/phi4_adaptableIE_v2-gguf:Q4_K_M # Run inference directly in the terminal: llama-cli -hf FinaPolat/phi4_adaptableIE_v2-gguf:Q4_K_M
Install from WinGet (Windows)
winget install llama.cpp # Start a local OpenAI-compatible server with a web UI: llama-server -hf FinaPolat/phi4_adaptableIE_v2-gguf:Q4_K_M # Run inference directly in the terminal: llama-cli -hf FinaPolat/phi4_adaptableIE_v2-gguf:Q4_K_M
Use pre-built binary
# Download pre-built binary from: # https://github.com/ggerganov/llama.cpp/releases # Start a local OpenAI-compatible server with a web UI: ./llama-server -hf FinaPolat/phi4_adaptableIE_v2-gguf:Q4_K_M # Run inference directly in the terminal: ./llama-cli -hf FinaPolat/phi4_adaptableIE_v2-gguf:Q4_K_M
Build from source code
git clone https://github.com/ggerganov/llama.cpp.git cd llama.cpp cmake -B build cmake --build build -j --target llama-server llama-cli # Start a local OpenAI-compatible server with a web UI: ./build/bin/llama-server -hf FinaPolat/phi4_adaptableIE_v2-gguf:Q4_K_M # Run inference directly in the terminal: ./build/bin/llama-cli -hf FinaPolat/phi4_adaptableIE_v2-gguf:Q4_K_M
Use Docker
docker model run hf.co/FinaPolat/phi4_adaptableIE_v2-gguf:Q4_K_M
- LM Studio
- Jan
- Ollama
How to use FinaPolat/phi4_adaptableIE_v2-gguf with Ollama:
ollama run hf.co/FinaPolat/phi4_adaptableIE_v2-gguf:Q4_K_M
- Unsloth Studio new
How to use FinaPolat/phi4_adaptableIE_v2-gguf with Unsloth Studio:
Install Unsloth Studio (macOS, Linux, WSL)
curl -fsSL https://unsloth.ai/install.sh | sh # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for FinaPolat/phi4_adaptableIE_v2-gguf to start chatting
Install Unsloth Studio (Windows)
irm https://unsloth.ai/install.ps1 | iex # Run unsloth studio unsloth studio -H 0.0.0.0 -p 8888 # Then open http://localhost:8888 in your browser # Search for FinaPolat/phi4_adaptableIE_v2-gguf to start chatting
Using HuggingFace Spaces for Unsloth
# No setup required # Open https://huggingface.co/spaces/unsloth/studio in your browser # Search for FinaPolat/phi4_adaptableIE_v2-gguf to start chatting
- Docker Model Runner
How to use FinaPolat/phi4_adaptableIE_v2-gguf with Docker Model Runner:
docker model run hf.co/FinaPolat/phi4_adaptableIE_v2-gguf:Q4_K_M
- Lemonade
How to use FinaPolat/phi4_adaptableIE_v2-gguf with Lemonade:
Pull the model
# Download Lemonade from https://lemonade-server.ai/ lemonade pull FinaPolat/phi4_adaptableIE_v2-gguf:Q4_K_M
Run and chat with the model
lemonade run user.phi4_adaptableIE_v2-gguf-Q4_K_M
List all available models
lemonade list
phi4_adaptableIE_v2-gguf : GGUF
This model was finetuned and converted to GGUF format using Unsloth.
Example usage:
- For text only LLMs:
./llama.cpp/llama-cli -hf FinaPolat/phi4_adaptableIE_v2-gguf --jinja - For multimodal models:
./llama.cpp/llama-mtmd-cli -hf FinaPolat/phi4_adaptableIE_v2-gguf --jinja
Available Model files:
FinaPolat/phi4_adaptableIE_v2-gguf
Ollama
An Ollama Modelfile is included for easy deployment.
Please see: https://github.com/EnexaProject/phi4-ie-demo
This was trained 2x faster with Unsloth

Phi-4-AdaptableIE: Efficient Adaptive Knowledge Graph Extraction
This model has gguf version: https://huggingface.co/FinaPolat/phi4_adaptableIE_v2-gguf
Phi-4-AdaptableIE is a specialized 14.7B parameter Small Language Model (SLM) optimized via Supervised Fine-Tuning (SFT) for high-precision, Joint Named Entity Recognition (NER) and Relation Extraction (RE).
Unlike traditional multi-stage pipelines that are prone to cascading error propagation, this model performs entity identification and relational mapping in a single cohesive pass. It is designed to be ontology-adaptive, allowing it to conform to dynamic, unseen schemas at inference time through a specialized Structured Prompt Architecture.
π Model Highlights
- Joint Extraction: Unified NER + RE reducing pipeline complexity.
- Ontology-Adaptive: Zero-shot adaptation to diverse domains (Astronomy, Music, Healthcare, etc.) via dynamic schema variables.
- Local & Private: Optimized for local CPU-only inference (via GGUF/Ollama - FinaPolat/phi4_adaptableIE_v2-gguf ), ensuring data sovereignty without external API dependencies.
- Instruction Aligned: Fine-tuned to follow strict negative constraints, ensuring zero conversational filler in outputs.
π Methodology
The model was fine-tuned using QLoRA on the WebNLG subset of the Text2KGBench benchmark. The training process focused on Conversational Alignment, ensuring the model treats extraction as a strict logical mapping:
Prompt = f(task, schema, example, text)
π Prompting Strategy
To achieve high-fidelity extraction, the model requires a specific prompt structure.
1. System Prompt
{
"role": "system",
"content": "You are a helpful AI assistant specializing in Information Extraction tasks such as Named Entity Recognition and Relation Extraction. Follow the instructions given by the user."
}
2. User Prompt Template
Information Extraction is the process of automatically identifying and extracting structured information from unstructured text data... [Context] ...
Always extract numbers, dates, and currency values regardless of the specific task.
The task at hand is {task}.
Here is an example of task execution:
{example}
Analyze the text and targets carefully, identify relevant information.
Extract the information in the following format: `{output_format}`.
If no matching entities are found, return an empty list: [].
Please provide only the extracted information without any explanations.
Schema: {schema}
Text: {inputs}
- Downloads last month
- 19
4-bit