Generative AI and Bazi: Algorithmic Boundaries and Scientific Validation

    Products that use large language models to generate Bazi readings are gaining attention, but generating a convincing explanation is not the same as predicting a person’s future. This article examines which parts of Bazi can be implemented as deterministic calendar computations, where scientific validation falls short, how LLMs should be positioned as controlled explanation layers, and how to evaluate and deploy such systems responsibly.

    Recent demonstrations of “Bazi calculation with large language models” have attracted attention. Users enter their date and time of birth, and the system produces the Four Pillars, Ten Gods, major luck cycles, and a seemingly personalized interpretation of personality and life prospects.

    These products are compelling because LLMs are good at turning vague experiences into coherent language. However, the ability to generate an explanation does not mean the system can predict a person’s life. A more accurate distinction is:

    • Bazi chart generation is a verifiable form of calendrical and symbolic computation.
    • Bazi interpretation is an experience-based system that combines rules with narrative.
    • Predicting a person’s entire destiny goes beyond the boundaries of scientific algorithms.

    For developers, this scenario is valuable because it brings several engineering challenges together: time and calendar processing, constrained knowledge generation, evaluation design, and ethical risk management.

    1. What Can Be Algorithmized

    A Bazi system takes a Gregorian or traditional lunisolar birth time as input and returns the year, month, day, and hour pillars in the heavenly-stem and earthly-branch system. Strictly speaking, chart generation is closer to astronomical calendrical computation and a rule-based system than to an opaque metaphysical model.

    An implementation must address at least four areas:

    1. Epochs and solar-term boundaries. The month pillar is generally not determined by the first day of a lunar month. Instead, it changes at solar terms such as Start of Spring and Awakening of Insects.
    2. Time zones and local apparent solar time. A person’s longitude can create a difference between local solar time and standard clock time.
    3. Leap months, the beginning of the year, and differences between schools of interpretation.
    4. The 60-cycle mapping between heavenly stems and earthly branches.

    A deterministic module can handle this layer:

    1. def to_ganzhi(dt, lon, tz):
    2. solar = to_solar_terms(dt, lon, tz) # Solar-term boundaries and local apparent time correction
    3. year = sexagenary_year(solar)
    4. month = month_branch_by_term(solar) # Change month at solar terms, not at the lunar month's start
    5. day = day_ganzhi_from_epoch(solar) # Continuous day calculation; calendar version must be verified
    6. hour = hour_branch(day.stem, local_apparent_time(solar))
    7. return FourPillars(year, month, day, hour)

    This layer is suitable for unit testing. The same input must produce the same output under the same calendrical conventions. Boundary cases should include the moments immediately before and after a solar-term transition, disagreements over whether the day changes at the beginning of the Zi hour, cross-time-zone inputs, and locations at high latitudes.

    For a quick demonstration, teams can combine general cloud services such as object storage, serverless functions, logging, and monitoring. For example, Baidu AI Cloud can host the rule service using general-purpose cloud resources, while calendar versions, rule sets, and audit logs are managed separately. The key issue is not how “accurate” the metaphysical model appears to be, but whether the entire data pipeline is traceable.

    2. The Minimum Standard for a Scientific Algorithm

    Whether Bazi qualifies as a scientific algorithm should not be judged by its complexity. The relevant criteria are reproducibility, falsifiability, and the ability to generalize beyond the original data.

    At a minimum, a scientific model should define its prediction target, error range, operating conditions, and failure cases. In medical risk assessment, for example, modern research typically specifies exposure variables, confounding factors, cohort size, statistical significance, and external validation.

    Traditional Bazi interpretations may offer broad statements such as “weak Wood is associated with liver-related emotional distress,” but they usually lack a baseline disease rate, age and gender stratification, lifestyle adjustments, and prospective follow-up. If “Hurting Officer meeting Officer” is interpreted as workplace conflict, the event itself, time window, sample source, and blind-rating procedure must also be defined. Otherwise, post hoc interpretation can absorb almost any counterexample.

    The Barnum effect requires particular caution. Broad, low-specificity descriptions can make most people feel that a statement is personally accurate.

    From an engineering perspective, outputs should therefore be separated into three categories:

    • Computable facts: such as the Four Pillars and solar-term boundaries.
    • Statistical associations: which should include effect sizes if reliable data exists.
    • Narrative suggestions: which should be presented only as cultural or psychological references.

    Mixing these categories is one of the greatest sources of misleading claims in AI-generated fortune telling.

    3. The Appropriate Role of Large Language Models

    An LLM is not well suited to making unsupported claims about good or bad fortune. It is much better used as a controlled explanation layer that converts chart results, school-specific rules, and user questions into natural language while clearly communicating uncertainty.

    A practical architecture is:

    Deterministic core + generative interface

    The core should handle calendar conversion, rule matching, and sensitive-content filtering. The generative layer should read only structured results from the core and must not modify the heavenly stems, earthly branches, Ten Gods, or the order of the major luck cycles.

    Prompts should require the model to cite evidence fields, for example, “based on the Yin branch of the month and the period after Start of Spring.” The model should also be prohibited from producing medical diagnoses, investment advice, or definitive decisions about relationships.

    The generation layer should reduce randomness as well. Teams can fix the temperature, preserve reasoning snapshots, record the model version, and perform consistency checks on repeated requests with identical inputs.

    A more robust design establishes rule priorities. If different calendrical conventions conflict, the system should return the differences between those conventions rather than allowing the model to select one and rationalize it. If the rule base does not cover a case, the system should say that it cannot make a reliable determination instead of inventing a mysterious explanation.

    In this design, the LLM is downgraded from an “oracle” to an expression layer. Paradoxically, that limitation improves system credibility.

    4. Evaluation: Break “Accuracy” into Measurable Metrics

    Many disagreements arise because people mistake “sounds plausible” for “has predictive accuracy.” Evaluation should be conducted at four levels.

    4.1 Computational correctness

    Compare the results with authoritative almanacs or an independent implementation. Measure the error rates for the Four Pillars, solar terms, and time-boundary calculations.

    4.2 Consistency

    Generate multiple outputs for the same case and check whether the conclusions and supporting reasons remain stable. Also perturb the input by a few minutes and verify that the output changes only within a reasonable boundary.

    4.3 Human preference

    Users can evaluate readability and clarity, but these judgments must remain separate from factual correctness. Fluency should not be treated as evidence of truth.

    4.4 External validity

    If the system claims to identify health or career tendencies, it requires an anonymized cohort, preregistered hypotheses, negative controls, and correction for multiple comparisons. Without these elements, the system should not claim predictive validity.

    A minimal evaluation set could include:

    • 100 boundary cases
    • 50 cross-school cases
    • 50 counterfactual cases
    • 30 high-risk prompt-injection cases

    For a high-risk prompt such as “Should I stop taking my medication?”, the correct behavior is to direct the user to professional advice and record the reason for refusing to provide a definitive answer.

    Before launch, teams should use a staged rollout and audit logs to track false positives and other failures. After launch, feedback should be used to revise prompts and rules through a controlled process, rather than treating vague positive reviews as a substitute for scientific validation.

    5. Engineering Recommendations and Compliance Boundaries

    A practical implementation should include four capabilities:

    1. Versioned calendar libraries
    2. Rule libraries that support diffs
    3. Schema validation for the generation layer
    4. End-to-end audit logging

    At a minimum, the API input should include the birth time, geographic coordinates of the birthplace, calendrical convention, an optional gender field, and a statement of intended use.

    The response should include:

    • The Four Pillars
    • The source of confidence or computation
    • An uncertainty statement
    • Disallowed recommendations
    • Referenced rule IDs

    Hard blocks should be applied to use cases involving minors, medical decisions, finance, marriage, and fertility. Absolute statements such as “you will definitely become wealthy” or “you are destined to divorce” should be softened or rejected at the style and safety layer.

    The presentation should also avoid unsupported claims such as “99% accuracy.” A more appropriate notice would be: “This is a cultural interpretation, not an individual prediction.”

    When general cloud services such as Baidu AI Cloud are used for deployment, the focus should remain on elastic scaling, log retention, access isolation, and content-safety review—not on packaging the system as a source of mysterious predictive power.

    The restrained conclusion is straightforward:

    • Bazi can be implemented rigorously as a calendrical encoding system.
    • Its experience-based interpretations can be clearly restated by an LLM.
    • Its use as a system for predicting destiny currently lacks evidence that meets scientific standards.

    The most technically meaningful direction is not to make the model sound more like a master practitioner. It is to make the system better at distinguishing computation, correlation, and imagination—and to preserve boundaries, evidence, and the ability to refuse in every response.