Efficient parallel decisions for MLX models on Apple Silicon.
Project details
Jevmlx enables efficient, schema-valid typed decisions from local LLMs in a single forward pass. Designed for Apple Silicon, it allows users to predefine schemas and contexts, resulting in accurate outputs without text generation or repair. Its ease of use and performance metrics make it a valuable tool for any MLX model.
jevmlx is an innovative library designed for Apple Silicon that enables parallel constrained decision-making for machine learning tasks, specifically tailored for MLX (Machine Learning on Apple). Leveraging a typed and schema-valid JSON approach, jevmlx streamlines decision-making processes in one efficient forward pass, enhancing both accuracy and performance.
Schema-Based Decision Making: Users provide a schema (using Pydantic or raw JSON) along with a context, allowing jevmlx to prefill data and make decisions across multiple fields in a single batched operation—no text generation and no need for JSON repair.
Validated Output with Probabilities: Each decision results in a validated typed object alongside a confidence score for each field, ensuring informed decision-making.
jevmlx follows a structured process:
Illustrative Command-Line Usage:
jevmlx decide --preset fintech_fraud
This command executes a predefined decision-making task concerning fintech fraud.
Using jevmlx in Python consists of defining schemas with Pydantic or standard dictionaries:
from typing import Literal
from pydantic import BaseModel, Field
import jevmlx
class Fraud(BaseModel):
is_fraudulent: bool = Field(description="Whether the transaction is fraudulent")
risk_tier: Literal["LOW", "MEDIUM", "HIGH", "CRITICAL"] = Field(description="Risk tier")
context = "Wire transfer to a new IBAN, requested from a Tor exit node on an unrecognized device"
d = jevmlx.decide(Fraud, context, model="mlx-community/Qwen2.5-1.5B-Instruct-4bit")
This example demonstrates how to define a schema and make decisions programmatically.
Rather than merely generating JSON outputs, jevmlx provides:
jevmlx includes tools for evaluating performance through benchmark tests, offering insights into accuracy and latency, essential for data-driven applications.
Future developments for jevmlx include enhancements in model compatibility and additional user-friendly features to facilitate integration into existing workflows.
For more details, tutorials, and specifications, please refer to the repository's README and documentation.
Comments
0Start the conversation
Share the first comment.