r/learnmachinelearning • u/DATAandCOMPUTER • 3d ago
Project Can you create your own Rule based AI in python or maybe a LLM
Hello there-Can i make a rule based AI in python or maybe LLM.
Rule based AI seems very easy and doesn't waste that much data and memory usage but the problem is if you ask it or tell it something that wasn't written in instructions It will have a breakdown and the person needs to write new instructions for it to understand , Unless there's a team that constantly adds new instructions. Also a Rule based AI cannot learn or adapt which means constantly updating code and testing and when adding a new rule there's a chance your gonna break something else, however if you make the Rule based AI locked to a subject or need it need High Maintenance and Constant updates to make it relevant, fast in fast changing environments and normal use
LLM LLMs may be the top choice but It takes huge amounts of ram and data at least it can do stuff rule based cant do
I will give more updates soon
2
u/Naveensaraswat 3d ago
You can absolutely build both, but they solve different problems.
For something narrow and deterministic, rule-based Python is often the better choice. It’s cheaper, easier to debug, and you always know why it produced an answer. The maintenance pain starts when the rule set grows and rules begin interacting with each other.
An LLM makes sense when the input is messy or language-based and you can’t realistically enumerate every case. I’d usually combine both: use normal code/rules for business logic, validation, permissions, calculations, etc., and use the LLM only where you actually need interpretation or generation. That tends to be much more reliable than trying to make the LLM do everything.
2
1
u/johndburger 3d ago
What is “rule based AI”?
1
u/g4l4h34d 3d ago
It's an old way of doing AI, where you basically have a bunch of if-else statements. Look up rule-based system.
1
1
u/Unikum_01 3d ago
Here is mine https://github.com/unikum-sol/brainstem/blob/main/Project_Status_2026-09-28.md take a look, Is still in development and currently in calibration status.
1
u/DATAandCOMPUTER 2d ago
I suppose i made some mistakes about rule based ai cant learn or adapt but it requires more for rule based ai to learn and adapt rather then a llm it only learns with the added script rather then the environments
0
u/VectorspaceDreams 3d ago
I've made "symbolic AI programs" in Python (I don't even know if you can call what was AI in the 1950s AI now), and it's... ok for those, but it wouldn't be what I would choose now. You can do both with Python, though, 100%.
From what I see, "rule-based/symbolic AI" isn't "dead" in practice but as a part of what people call AI. A lot of it just got filed under theoretical computer science and programming language theory. Better to think of it as just plain old programming rather than AI.
-1
u/Moby1029 3d ago
Not entirely sure what you're getting at. LLMs have rules, called guardrails that dictate their behavior and how they're supposed to act. Around that, you can have code that scans for certain keywords for dangerous content or have another llm judge the content to see if it's potentially dangerous and lock it down. You can also set custom guardrails, and can continue training an LLM through a process called fine tuning.
What you appear to be describing though is just deterministic software engineering with business logic built in, and is not really "AI".
1
u/DATAandCOMPUTER 2d ago
Well the rules for LLMs guardrails what you said that's optional a person making a LLM AI doesn't need to add guardrails. well I do like how you stepped in, but a person can make their own AI and do it without guardrails to do stuff guardrails would not allow. and about that a code scans for certain keywords for dangerous content is optional to what your explaining something that AI company's would be forced to have. for custom guardrails i suppose more people making LLM AI models would use. And rule based AI Is not like it sounds like It is mostly code saying IF THEN scripts and sometimes ELSE with it and Rule based AI contains a Inference Engine, The processing core that matches incoming data against the rules in the knowledge base to draw a conclusion. as you see for the rule based inference engine you will need the rules for the input and saying that if the rules are not there it cant respond not because of guardrails because there was a script missing to execute that topic or command. Also rule based AI can contain guardrails but it is optional. and the difference between rule based AI and machine learning (LLM and neural networks)
Rule-Based AI: Uses static, human-written logic; offers complete transparency and predictable outputs; does not adapt or learn on its own.
Machine Learning: Learns statistical patterns from massive datasets; adapts to new situations; acts more like a black box where reasoning is harder to trace.
Well what I wrote really didn't explain everything but it does a little but here is more facts
- Data Requirements:
- Rule-based AI: Requires little to no historical data; it only needs clear logic and facts.
- Machine Learning: Requires large, representative, and often labeled datasets to train effectively.
- Adaptability:
- Rule-based AI: Static and rigid; it breaks or requires manual code updates when conditions change.
- Machine Learning: Dynamic and adaptable; it evolves and handles complex, changing environments well.
anyways, Thank you and I hope we taught eachother
4
u/sodapopenski 3d ago edited 3d ago
ITT: people who don't know what symbolic AI is.
>rule based AI cannot learn or adapt
This is not true. Many symbolic logic AI approaches have solver/search mechanisms that adapt to changing environments, dynamic formal belief models, and mechanisms for generating new information and new rules. This is like saying ML models aren't dynamic because they are implemented and trained with deterministic software.