How to Use LLMs for Investment Research Reports: Prompt Design and Production Workflow

    This article explores how large language models (LLMs) can be applied to generate research reports on listed companies. It covers a complete end-to-end workflow—from data collection and retrieval-augmented generation (RAG) to fact-checking and human review—with a strong focus on prompt engineering to ensure factual accuracy and professional structure. The article also discusses key challenges such as data recency, numerical hallucinations, and regulatory compliance, along with practical mitigation strategies and an evaluation framework for model output quality.

    Why Writing an Equity Research Report Is a True Test of LLM Capabilities

    Writing an equity research report may appear to be a long-form writing task, but it actually functions as a multidimensional stress test for large language models:

    • Long-context comprehension: A listed company’s annual report often spans hundreds of pages, containing financial statements, footnotes, management discussion, and risk factors. The model must extract and synthesize information across chapters to turn scattered figures and narratives into a coherent analysis.
    • Numerical reasoning and cross-validation: Core metrics in research reports often require cross-statement calculations, such as deriving return on equity from both the income statement and balance sheet, or performing year-over-year and quarter-over-quarter comparisons. Errors at the decimal level can undermine the credibility of the conclusions.
    • Structured output and professional language: Research reports follow a conventional framework—company overview, industry analysis, financial analysis, valuation discussion, and risk warnings. The terminology density and cautious tone demand both strong format adherence and domain knowledge from the model.
    • Near-zero tolerance for factual errors: In financial contexts, the tolerance for hallucinations is almost nonexistent. A single fabricated figure can mislead a reader into making a wrong decision.

    For this reason, “asking the model to independently produce a qualified research report” has become a benchmark for evaluating model capability in the financial domain. For developers, it is also an excellent scenario for practicing prompt engineering, retrieval-augmented generation, and output evaluation.

    An End-to-End Workflow: From Raw Materials to Final Draft

    A reliable model-generated research report is not produced by a single prompt. It requires a closed-loop pipeline.

    Data Collection and Preprocessing

    Organize source materials into three layers:

    • Company level: periodic reports (annual, interim, quarterly), major announcements, and prospectuses.
    • Industry level: statistical data and competitive landscape reports from industry associations and research institutions.
    • News level: news coverage and earnings call transcripts related to the company from the past one to two quarters.

    During preprocessing, it is recommended to convert all materials into plain text or structured tables, remove irrelevant noise, and build a “data whitelist” table for key financial figures to be used in later validation.

    Knowledge Injection: Retrieval-Augmented Generation Over Full-Context Feeding

    When the total volume of materials exceeds the model’s context window, a retrieval-augmented generation (RAG) approach is recommended: slice documents, embed them into a vector database, and retrieve the most relevant fragments by chapter topic for injection into the prompt. Compared with feeding the entire corpus at once, RAG controls token costs and reduces interference from irrelevant content. If the material scale is manageable, directly appending cleaned documents to the prompt as an appendix can also work—the key is to ensure the model has reliable sources to rely on.

    Generation and Iteration

    Do not expect a perfect output on the first attempt. A more effective practice is to generate chapter by chapter and refine iteratively: first ask the model to produce a report outline, then expand each chapter only after the framework has been approved. After each chapter is generated, ask targeted follow-up questions, such as “Please add an analysis of the reasons behind gross margin changes over the past three years in the financial analysis section.”

    Fact-Checking and Human Review

    After the draft is completed, it must be checked item by item against the data whitelist: Can every number be traced back to the source material? Are the calculations correct? Are the qualitative conclusions supported by data? The model-generated draft should only be treated as a high-quality draft—human review before publication is non-negotiable.

    Prompt Design: The Core Variable in Draft Quality

    Below is a prompt template that has been tested in practice. It can be reused directly or adapted as needed:

    1. # Role
    2. You are a securities research analyst with ten years of experience,
    3. skilled at writing well-structured, data-driven research reports
    4. on listed companies.
    5. # Task
    6. Based strictly on the information in the [Reference Materials],
    7. write a research report on the target company in Chinese
    8. for internal research and discussion purposes.
    9. # Report Structure
    10. 1. Company Overview: main business, business model, development history
    11. 2. Industry Analysis: market size, competitive landscape, key drivers
    12. 3. Financial Analysis: revenue and profit trends, profitability, expenses, and cash flow
    13. 4. Valuation Discussion: common valuation methods and their applicability (no target price)
    14. 5. Risk Warnings: operational, policy, and market risks
    15. # Hard Constraints
    16. 1. All financial data must come from the [Reference Materials]
    17. and include source citations;
    18. any data not covered by the materials must be marked as
    19. "not provided in the materials." Fabrication or speculation is strictly prohibited;
    20. 2. Any forward-looking statements must list the underlying assumptions
    21. and use cautious wording such as "expected" or "likely";
    22. 3. Include a disclaimer at the end of the report stating that the content
    23. is for research reference only and does not constitute investment advice;
    24. 4. Output in Markdown format with clear hierarchies,
    25. and present key data in tables.

    The design logic behind this template deserves closer examination:

    • Role setting: Assigning the model a specific professional identity noticeably improves the tone and domain terminology of the output.
    • Structure constraints: Predefining the chapter framework prevents the model from producing a disorganized structure and makes it easier to evaluate quality chapter by chapter.
    • Factual constraints: This is the most important rule in the financial domain. Requiring the model to state “not provided in the materials” gives it a legitimate way to decline answering, which suppresses hallucinations more effectively than forcing a guess.
    • Compliance constraints: Refusing to provide a target price and requiring a disclaimer are necessary measures to avoid regulatory risk by design.

    Three Major Challenges and Mitigation Strategies

    Data Recency

    The model’s knowledge has a cutoff date, but financial data continuously updates. The solution is to offload real-time data requests to external systems: retrieve the latest financial reports and market data via RAG or tool calls. The model is responsible only for analysis and expression, not for memorizing up-to-date facts.

    Numerical Hallucination

    Even with source constraints, LLMs may still mix up numbers or make unit conversion errors in long-form generation. Practical countermeasures include:

    1. Limiting the length of each generation pass—write chapter by chapter to reduce context pressure.
    2. Requiring the model to cite the source when referencing data, such as “per page X of the annual report,” to enable programmatic verification.
    3. Adding an independent validation step, using a rule-based script or another model call to compare every number in the draft against the whitelist and flag mismatches automatically.

    Compliance and Wording Risks

    Securities research is a highly regulated field. Generated content must avoid definitive price predictions and stock-recommendation language, include a disclaimer, and go through a human review process to ensure the wording meets internal compliance standards.

    Engineering Implementation and Evaluation

    The workflow outlined above can be implemented as a code skeleton (pseudocode):

    1. def generate_report(company: str):
    2. # 1. Data layer: fetch and clean multi-source materials
    3. filings = fetch_filings(company) # periodic reports and announcements
    4. news = fetch_news(company, days=90) # recent news
    5. industry = fetch_industry_data(company) # industry statistics
    6. context = build_context(filings, news, industry)
    7. # 2. Generation layer: outline confirmation + chapter-by-chapter writing
    8. outline = llm(render_prompt(OUTLINE_TPL, context))
    9. draft = "\n".join(
    10. llm(render_prompt(CHAPTER_TPL, context, outline, ch))
    11. for ch in outline.chapters
    12. )
    13. # 3. Validation layer: number tracing and consistency checks
    14. checked = fact_check(draft, whitelist=build_whitelist(filings))
    15. # 4. Revision layer: targeted fixes for identified issues
    16. final = llm(render_prompt(REVISE_TPL, checked))
    17. return human_review(final) # deliver after manual review

    For evaluation, a multidimensional scoring system is recommended to compare different models or prompt versions on the same task:

    • Factual accuracy (highest weight): Can numbers and conclusions be traced to sources?
    • Logical rigor: Are arguments and evidence internally consistent? Is the reasoning chain complete?
    • Structural completeness: Is the chapter framework complete and well organized?
    • Professional expression: Is terminology accurate and wording cautious?
    • Compliance: Does it include a disclaimer? Are there any inappropriate statements?

    Use multiple independent reviewers with blind scoring and take a weighted average to reduce subjective bias. This “unified task + unified scorecard” approach is also the most reliable way to determine which model is best suited for your specific financial use case—the conclusion should come from your own evaluation set, not from scores published by others.

    It is worth noting that the engineering implementation does not depend on any specific platform. Regardless of which cloud provider’s LLM services you choose—for example, Baidu AI Cloud or other platforms offering model invocation and knowledge retrieval capabilities—the workflow described above can be ported without major changes. The differences mainly appear in model domain performance and the usability of the retrieval components.

    Summary

    Using LLMs to write equity research reports is essentially a combination of four components: retrieval-augmented generation, carefully designed prompts, fact-checking, and human review. It is not a one-shot Q&A task. For developers, the value of this scenario goes beyond producing a single report. It fully covers general engineering challenges such as long-text processing, structured generation, hallucination suppression, and output evaluation. These methodologies can also be transferred to other high-stakes professional writing scenarios, such as due diligence reports, industry analyses, and prospectus summaries. Building a solid workflow first, then selecting the model, is the right order for successfully delivering this type of project.