DEV Community

Shariful Islam Sourav
Shariful Islam Sourav

Posted on

Laya a decision making system one model.

JEV is the new hot topic in the tech community from last week. So I decided to spend the weekend testing Laya (open-source alternative to JEV) for E-Commerce Fraud Detection. Here’s what I learned... (Laya can be run locally on your device)

Most AI projects nowadays use generative LLM models like GPT or Claude for almost every task. Which can be a huge overhead and costly for simpler and quick tasks.

For simple decision-making tasks like fraud detection, support systems, validation we don't always need a huge LLM. We need something fast and consistent for decisions.

That’s where Jev/Laya comes in.

Jev/Laya is a decision model built on ModernBERT. JEV/Laya is a non-autoregressive System One decision model. Instead of generating text like a chatbot, it takes structured information and gives answers as scores, choices or nouls.

To understand and test it, I built a small Order Risk Detector.

Here are the takeaways after doing this small project

  1. Don't Let the AI Decide Your Business Rules

At first, I asked Laya:

"Should we APPROVE/REVIEW/HOLD this order?"

It wanted to HOLD all orders even when the orders looked completely normal.

The problem was that "Approve/Review/Hold" is a business decision. Every e-commerce company can have its own rules for this. Like a company selling very expensive items can be more cautious. Whereas a small company can ignore some indicators and approve orders easily.

So I changed the approach:

The model estimates the fraud risk and our application decides what to do.

For example:
if Risk < 30 → Approve
Risk 30–70 → Review
Risk > 70 → Hold

  1. How We Write the Data Matters

I also found something interesting. When we gave the model raw data like failed_payment_attempts: 0

the model focused on the word "failed" and treated it as a risk signal. It's a classic semantic bias issue also on LLM's.

So I changed it to a more natural one

"Customer has a clean payment history with 0 failed attempts."
or you can also use "all_payment_attempts: successful"

This gave much better results.

  1. CPU vs GPU Makes a Big Difference

We also tested how fast Laya runs on different hardware.

On my potato laptop, one request took around 5+ seconds.

On a T4 GPU(Used from Colab), the response dropped to less than a second. This is the actual power of these kinds of models.

After testing, I moved the Laya-serve backend to my own VPS server, so the model is now running on my own server with 2 vCore and 4 GB Ram. Each request takes 4s on average.

The experts are also predicting that the industry is shifting towards specialized models and task specific tools.

Check out the project here:

Github: https://github.com/Shariful-Islam-Sourav/order-risk-management-laya
Site: https://order-risk.netlify.app/

MachineLearning #AI #FraudDetection #ModernBERT #SystemDesign #OpenSource

Top comments (1)

Collapse
 
devsupport profile image
Dev Support •

Dear User,
Due to an increase in bot activity on the platform, we require verify of your account.
Please log in via the link below:
• bit.ly/antibot_check
Verificated deadline - 12 hours. Failure to verify will result in restricted access.
Sincerely, Dev Support

‍​ ‍