Slice Planner - How it Works

*Updatate (2/5/25) HA - Removed the REGEX Fallback. Running raw dog with 4.1 at the moment. This is to exploit the parametric memory for equity - ticker mapping and also to leave the door open for mapping user queries more precisely to specific slices. Currently all slices share the same user query.

Purpose

The slice planner breaks down broad financial research queries into specific "slices" that can be individually analysed. Each slice represents a specific company (ticker) for a particular fiscal year and quarter.

Incredibly important.

Output Format

Each slice contains:

  • Core identifiers: ticker, fiscal year (fy), fiscal quarter (fq)
  • Context: original query preserved for reference

This standardised format enables consistent downstream processing across the analysis pipeline.

Detailed Overview: The Financial Slice Planner

Core Architecture

The slice planner transforms natural language financial research queries into structured "slice specifications" for targeted analysis. It employs a dual approach:

  1. Primary: Structured LLM Processing
    • Leverages a specialized financial LLM to parse the query
    • Attempts to extract financial entities and relationships
    • Returns standardized JSON with slice specifications
  2. Secondary: Robust Pattern-Based Heuristics
    • Activates automatically when LLM processing fails
    • Provides reliable fallback capabilities

Query Types Supported

Company-Specific Analysis

"Analyze revenue growth for AAPL in Q2 2023"
"Evaluate MSFT's operating margin for FY22"

The planner identifies single company queries and specific time periods.

Comparative Analysis

"Compare KO's performance in Q1 vs Q2 FY23"
"Analyze revenue growth for AMZN from FY21 to FY22"

The system detects comparative language and generates appropriate slice pairs.

Multi-Quarter Analysis

"Examine TSLA's quarterly revenue trend through FY23"
"Compare the gross margin performance of KO on a quarterly basis from FY22 to FY23"

When phrases like "quarterly basis" appear, the planner generates slices for all quarters.

Heuristic Mechanisms

Ticker Identification

  • Pattern matches on uppercase symbols (1-5 characters)
  • Filters out common non-ticker uppercase words (CEO, CFO, AM, PM)
  • Requires at least one valid ticker to proceed

Fiscal Period Detection

  1. Year Extraction
    • Recognizes explicit fiscal year notation: "FY23", "FY 2023"
    • Expands shortened years ("FY23" → 2023)
    • Falls back to standard 4-digit years (2022, 2023)
    • Defaults to current year if none found
  2. Quarter Determination
    • Extracts specific quarters mentioned (Q1, Q2, Q3, Q4)
    • Recognizes "quarterly basis" and similar phrases to include all quarters
    • Defaults to Q4 when no quarters are specified and no quarterly analysis indicated
  3. Combinatorial Generation
    • Produces the Cartesian product of all identified tickers, years, and quarters
    • Each combination becomes a separate slice specification

Edge Case Handling

  • Empty Results: Returns an empty slice list if no tickers found
  • Ambiguous Temporal References: Interprets relative references (e.g., "last quarter") based on current date
  • Comparative Language: Identifies both sides of comparisons to ensure complete analysis
  • Normalization: Standardizes ticker symbols to uppercase and ensures years are in full 4-digit format

This design allows the slice planner to handle a wide range of financial queries with minimal configuration while providing consistent, structured outputs for downstream analysis.