Deterministic Engine First: Why Astrology Numbers Can't Be Generated

Published: 2 October 2026 · EchoReading Engineering

There is a category of error that looks small but breaks everything: getting the numbers wrong. In astrology and destiny analysis, the numbers are not decoration — they are the chart itself. A Sun at 14° Libra is not a "vibe"; it is a position computed from an ephemeris at a specific Julian Day. A Bazi 月令(yuè lìng) — Month Branch — is not a poetic suggestion; it is determined by the solar term (节气 jié qì) that governs the calendar boundary. Get these wrong and every sentence the AI writes afterwards is built on sand.

This article explains a design principle that most users never see but that separates serious astrology software from chatbots wearing a horoscope costume: the deterministic engine computes first; the language model narrates second. The order matters. Reverse it, and you no longer have astrology — you have fiction with planetary names attached.

1. Two Very Different Jobs

An astrology reading does two things, and they require two different kinds of tool:

  1. Astronomical / calendrical computation — given a date, time and place, where are the planets? Which sign is rising? Which Bazi pillar falls where? This is pure math: spherical astronomy, Julian-day arithmetic, stem-branch cycles, solar-term boundaries.
  2. Interpretation — given those computed positions, what patterns emerge, and how do they speak to the querent's question? This is synthesis, narrative, cultural literacy, and judgment.

The first job has one right answer. The second has many defensible answers. Confusing the two is the single most common architectural mistake in AI divination products.

2. What "Deterministic" Actually Means

A deterministic engine is a piece of software that, given the same inputs, always produces the same outputs — no randomness, no temperature, no sampling. For astrology and Bazi, the inputs are:

Run it twice for the same birth data and you get the same chart down to the arcminute. That is not a limitation — it is the definition of a chart. If two runs disagree, one of them is wrong.

Why this matters for AI. A large language model is, by design, non-deterministic. Ask it the same question twice and you get two different answers. That is fine for prose. It is catastrophic for planetary positions. The model does not "know" that Mars was at 17° Capricorn on 14 March 1985 — it has to be told, by something that does know.

3. The Architecture That Actually Works

The design we run in production — and the one any serious astrology product should run — has three layers, strictly ordered:

Layer 1: The deterministic engine

Astronomical computation. In our stack this is a Swiss-Ephemeris-backed natal engine for Western astrology (AstrologyEngine computing planetary longitudes, house cusps, aspects) and a stem-branch engine for Bazi (bazi_engine with modules for 排盘 pá pán chart casting, 用神 yòng shén Useful God extraction, 格局 gé jú pattern determination, 大运 dà yùn Luck Pillars, and 流年 liú nián annual fortune). Every function is pure: same inputs, same outputs, covered by golden-case tests.

Layer 2: The structured handoff

The engine emits a structured description of the chart — JSON, not prose. Planet positions, house placements, aspect grid, pattern labels, Useful God, Favorable and Unfavorable Gods (喜神 xǐ shén / 忌神 jì shén). This is the contract between "math" and "language". The language model is allowed to see this contract; it is not allowed to rewrite it.

Layer 3: The narrative model

Only here does the LLM enter. Its job is to read the structured chart and the querent's question, then produce a coherent, culturally literate interpretation. It can choose metaphors, emphasis, and tone. It cannot choose Mars's longitude.

Reverse this order — let the LLM "imagine" a chart and then justify it — and you have inverted the epistemology. The output may sound astrological, but it is unmoored from the sky.

4. A Concrete Example: Why the LLM Cannot Be Trusted with Numbers

Take a well-known test case: a person born 23 September 1990, 14:30, in Shanghai. The Bazi chart is:

PillarStemBranch
Year庚 Gēng (Yang Metal)午 Wǔ (Horse, Fire)
Month乙 Yǐ (Yin Wood)酉 Yǒu (Rooster, Metal)
Day甲 Jiǎ (Yang Wood)子 Zǐ (Rat, Water)
Hour辛 Xīn (Yin Metal)未 Wèi (Goat, Earth)

The Day Master is 甲 Jiǎ Wood, born in 酉月 Yǒu month — the peak of autumn, when Metal is strongest and Wood is at its seasonal decline. Classical doctrine (Zi Ping Zhen Quan, chapter 8, "On the Useful God") is explicit: the Useful God is sought first in the Month Branch. Here the Month Branch hides 辛 Xīn Metal — the 正官 zhèng guān Direct Officer of the Jiǎ Wood Day Master — so the chart is structurally a Direct Officer pattern.

If you ask a general-purpose LLM to "generate a Bazi reading" for this birth data without first running it through an engine, three things go wrong, every time:

  1. The Month Branch drifts. The model will sometimes place this birth in 申 Shēn month or 戌 Xù month, because it is recalling approximate patterns rather than computing the solar-term boundary (Bái Lù → Hán Lù → Lì Dōng; 酉 month runs from Bái Lù around 8 September to Hán Lù around 8 October — 23 September is firmly inside).
  2. The Useful God is invented. Without the engine's determination of Day Master strength and pattern, the model picks a plausible-sounding element. It might say "you need more Fire" because Wood needs Fire to shine — true in some charts, wrong in this one, where the Officer is already strong and adding Fire would drain an already-weak Wood Day Master.
  3. The narrative is built on the wrong chart. Every sentence that follows — about career, relationships, luck cycles — is internally consistent with a chart that does not belong to this person.

This is not a hypothetical failure mode. It is the default failure mode of every "AI astrologer" that skips the deterministic layer.

5. The Classical Sources Agree With the Architecture

The separation between computation and interpretation is not a modern engineering preference — it is embedded in the classical texts themselves.

Shen Xiaozhan (沈孝瞻), in the 子平真诠 Zǐpíng Zhēnquán (Zi Ping Zhen Quan), opens the chapter on the Useful God with a rule that reads like a specification document:

"八字用神,专求月令,以日干配月令地支,而生克不同,格局分焉。财官印食,此用神之善而顺用之者也;煞伤劫刃,用神之不善而逆用之者也。"

— Zi Ping Zhen Quan, chapter 8, "On the Useful God" (Shen Xiaozhan, original text)

Translation: "The Useful God of the Eight Characters is sought specifically in the Month Branch. Match the Day Stem to the Month Branch, and from the generating and overcoming relations the patterns are divided. Wealth, Officer, Resource, Eating God — these are the good Useful Gods, to be used in forward order. Killings, Hurting Officer, Rob Wealth, Blade — these are the difficult Useful Gods, to be used in reverse order."

Notice the structure of the rule. First, compute the relationship between Day Stem and Month Branch. Then, classify the Useful God into one of two categories. Only then does interpretation begin — "forward use" or "reverse use". The computation is logically prior to the reading. A model that tries to interpret first and compute later is violating a 250-year-old methodological order.

The 滴天髓 Dītiānsuǐ (Di Tian Sui) takes a different philosophical route — waxing-and-waning (旺衰 wàng shuāi) and balance (中和 zhōng hé) rather than pattern — but it agrees on the sequencing. Its famous line:

"旺则宜洩宜伤,衰则喜帮喜助,子平之理也。"

— Di Tian Sui, "On Waxing and Waning"

"When flourishing, either drain or restrain; when declining, then support and assist — this is the principle of Zi Ping." The words "flourishing" and "declining" are computed quantities: they come from comparing the Day Master's seasonal strength, root-count, and helper-stems. They are not vibes.

6. Where the Two Schools Diverge — and How an Engine Picks

The Zi Ping Zhen Quan (pattern method, 格局法) and the Di Tian Sui (strength-and-balance method, 旺衰中和法) are the two great rivers of Bazi interpretation. They often agree on outcomes but disagree on why. A deterministic engine cannot be agnostic — it must implement one rule set, clearly, so that its outputs are auditable.

Our engine's yongshen.py module takes the Zi Ping Zhen Quan position as its primary grammar: the Useful God is derived from the Month Branch pattern, and the priority order is Climate Adjustment (调候 tiáo hòu) > Pattern > Supporting/Restraining. This is a defensible scholarly choice, not a universal truth; the Di Tian Sui school would prioritise balance first. What matters for the user is that the choice is explicit and traceable — you can read the code, you can read the classical source, and the two line up.

A pure-LLM product cannot make this choice visible, because it has no code to inspect. It produces a reading that may blend the two schools in unknowable proportions, and the user has no way to challenge it.

7. The Same Principle Applies to Western Astrology

Western natal astrology is equally computational. A chart is built from:

Each of these steps is deterministic and checkable against published ephemerides. If your "AI astrologer" tells you your Sun is in Scorpio when your birth data puts it at 4° Libra, no amount of eloquent interpretation will save the reading. The chart is wrong. The engine failed before the model ever spoke.

This is why we insist on a hard boundary: the engine computes; the model narrates. There is no step where the model is allowed to correct the engine's numbers. If the numbers look wrong, the bug is in the engine's code, not in the prose.

8. True Solar Time: A Case Study in Why the Engine Must Go First

Consider one specific computation that most astrology apps skip entirely: 真太阳时 zhēn tàiyáng shí, True Solar Time. Clock time is a legal convention — a time zone averaged across a region. Local solar time depends on your exact longitude. And "true" solar time adds the Equation of Time, the annual wobble caused by the Earth's elliptical orbit and axial tilt.

Our bazi_engine/solar_time.py module computes both corrections:

For a birth in Ürümqi (87.6°E) on a date when the Equation of Time is −14 minutes, the combined correction from Beijing-time clock time is roughly −2 hours and 40 minutes. That can shift the Hour Pillar — and sometimes the Day Pillar — entirely. A person born at 23:20 local clock time might actually be a Zi-hour baby of the next day once True Solar Time is applied, which changes their Day Stem and therefore their entire chart.

An LLM cannot perform this correction, because it does not know the birth longitude to arc-minute precision, and it cannot evaluate the Equation of Time for an arbitrary date. The computation must happen before the model sees the chart. This is the deterministic-first principle in its purest form.

9. How to Tell If a Product Is Engine-First or Model-First

If you are evaluating an astrology or Bazi product, here is a short diagnostic:

  1. Ask for the same chart twice. If the planetary positions or pillar stems change, it is model-first. Walk away.
  2. Give it an edge case. A birth exactly on a solar-term boundary, or a True-Solar-Time shift that crosses midnight. A deterministic engine handles these correctly (or flags them); a model will guess.
  3. Ask where the numbers come from. A serious product will point you at an ephemeris, a house-system algorithm, or a stem-branch module. A model-first product will give you a prose answer about "ancient wisdom".
  4. Check the classical references. If the product quotes the Zi Ping Zhen Quan but applies the Useful God by Day Master strength alone (ignoring the Month Branch pattern rule), it is blending schools without telling you. That is a model artefact, not a scholarly choice.

10. What This Means for the User

The deterministic-first architecture is not a technical curiosity — it is the reason a reading can be trusted. When you receive an EchoReading chart, every number in it is reproducible. You can, in principle, take the same birth data to any competent astrologer, or to any competing engine, and get the same positions back. What differs is the interpretation — and that is where the language model, and the human tradition behind it, earn their keep.

The engine guarantees that the conversation starts from the real sky and the real calendar. The narrative layer guarantees that the conversation is meaningful. Neither can do the other's job, and the product is only as good as the boundary between them.

Try it yourself. EchoReading's free divination tools (Bazi, I Ching, Tarot, Western Astrology) all run through this three-layer pipeline. The engine computes; the model narrates; the classical sources are cited. If any number looks wrong, tell us — we would rather fix the engine than polish the prose.

Further Reading

Start Your Reading Now