phi3-mini / README.md
nairanu6115's picture
Update README.md
f91ce3f verified
metadata
language:
  - en
license: mit
base_model: microsoft/Phi-3-mini-4k-instruct
tags:
  - phi-3
  - erp
  - finance
  - enterprise
  - lora
  - qlora
  - fine-tuned
  - text-generation
pipeline_tag: text-generation

Phi-3 Mini · ERP Assistant

A fine-tuned version of microsoft/Phi-3-mini-4k-instruct trained on enterprise ERP documentation using QLoRA. This model is designed to answer questions about ERP concepts, workflows, and processes including procurement, accounts payable, purchase orders, inventory, and more.


Model Details

Property Value
Base model microsoft/Phi-3-mini-4k-instruct
Parameters 3.8B
Fine-tuning technique QLoRA (4-bit quantization)
Training data ERP documentation
Language English
License MIT

How to Use

from transformers import AutoModelForCausalLM, AutoTokenizer
import torch

model_id = "nairanu6115/phi3-mini-erp"

tokenizer = AutoTokenizer.from_pretrained(model_id)
model = AutoModelForCausalLM.from_pretrained(
    model_id,
    torch_dtype=torch.float16,
    device_map="auto"
)

def ask(question: str) -> str:
    prompt = f"<|user|>\n{question}<|end|>\n<|assistant|>\n"
    inputs = tokenizer(prompt, return_tensors="pt").to(model.device)
    outputs = model.generate(
        **inputs,
        max_new_tokens=300,
        temperature=0.7,
        do_sample=True,
        pad_token_id=tokenizer.eos_token_id
    )
    response = tokenizer.decode(outputs[0], skip_special_tokens=True)
    return response.split("<|assistant|>")[-1].strip()

print(ask("What is a purchase order?"))

Example Inputs & Outputs

Example 1 — Purchase Order

User: What is a purchase order?

Assistant: A Purchase Order (PO) is a formal document issued by a buyer to a vendor requesting goods or services. It specifies the items, quantities, agreed prices, and payment terms. In an ERP system, a PO is a key step in the procurement process that creates a legally binding agreement between the buyer and supplier before an invoice is received.


Example 2 — Accounts Payable

User: What is accounts payable and how does it work in ERP?

Assistant: Accounts Payable (AP) refers to the money a company owes to its vendors and suppliers for goods or services received but not yet paid for. In an ERP system, the AP process typically follows these steps: (1) a purchase order is raised, (2) goods or services are received and matched against the PO, (3) the vendor invoice is received and verified, (4) the invoice is approved and posted, and (5) payment is processed on the due date. This three-way matching process ensures accuracy and prevents overpayment.


Example 3 — Inventory

User: How does inventory management work?

Assistant: Inventory management in an ERP system tracks the quantity, location, and value of stock in real time. When goods are received from a vendor, stock levels are automatically updated. When goods are issued or sold, stock is decremented. The system can trigger automatic reorder points when stock falls below a defined threshold, ensuring continuity of supply without overstocking.


Limitations

  • This model is fine-tuned specifically on ERP documentation and performs best on ERP-related questions.
  • It may not perform well on general-purpose tasks outside the ERP domain.
  • As a 3.8B parameter model, responses may occasionally be incomplete or require prompt refinement.
  • Always verify critical ERP configuration advice against your vendor's official documentation.

Training Details

  • Base model: microsoft/Phi-3-mini-4k-instruct
  • Technique: QLoRA with 4-bit quantization (via bitsandbytes)
  • Framework: HuggingFace transformers + peft
  • Dataset: Internal ERP documentation corpus
  • Task: Instruction following / question answering on ERP topics