Mistral-7B-Instruct Playwright MCP

A fine-tuned LoRA adapter for Mistral-7B-Instruct-v0.2, optimized for Playwright MCP (Model Context Protocol) tool-calling tasks. This model enables AI assistants to interact with web pages through browser automation tools.

Model Details

Model Description

This is a LoRA (Low-Rank Adaptation) adapter fine-tuned on Mistral-7B-Instruct-v0.2 for Playwright MCP tool-calling tasks. The model has been trained to understand and generate appropriate tool calls for browser automation, including navigation, clicking, form filling, text extraction, and screenshot capture.

  • Developed by: [Your Name/Organization]
  • Model type: Causal Language Model with LoRA adapter
  • Language(s) (NLP): English
  • License: Apache 2.0 (inherited from base model)
  • Finetuned from model: mistralai/Mistral-7B-Instruct-v0.2

Model Sources

Uses

Direct Use

This model is designed to be used with Playwright MCP for browser automation tasks. It can:

  • Navigate to web pages
  • Click on elements
  • Fill forms
  • Extract text from pages
  • Take screenshots
  • Wait for elements to appear
  • Get accessibility trees

Example Usage

hon from peft import PeftModel from transformers import AutoModelForCausalLM, AutoTokenizer

Load base model

base_model = AutoModelForCausalLM.from_pretrained( "mistralai/Mistral-7B-Instruct-v0.2", torch_dtype=torch.float16, device_map="auto" )

Load LoRA adapter

model = PeftModel.from_pretrained(base_model, "your-username/finetuned-mistral-7b-playwright-mcp") tokenizer = AutoTokenizer.from_pretrained("mistralai/Mistral-7B-Instruct-v0.2")

Use with Playwright MCP tools

messages = [ {"role": "system", "content": "You are an AI assistant with Playwright MCP tools."}, {"role": "user", "content": "Navigate to example.com and get the main heading"} ]

inputs = tokenizer.apply_chat_template(messages, return_tensors="pt").to(model.device) outputs = model.generate(**inputs, max_new_tokens=512) response = tokenizer.decode(outputs[0], skip_special_tokens=True)### Out-of-Scope Use

This model is specifically fine-tuned for Playwright MCP tool-calling. It may not perform well for:

  • General conversation without tool-calling context
  • Tasks unrelated to browser automation
  • Non-English languages

Bias, Risks, and Limitations

  • The model inherits biases from the base Mistral-7B-Instruct model
  • Browser automation can be used for malicious purposes (scraping, automation abuse)
  • The model may generate incorrect tool calls that could lead to unintended web interactions
  • Always validate and sanitize tool calls before execution in production environments

Recommendations

Users should:

  • Implement proper validation and sandboxing for tool execution
  • Monitor and log all browser automation activities
  • Use rate limiting to prevent abuse
  • Respect website terms of service and robots.txt

How to Get Started with the Model

Installation

pip install transformers peft torch### Quick Start hon from peft import PeftModel from transformers import AutoModelForCausalLM, AutoTokenizer import torch

Load model with LoRA adapter

base_model = AutoModelForCausalLM.from_pretrained( "mistralai/Mistral-7B-Instruct-v0.2", torch_dtype=torch.float16, device_map="auto" ) model = PeftModel.from_pretrained(base_model, "your-username/finetuned-mistral-7b-playwright-mcp") tokenizer = AutoTokenizer.from_pretrained("mistralai/Mistral-7B-Instruct-v0.2")## Training Details

Training Data

The model was fine-tuned on a dataset of Playwright MCP tool-calling examples in chat format, including:

  • Navigation tasks
  • Form interactions
  • Text extraction
  • Screenshot capture
  • Multi-step browser automation workflows

Data format: JSONL files with chat messages (system, user, assistant roles).

Training Procedure

Preprocessing

  • Data converted to chat message format
  • Full conversations tokenized using Mistral's chat template
  • Labels masked so loss is computed only on assistant responses

Training Hyperparameters

  • Training regime: FP16 mixed precision
  • Epochs: 3
  • Learning rate: 2.0e-4
  • Batch size: 1 per device
  • Gradient accumulation steps: 16
  • Effective batch size: 16
  • Max sequence length: 1024 tokens
  • Warmup steps: 100
  • Evaluation strategy: Steps (every 500 steps)
  • Save strategy: Steps (every 500 steps, keep best 3)

LoRA Configuration

  • Method: LoRA (Low-Rank Adaptation)
  • Rank (r): 32
  • Alpha: 64
  • Dropout: 0.05
  • Target modules: ["q_proj", "k_proj", "v_proj", "o_proj", "gate_proj", "up_proj", "down_proj"]
  • Quantization: 8-bit (BitsAndBytes)

Speeds, Sizes, Times

  • Adapter size: ~130 MB (adapter_model.safetensors)
  • Base model: Mistral-7B-Instruct-v0.2 (~14GB in FP16)
  • Training time: ~1-3 hours per epoch (depends on dataset size and hardware)
  • Optimized for: 16GB VRAM GPUs

Evaluation

Testing Data, Factors & Metrics

  • Testing Data: Held-out test set from training data
  • Metrics: Validation loss, generation quality on tool-calling tasks

Results

The model shows improved performance on Playwright MCP tool-calling tasks compared to the base model, with better understanding of tool call structure and browser automation workflows.

Technical Specifications

Model Architecture and Objective

  • Architecture: Mistral-7B-Instruct with LoRA adapters
  • Objective: Causal language modeling with masked loss on assistant responses
  • Parameters: Base model: 7B, Trainable parameters: ~8.4M (LoRA adapters only)

Compute Infrastructure

Hardware

  • GPU: NVIDIA GPU with 16GB+ VRAM (tested on various consumer GPUs)
  • Memory: Optimized for 16GB VRAM with 8-bit quantization

Software

  • Framework: PyTorch, Transformers, PEFT
  • Training framework: Hugging Face Transformers Trainer
  • PEFT version: 0.18.0

Framework versions

  • PEFT 0.18.0
  • Transformers (latest)
  • PyTorch (with CUDA support)
Downloads last month
15
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for rzagirov/mistral-7b-playwright-mcp

Adapter
(1087)
this model