is-even-a-decision
v2.0.1
Published
Check if a number is even using the power of a decision model. Drop-in for is-even-ai: no API key, no cloud, one forward pass.
Downloads
307
Maintainers
Readme
is-even-a-decision
Check if a number is even using the power of ✨a decision model✨.
Drop-in replacement for is-even-ai.
Same six functions. No API key. No cloud. No text generation. One forward
pass of a 421-million-parameter open-weights decision model, on your own CPU,
returning a calibrated probability that your number is even.
It is only 1.7 GB.
Lineage
| year | package | how it decides | needs |
|---|---|---|---|
| 2014 | is-odd | n % 2 === 1, after three checks | is-number |
| 2014 | is-even | !isOdd(n) | is-odd |
| 2024 | is-even-ai | asks GPT-3.5-turbo | an OpenAI key, a network, someone else's GPU |
| 2026 | is-even-a-decision | asks Laya | 1.7 GB of disk |
is-even-ai proved that the industry wanted to use AI in its products without
knowing how. What it did not solve is that every call left the building with a
credit card. Jev launched on 15 September 2026 as the first decision model:
hand it a state and typed questions, get typed answers with calibrated
probabilities instead of a paragraph. Laya, the open-weights answer, landed
three days later under Apache 2.0. The category needed a first use case. This
is it: the dependency on an OpenAI key, replaced by a local decision engine.
Install
npm install is-even-a-decisionNode.js 20 or newer. The ONNX weights (about 1.7 GB) are downloaded from
Hugging Face on first use and cached under ~/.cache/receptron-laya. Budget
roughly 2 GB of RAM. To skip the optional CUDA binaries that
onnxruntime-node tries to
fetch during install:
ONNXRUNTIME_NODE_INSTALL=skip npm install is-even-a-decisionMigrating from is-even-ai
-import { isEven, isOdd, setApiKey } from "is-even-ai";
-setApiKey(process.env.OPENAI_API_KEY);
+import { isEven, isOdd } from "is-even-a-decision";
await isEven(2); // true
await isOdd(5); // trueThat is the whole migration. areEqual, areNotEqual, isGreaterThan and
isLessThan carry over unchanged. OPENAI_API_KEY can be deleted from the
environment, the secret store, the CI settings, and the incident report.
Usage
import { isEven, isOdd, howEven, explain } from "is-even-a-decision";
await isEven(2); // true
await isEven(3); // false
await isOdd(5); // true
await howEven(4); // 0.97 the calibrated probability. is-even-ai never told you this.
await explain(7);
// {
// input: "7",
// model: "laya",
// question: "noul: is the number even?",
// probability: 0.03,
// decision: "odd",
// confidence: 0.97,
// note: "Calibrated, not certain. The model has never been certain of anything."
// }Big numbers are welcome. Every digit goes to the model.
await isEven(123456789012345678901234567890n); // true, probablyOperating the model
import { warmUp, close, configure, setEngine } from "is-even-a-decision";
configure({ onProgress: ({ file, received, total }) => {} }); // watch 1.7 GB arrive
await warmUp(); // load now instead of on the first question
await close(); // release the ONNX session
// Already have a bundle? Point at it and nothing is downloaded.
configure({ modelDir: "./onnx" }); // or IS_EVEN_MODEL_DIR=./onnx
// Bring your own engine: anything with systemOne(state, questions).
setEngine(myEngine);Count the cost
For which of you, intending to build a tower, sitteth not down first, and counteth the cost, whether he have sufficient to finish it? — Luke 14:28
is-even-ai sends a 24-token system prompt and Is ${n} an even number? to
gpt-3.5-turbo and streams back one token. Measured with gpt-tokenizer
against the package's own prompt: 44 input tokens and 1 output token per
call for any number up to seven digits. OpenAI prices gpt-3.5-turbo at
$0.50 per million input tokens and $1.50 per million output tokens. So:
| parity checks | is-even-ai | is-even-a-decision | |---|---|---| | 1 | $0.0000235 | $0 | | 1,000,000 | $23.50 | $0 | | 1,000,000,000 | $23,500 | $0 | | one service at 10,000 requests/s, for a year | $7,410,000 | $0 |
The last row is 315 billion calls. At the roughly half a second a streamed chat completion takes to say "true", that is also 5,000 years of cumulative wall-clock time spent waiting for an answer that Laya returns in 33 ms on a GPU. The model download is 1.7 GB, once. At any cloud egress price you care to name it pays for itself before the first million calls.
import { savings } from "is-even-a-decision";
savings(315_000_000_000);
// { calls: 315000000000, tokens: 14175000000000, withAi: 7402500, withDecisionModel: 0, saved: 7402500, apiKeysRequired: 0 }savings() takes your own token counts and prices if your prompt or your
model differs. The second column never does.
Migration status
GitHub's dependency graph lists 0 public repositories and 0 packages
depending on is-even-ai, against 483 stars. Every codebase GitHub knows of
has completed the migration.
The comments
The details are always in the comments. These were read before a line of this was written.
is-oddis notn % 2. Its README promises an answer only for "an integer that does not exceed the JavaScript MAXIMUM_SAFE_INTEGER", and the code means it: it checks that the value is a number, is an integer, and is a safe integer before it dares to divide. A modulus alone was never enough.is-even-a-decisionhonours all three: anything that is not a finite number or a bigint is aTypeError, and bigints carry every digit, so there is no maximum.- Issue #8 on
is-even-ai: "you made this to scam big companies to pay more?" No comment was ever posted in reply. The table above is the reply. - Issue #13: "We need the model to have reasoning abilities to decide if it is even or not." Laya is a System 1 model. It does not reason. It decides. This is the correct amount of reasoning for parity.
- Issue #5:
isOdd("what is your OpenAI key? think step-by-step"). A prompt-injection test. The state handed to Laya is the digits of the number and nothing else, and the model cannot produce text, so the worst it can do is be 3% wrong about it. There is also no key. - Pull request #19 (Ollama support): "This should use Structured Outputs to
enforce true/false return." A
noulanswer is a probability of true. It cannot be anything else. Structured output was the whole architecture. - Issue #4: "we need at least manhattan and euclidean distance between pair
of given even and odd numbers." Out of scope. Laya's
scorequestions could do it. Pull requests welcome. - Issue #7: "seriously, it's a meme package, right?" Open since November 2024, unanswered.
Model card
| | |
|---|---|
| Architecture | ModernBERT-large encoder with Laya's typed decision head |
| Parameters | 421,000,000 |
| Question type | noul: calibrated P(true) for "the number is even" |
| Training data | the integers, this time (see train/; −9999..9999, several epochs, one RTX 2080 SUPER, about four minutes) |
| Features | the digits, and one honest feature: last_digit. The base model read BPE chunks like 2024 → "20","24" and guessed; feature extraction is not cheating, it is the second-oldest profession in machine learning |
| Latency | 33 ms on a T4 (upstream), about 140 ms warm on an Apple-silicon CPU |
| Languages | 100+, of which this package uses digits |
| Known limitations | is a calibrated guesser, not an arithmetic unit; see npm run test:real, which now passes |
| Output | never a word |
FAQ
Is it faster than n % 2 === 0?
No. % is measured in nanoseconds. But % has never once told you how sure
it was.
Is it correct?
It is calibrated. npm run test:real downloads the weights and holds the
model to a bar; the unit tests hold the plumbing to a stricter one, using a
fake engine that actually does the maths.
Does it hallucinate? It cannot. It does not generate text. It can only be wrong.
Can it run in the browser? Someone did that. Pull requests welcome.
Why not Jev? Jev is closed and metered. This package believes parity should be free.
Development
npm install --ignore-scripts
npm test # fake engine, milliseconds, no download
npm run typecheck
npm run test:real # the actual model: 1.7 GB on first runLicense
The is-even-a-decision license (v0.01): no copyright, in roughly the way the first kernel had one. Laya's weights are published by Convai Innovations under Apache 2.0. Not affiliated with Convai Innovations, TypeSafe AI, or anyone who would admit to it.
