AI Fortune-Telling with LLMs: Role-Play Prompts and Engineering Practices

    This article explains how large language models are used in AI fortune-telling, a popular entertainment trend on Chinese social platforms. It covers why models can convincingly role-play fortune-tellers, how to structure system prompts, the main technical limits, including calculation errors and hallucinations, and the architecture and privacy issues developers should consider.

    In recent years, as Chinese large language models have become widely available, “AI fortune-telling” has spread quickly across major social media platforms. Users write specific “mystical prompts” that guide models through astrological calculations, tarot readings, and similar practices. The trend did not start recently. Early general-purpose LLMs and some dedicated fortune-telling apps also offered these features. However, as Chinese models have improved rapidly, their realism and logical consistency have reached a new level.

    From a technical perspective, this trend is more than entertainment. It shows how LLMs handle complex role-play, instruction following, and context understanding. For developers, analyzing the technical logic behind AI fortune-telling helps clarify the limits of LLMs, best practices in prompt engineering, and core issues such as security and privacy.

    1. The Technical Core: Role-Play in LLMs

    AI fortune-telling depends on the strong instruction-following and in-context learning abilities of large language models. Traditional text generation models could mostly continue a passage. Modern LLMs can understand and execute complex system instructions.

    When a user enters a carefully designed mystical prompt, the model effectively switches context. It moves from a neutral AI assistant to a persona with a specific identity, such as a “senior fortune-telling master,” a specific vocabulary, such as Heavenly Stems, Earthly Branches, and Ten Gods, and a specific output logic. This ability relies on knowledge the model absorbed from large pretraining datasets and on the instruction compliance developed during fine-tuning.

    2. Practical Prompt Engineering for Fortune-Telling

    To build an AI fortune-telling application that works well and provides a good user experience, prompt engineering is the key factor. A strong mystical prompt usually includes several layers.

    1. Persona and System Settings

    First, the model needs a clear identity and boundaries. This includes its background, behavioral rules, and tone.

    1. # System Settings
    2. You are a senior master of traditional Chinese fortune-telling (Bazi and Zi Wei Dou Shu) and Western astrology.
    3. Your tone should be calm, wise, and empathetic.
    4. When responding, strictly follow the traditional logic of fortune-telling, and never acknowledge that you are an AI or a language model.

    2. Rule Injection and Knowledge Simulation

    LLMs have general knowledge, but in specialized domains like fortune-telling, they often have gaps or produce inconsistent logic. Developers need to inject core inference rules into the prompt.

    1. # Inference Rules
    2. 1. After the user provides their birth date and time, first build the chart by listing the corresponding Heavenly Stems and Earthly Branches.
    3. 2. Analyze the strength of the five elements and determine whether the Day Master is strong or weak.
    4. 3. Based on the relationships among the Ten Gods, infer the user's career, wealth, and marriage status.
    5. 4. If information is insufficient, actively ask the user for it. Do not fabricate details.

    3. Standardized Output Format

    To make results feel more ritualistic and easier to read, developers often enforce a strict output format, such as a fixed structured text layout.

    1. # Output Format
    2. Please structure your reply as follows:
    3. [Chart Overview]: Briefly describe the distribution of the five elements.
    4. [Career Outlook]: Analyze based on the current year (annual fortune).
    5. [Seeking Good Fortune and Avoiding Misfortune]: Give three specific life suggestions.

    3. Technical Challenges: Logical Reasoning and Hallucinations

    Strong prompts can greatly improve the fortune-telling experience. In real deployments, however, developers still face several inherent weaknesses of LLMs.

    1. Weakness in Complex Calculations

    Traditional fortune-telling, such as Bazi chart construction, requires complex calculations with Heavenly Stems and Earthly Branches and solar terms. LLMs are probabilistic text prediction engines, so they often make errors in precise mathematical work. For example, after a user enters a birth time, the model may calculate the Four Pillars incorrectly, which makes the entire reading wrong.

    Solution: In enterprise applications, LLMs should not handle calculations. A better architecture uses an external tool pattern. With Function Calling, the LLM identifies the user’s intent and calls an external, precise chart-calculation API or script. The results, such as the accurate Bazi chart data, are then returned to the LLM, which interprets them in text.

    2. Controlling Hallucinations

    In fortune-telling scenarios, models tend to hallucinate to match user expectations. They may invent nonexistent concepts or give contradictory readings.

    Solution: Add a self-check step to the prompt, asking the model to verify its logic before producing output. You can also lower the temperature setting to reduce randomness and make the output more consistent.

    4. Enterprise Lessons and Security Considerations

    AI fortune-telling is largely an entertainment scenario, but the application patterns it reveals are relevant to serious enterprise use.

    1. Protecting Sensitive Data

    Fortune-telling typically requires users to provide birth dates, birth times, and sometimes real names. This is highly sensitive personal data. Sending it directly to a third-party LLM API carries a significant risk of data leakage. Applications that collect sensitive information should de-identify data on the device before sending it, or use a privately deployed model so that data stays within the organization’s control.

    2. Psychological Influence and Compliance Risks

    LLM-generated text can be persuasive. When it discusses fortune, luck, or good and bad outcomes, it can suggest conclusions to users or steer their beliefs. Developers should add content safety filters to prevent the model from giving advice on medical diagnoses or major financial decisions that could cause real-world harm.

    5. Summary

    From “mystical prompts” on social media to rigorous engineering practice, AI fortune-telling shows how LLMs are applied in natural language understanding and generation. It demonstrates how prompt engineering shapes model behavior, and it exposes the limits of LLMs in logical calculation and hallucination control. For developers, the value lies in looking past the entertainment and understanding the technical core. Using a hybrid architecture, where external tools handle calculation and the LLM handles interpretation, is a practical way to apply LLMs to a wider range of vertical industry scenarios.