Kronos: A Foundation Model for the Language of Financial Markets
This report presents the forensic synthetic code analysis of shiyu-coder/Kronos, a Python project with 32,141 GitHub stars. SynthScan v2.0 examined 78,563 lines of code across 73 source files, recording 217 pattern matches distributed across 12 syntactic categories. The overall adjusted score of 3.4 places this repository in the Likely human-written band.
The scanner applied 160+ deterministic lexical heuristics, multi-line block detectors, abstract syntax tree depth profilers, and a cross-file Jaccard similarity matrix to construct a statistically normalised synthetic code estimate. All matches are individually weighted by severity coefficient and contextual multiplier before summation, and the resulting headline score is temporally discounted to account for the repository's development history relative to the commercial emergence of large language model coding tooling (November 2022 onward).
This chart maps the temporal evolution of the adjusted synthetic code score across successive scan runs. An upward trajectory indicates ongoing incorporation of AI-generated code or expanding LLM-assisted scaffolding; a stable or declining trajectory may reflect active human refactoring, code removal, or the adoption of stricter authorship policies. The dashed secondary line (right axis) independently tracks total raw pattern hit count, which can diverge from the normalised score when codebase size changes significantly between scans.
Classifies detected patterns by their diagnostic confidence and structural impact. CRITICAL patterns (coefficient 10) represent definitive synthetic signatures — hallucinated imports, explicit LLM attribution metadata — virtually never produced by human authors. HIGH (5) indicates strong structural tells such as cross-file repetition or cross-linguistic idioms. MEDIUM (2) covers recognisable conversational padding and AI-specific vocabulary. LOW (1) captures subtle indicators like tautological comments and generic boilerplate that require density to carry independent signal.
This horizontal bar chart decomposes the repository's raw synthetic code score by top-level directory, allowing you to pinpoint precisely which modules or components carry the highest AI authorship density. Directories with disproportionately high scores relative to their size warrant targeted manual review: concentrated AI signatures often trace back to mass-generated configuration layers, auto-ported test suites, LLM-scaffolded boilerplate classes, or entire subsystems authored under heavy copilot assistance. Use this view to prioritise your human code-review effort.
The scanner identified 217 distinct pattern matches across 12 syntactic categories. Each entry below represents a discrete location in the source code where the engine recorded a statistically significant AI authorship indicator. Expand any category row to inspect the individual file paths, line numbers, code snippets, and the lexical context (CODE, COMMENT, or STRING) in which each match was detected.
Reading the findings table: The Severity column indicates the diagnostic confidence level (CRITICAL / HIGH / MEDIUM / LOW). The Context column identifies whether the match occurred inside executable code, an inline comment, or a string literal — comment-context matches receive a ×1.5 weight because LLMs systematically over-annotate. The ⚡ bolt icon marks clustered matches: three or more patterns within a 10-line window, each receiving an additional ×1.5 density multiplier as dense clusters constitute far stronger evidence of synthetic authorship than isolated hits.
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| MEDIUM | finetune/config.py | 9 | # ================================================================= | COMMENT |
| MEDIUM | finetune/config.py | 11 | # ================================================================= | COMMENT |
| MEDIUM | finetune/config.py | 30 | # ================================================================= | COMMENT |
| MEDIUM | finetune/config.py | 32 | # ================================================================= | COMMENT |
| MEDIUM | finetune/config.py | 43 | # ================================================================= | COMMENT |
| MEDIUM | finetune/config.py | 45 | # ================================================================= | COMMENT |
| MEDIUM | finetune/config.py | 72 | # ================================================================= | COMMENT |
| MEDIUM | finetune/config.py | 74 | # ================================================================= | COMMENT |
| MEDIUM | finetune/config.py | 96 | # ================================================================= | COMMENT |
| MEDIUM | finetune/config.py | 98 | # ================================================================= | COMMENT |
| MEDIUM | finetune/config.py | 109 | # ================================================================= | COMMENT |
| MEDIUM | finetune/config.py | 111 | # ================================================================= | COMMENT |
| MEDIUM | finetune/qlib_test.py | 28 | # ================================================================================= | COMMENT |
| MEDIUM | finetune/qlib_test.py | 30 | # ================================================================================= | COMMENT |
| MEDIUM | finetune/qlib_test.py | 92 | # ================================================================================= | COMMENT |
| MEDIUM | finetune/qlib_test.py | 94 | # ================================================================================= | COMMENT |
| MEDIUM | finetune/qlib_test.py | 203 | # ================================================================================= | COMMENT |
| MEDIUM | finetune/qlib_test.py | 205 | # ================================================================================= | COMMENT |
| MEDIUM | finetune/qlib_test.py | 298 | # ================================================================================= | COMMENT |
| MEDIUM | finetune/qlib_test.py | 300 | # ================================================================================= | COMMENT |
| MEDIUM | examples/get_akshare_date_2024-2025_x.py | 619 | # ===================================================== | COMMENT |
| MEDIUM | examples/get_date_new.py | 651 | # ===================================================== | COMMENT |
| MEDIUM | examples/prediction_akshare_2024-2025.py | 532 | # ========================================================= | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | tests/test_kronos_regression.py | 46 | def test_kronos_predictor_regression(context_len): | CODE |
| LOW | tests/test_kronos_regression.py | 91 | def test_kronos_predictor_mse(context_len, expected_mse): | CODE |
| LOW | examples/get_akshare_date_2024-2025_x.py | 157 | def parse_kline_data_directly(response_text, stock_code, start_year, end_year): | CODE |
| LOW | examples/get_akshare_date_2024-2025_x.py | 353 | def get_stock_data_with_retry(stock_code="002354", start_year=2024, end_year=2025, retry_count=2): | CODE |
| LOW⚡ | examples/prediction_new.py | 664 | def _get_default_market_analysis(self): | CODE |
| LOW⚡ | examples/prediction_new.py | 672 | def _get_default_sector_analysis(self): | CODE |
| LOW⚡ | examples/prediction_new.py | 682 | def _get_default_macro_analysis(self): | CODE |
| LOW⚡ | examples/prediction_new.py | 689 | def _get_default_fundamental_analysis(self): | CODE |
| LOW | examples/prediction_new.py | 89 | def get_stock_data_with_retry_all_history(stock_code="600580", retry_count=2): | CODE |
| LOW | examples/prediction_new.py | 105 | def create_realistic_fallback_data(stock_code="600580"): | CODE |
| LOW | examples/prediction_new.py | 191 | def save_all_history_stock_data(df, stock_code, save_dir): | CODE |
| LOW | examples/prediction_new.py | 284 | def calculate_prediction_parameters(df, target_days=60): | CODE |
| LOW | examples/prediction_new.py | 333 | def calculate_optimal_interval(min_val, max_val): | CODE |
| LOW | examples/prediction_new.py | 363 | def get_stock_price_reference(stock_code, current_price): | CODE |
| LOW | examples/prediction_new.py | 600 | def analyze_company_fundamentals(self, stock_code): | CODE |
| LOW | examples/prediction_new.py | 651 | def _calculate_trend_strength(self, df): | CODE |
| LOW | examples/prediction_new.py | 702 | def enhance_prediction_with_market_factors( | CODE |
| LOW | examples/prediction_new.py | 757 | def calculate_enhanced_adjustment_factor(market_analysis, sector_analysis, macro_analysis, fundamental_analysis): | CODE |
| LOW | examples/prediction_new.py | 826 | def create_comprehensive_market_report(enhancement_info, output_dir, stock_code): | CODE |
| LOW | examples/prediction_new.py | 850 | def generate_analysis_summary(enhancement_info): | CODE |
| LOW | examples/prediction_new.py | 895 | def plot_comprehensive_prediction( | CODE |
| LOW | examples/prediction_new.py | 1148 | def run_comprehensive_kronos_prediction(stock_code, stock_name, data_dir, pred_days, output_dir, history_years=1): | CODE |
| LOW⚡ | examples/prediction_new_GUI.py | 959 | def _get_default_market_analysis(self): | CODE |
| LOW⚡ | examples/prediction_new_GUI.py | 967 | def _get_default_sector_analysis(self): | CODE |
| LOW⚡ | examples/prediction_new_GUI.py | 977 | def _get_default_macro_analysis(self): | CODE |
| LOW⚡ | examples/prediction_new_GUI.py | 984 | def _get_default_fundamental_analysis(self): | CODE |
| LOW | examples/prediction_new_GUI.py | 391 | def get_stock_data_with_retry_all_history(stock_code="600580", retry_count=2): | CODE |
| LOW | examples/prediction_new_GUI.py | 407 | def create_realistic_fallback_data(stock_code="600580"): | CODE |
| LOW | examples/prediction_new_GUI.py | 493 | def save_all_history_stock_data(df, stock_code, save_dir): | CODE |
| LOW | examples/prediction_new_GUI.py | 586 | def calculate_prediction_parameters(df, target_days=60): | CODE |
| LOW | examples/prediction_new_GUI.py | 616 | def generate_trading_dates_only(last_date, pred_len): | CODE |
| LOW | examples/prediction_new_GUI.py | 649 | def calculate_optimal_interval(min_val, max_val): | CODE |
| LOW | examples/prediction_new_GUI.py | 895 | def analyze_company_fundamentals(self, stock_code): | CODE |
| LOW | examples/prediction_new_GUI.py | 946 | def _calculate_trend_strength(self, df): | CODE |
| LOW | examples/prediction_new_GUI.py | 997 | def smooth_prediction_results(prediction_df, historical_df, smooth_factor=0.3): | CODE |
| LOW | examples/prediction_new_GUI.py | 1070 | def apply_post_holiday_adjustment(prediction_df, future_dates, holiday_periods): | CODE |
| LOW | examples/prediction_new_GUI.py | 1105 | def validate_prediction_results(historical_df, prediction_df, max_price_change=0.3): | CODE |
| LOW | examples/prediction_new_GUI.py | 1140 | def run_comprehensive_prediction_gui(stock_code, stock_name, data_dir, pred_days, output_dir, history_years=1, | CODE |
| LOW | examples/prediction_new_GUI.py | 1327 | def enhance_prediction_with_market_factors(historical_df, prediction_df, stock_code, market_analyzer): | CODE |
| LOW | examples/prediction_new_GUI.py | 1369 | def calculate_enhanced_adjustment_factor(market_analysis, sector_analysis, macro_analysis, fundamental_analysis): | CODE |
| LOW | examples/prediction_new_GUI.py | 1410 | def create_comprehensive_market_report(enhancement_info, output_dir, stock_code): | CODE |
| LOW | examples/prediction_new_GUI.py | 1433 | def plot_optimized_prediction_gui(historical_df, base_pred_df, enhanced_pred_df, future_trading_dates, | CODE |
| LOW | examples/get_date_new.py | 23 | def get_stock_data_eastmoney_all_history(stock_code="002354"): | CODE |
| LOW | examples/get_date_new.py | 147 | def parse_kline_data_directly_all_history(response_text, stock_code): | CODE |
| LOW | examples/get_date_new.py | 190 | def get_stock_data_akshare_all_history(stock_code="002354"): | CODE |
| LOW | examples/get_date_new.py | 243 | def get_stock_data_baostock_all_history(stock_code="002354"): | CODE |
| LOW | examples/get_date_new.py | 354 | def get_stock_data_with_retry_all_history(stock_code="002354", retry_count=2): | CODE |
| LOW | examples/get_date_new.py | 378 | def create_sample_data_all_history(stock_code="002354"): | CODE |
| LOW | examples/get_date_new.py | 504 | def display_all_history_data_info(df, stock_code): | CODE |
| LOW | examples/get_date_new.py | 566 | def save_all_history_stock_data(df, stock_code, save_dir="D:/lianghuajiaoyi/Kronos/examples/data"): | CODE |
| LOW | examples/prediction_akshare_2024-2025.py | 78 | def calculate_prediction_parameters(df, target_days=100): | CODE |
| LOW | examples/prediction_akshare_2024-2025.py | 112 | def generate_future_dates_with_holidays(last_date, pred_len): | CODE |
| LOW | examples/prediction_akshare_2024-2025.py | 152 | def plot_prediction_with_details(kline_df, pred_df, future_dates, stock_code="002354", stock_name="股票", pred_len=100, | CODE |
| LOW | examples/prediction_akshare_2024-2025.py | 312 | def generate_prediction_report(close_df, volume_df, pred_df, future_dates, stock_code="002354", stock_name="股票", | CODE |
| LOW | examples/run_backtest_kronos.py | 132 | def calculate_trading_signals(self, hist_df, pred_df, threshold=0.02): | CODE |
| LOW | examples/yuce/historical_backtest.py | 57 | def simulate_model_prediction(self, df, lookback_days=60, pred_days=30): | CODE |
| LOW | examples/yuce/historical_backtest.py | 104 | def calculate_prediction_accuracy(self, results_df): | CODE |
| LOW | model/kronos.py | 389 | def auto_regressive_inference(tokenizer, model, x, x_stamp, y_stamp, max_context, pred_len, clip=5, T=1.0, top_k=0, top_ | CODE |
| LOW | model/module.py | 157 | def get_hard_per_sample_entropy(self, zb_by_sample): | CODE |
| LOW | webui/templates/index.html | 843 | function setupSliderEventListeners() { | CODE |
| 3 more matches not shown… | ||||
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | examples/get_akshare_date_2024-2025_x.py | 152 | except Exception as e: | CODE |
| LOW | examples/get_akshare_date_2024-2025_x.py | 195 | except Exception as e: | CODE |
| LOW | examples/get_akshare_date_2024-2025_x.py | 256 | except Exception as e: | CODE |
| LOW | examples/get_akshare_date_2024-2025_x.py | 348 | except Exception as e: | CODE |
| LOW | examples/prediction_new.py | 84 | except Exception as e: | CODE |
| LOW | examples/prediction_new.py | 472 | except Exception as e: | CODE |
| LOW | examples/prediction_new.py | 543 | except Exception as e: | CODE |
| LOW | examples/prediction_new.py | 596 | except Exception as e: | CODE |
| LOW | examples/prediction_new.py | 647 | except Exception as e: | CODE |
| LOW | examples/prediction_new.py | 1172 | except Exception as e: | CODE |
| LOW | examples/prediction_new.py | 1295 | except Exception as e: | CODE |
| LOW | examples/prediction_new_GUI.py | 311 | except Exception as e: | CODE |
| LOW | examples/prediction_new_GUI.py | 386 | except Exception as e: | CODE |
| LOW | examples/prediction_new_GUI.py | 767 | except Exception as e: | CODE |
| LOW | examples/prediction_new_GUI.py | 838 | except Exception as e: | CODE |
| LOW | examples/prediction_new_GUI.py | 891 | except Exception as e: | CODE |
| LOW | examples/prediction_new_GUI.py | 942 | except Exception as e: | CODE |
| LOW | examples/prediction_new_GUI.py | 1176 | except Exception as e: | CODE |
| LOW | examples/prediction_new_GUI.py | 1319 | except Exception as e: | CODE |
| LOW | examples/prediction_new_GUI.py | 1611 | except Exception as e: | CODE |
| LOW | examples/get_date_new.py | 142 | except Exception as e: | CODE |
| LOW | examples/get_date_new.py | 184 | except Exception as e: | CODE |
| LOW | examples/get_date_new.py | 238 | except Exception as e: | CODE |
| LOW | examples/get_date_new.py | 349 | except Exception as e: | CODE |
| LOW | examples/prediction_akshare_2024-2025.py | 504 | except Exception as e: | CODE |
| LOW | examples/run_backtest_kronos.py | 408 | except Exception as e: | CODE |
| LOW | examples/prediction_cn_markets_day.py | 60 | except Exception as e: | CODE |
| LOW | examples/yuce/historical_backtest.py | 329 | except Exception as e: | CODE |
| LOW | webui/run.py | 84 | except Exception as e: | CODE |
| LOW | webui/app.py | 122 | except Exception as e: | CODE |
| LOW | webui/app.py | 205 | except Exception as e: | CODE |
| LOW | webui/app.py | 401 | except Exception as e: | CODE |
| LOW | webui/app.py | 489 | except Exception as e: | CODE |
| LOW | webui/app.py | 610 | except Exception as e: | CODE |
| LOW | webui/app.py | 623 | except Exception as e: | CODE |
| LOW | webui/app.py | 662 | except Exception as e: | CODE |
| LOW | finetune_csv/train_sequential.py | 308 | except Exception as e: | CODE |
| MEDIUM | finetune_csv/train_sequential.py | 310 | print(f"Error occurred during training: {str(e)}") | CODE |
| LOW | finetune_csv/train_sequential.py | 355 | except Exception: | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | finetune/config.py | 1 | CODE | |
| LOW | finetune/qlib_test.py | 11 | CODE | |
| LOW | finetune/qlib_test.py | 16 | CODE | |
| LOW | finetune/qlib_test.py | 19 | CODE | |
| LOW | finetune/train_tokenizer.py | 6 | CODE | |
| LOW | finetune/train_tokenizer.py | 7 | CODE | |
| LOW | examples/get_akshare_date_2024-2025_x.py | 4 | CODE | |
| LOW | examples/prediction_new.py | 8 | CODE | |
| LOW | examples/prediction_new.py | 10 | CODE | |
| LOW | examples/prediction_new.py | 13 | CODE | |
| LOW | examples/prediction_new.py | 13 | CODE | |
| LOW | examples/prediction_new.py | 13 | CODE | |
| LOW | examples/prediction_new.py | 13 | CODE | |
| LOW | examples/prediction_new_GUI.py | 8 | CODE | |
| LOW | examples/prediction_new_GUI.py | 10 | CODE | |
| LOW | examples/prediction_new_GUI.py | 13 | CODE | |
| LOW | examples/prediction_new_GUI.py | 13 | CODE | |
| LOW | examples/prediction_new_GUI.py | 13 | CODE | |
| LOW | examples/prediction_new_GUI.py | 13 | CODE | |
| LOW | examples/prediction_new_GUI.py | 17 | CODE | |
| LOW | examples/prediction_new_GUI.py | 19 | CODE | |
| LOW | examples/get_date_new.py | 4 | CODE | |
| LOW | examples/run_backtest_kronos.py | 6 | CODE | |
| LOW | examples/run_backtest_kronos.py | 6 | CODE | |
| LOW | examples/yuce/historical_backtest.py | 6 | CODE | |
| LOW | examples/yuce/historical_backtest.py | 6 | CODE | |
| LOW | model/kronos.py | 10 | CODE | |
| LOW | webui/run.py | 15 | CODE | |
| LOW | webui/run.py | 16 | CODE | |
| LOW | webui/run.py | 17 | CODE | |
| LOW | webui/run.py | 18 | CODE | |
| LOW | webui/run.py | 19 | CODE | |
| LOW | webui/run.py | 56 | CODE | |
| LOW | webui/run.py | 56 | CODE | |
| LOW | webui/run.py | 56 | CODE | |
| LOW | webui/app.py | 3 | CODE | |
| LOW | finetune_csv/train_sequential.py | 6 | CODE | |
| LOW | finetune_csv/train_sequential.py | 7 | CODE | |
| LOW | finetune_csv/train_sequential.py | 11 | CODE | |
| LOW | finetune_csv/train_sequential.py | 15 | CODE | |
| LOW | finetune_csv/finetune_tokenizer.py | 11 | CODE | |
| LOW | finetune_csv/finetune_base_model.py | 5 | CODE | |
| LOW | finetune_csv/finetune_base_model.py | 13 | CODE | |
| LOW | finetune_csv/finetune_base_model.py | 21 | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | finetune/qlib_test.py | 239 | CODE | |
| LOW | finetune/train_tokenizer.py | 74 | CODE | |
| LOW | examples/get_akshare_date_2024-2025_x.py | 23 | CODE | |
| LOW | examples/get_akshare_date_2024-2025_x.py | 157 | CODE | |
| LOW | examples/get_akshare_date_2024-2025_x.py | 384 | CODE | |
| LOW | examples/get_akshare_date_2024-2025_x.py | 500 | CODE | |
| LOW | examples/prediction_new.py | 333 | CODE | |
| LOW | examples/prediction_new.py | 702 | CODE | |
| LOW | examples/prediction_new.py | 476 | CODE | |
| LOW | examples/prediction_new_GUI.py | 649 | CODE | |
| LOW | examples/prediction_new_GUI.py | 1070 | CODE | |
| LOW | examples/prediction_new_GUI.py | 1105 | CODE | |
| LOW | examples/prediction_new_GUI.py | 771 | CODE | |
| LOW | examples/get_date_new.py | 23 | CODE | |
| LOW | examples/get_date_new.py | 147 | CODE | |
| LOW | examples/get_date_new.py | 378 | CODE | |
| LOW | examples/get_date_new.py | 504 | CODE | |
| LOW | examples/prediction_akshare_2024-2025.py | 369 | CODE | |
| LOW | examples/run_backtest_kronos.py | 158 | CODE | |
| LOW | examples/run_backtest_kronos.py | 359 | CODE | |
| LOW | examples/yuce/historical_backtest.py | 264 | CODE | |
| LOW | model/kronos.py | 225 | CODE | |
| LOW | webui/app.py | 78 | CODE | |
| LOW | webui/app.py | 209 | CODE | |
| LOW | webui/app.py | 342 | CODE | |
| LOW | webui/app.py | 405 | CODE | |
| LOW | finetune_csv/config_loader.py | 25 | CODE | |
| LOW | finetune_csv/finetune_tokenizer.py | 151 | CODE | |
| LOW | finetune_csv/finetune_base_model.py | 239 | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW⚡ | finetune/qlib_data_preprocess.py | 43 | # Check if start_index lookbackw_window will cause negative index | COMMENT |
| LOW⚡ | finetune/qlib_data_preprocess.py | 47 | # Check if end_index exceeds the range of the array | COMMENT |
| LOW⚡ | finetune/qlib_data_preprocess.py | 53 | # Check if end_index+predictw_window will exceed the range of the array | COMMENT |
| LOW | webui/start.sh | 8 | # Check if Python is installed | COMMENT |
| LOW | webui/start.sh | 14 | # Check if in correct directory | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | README.md | 239 | ### Step 1: Configure Your Experiment | COMMENT |
| LOW | README.md | 251 | ### Step 2: Prepare the Dataset | COMMENT |
| LOW | README.md | 261 | ### Step 3: Run the Finetuning | COMMENT |
| LOW | README.md | 287 | ### Step 4: Evaluate with Backtesting | COMMENT |
| LOW | finetune_csv/README.md | 75 | # Step 1: Train tokenizer | COMMENT |
| LOW | finetune_csv/README.md | 78 | # Step 2: Train predictor (requires fine-tuned tokenizer) | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| MEDIUM | finetune/qlib_test.py | 311 | # Create a dedicated dictionary for this run's configuration | COMMENT |
| MEDIUM | model/kronos.py | 129 | mask = 2 ** torch.arange(self.codebook_dim//2, device=x1.device, dtype=torch.long) # Create a mask for bit e | CODE |
| MEDIUM | model/kronos.py | 134 | mask = 2 ** torch.arange(self.codebook_dim, device=x.device, dtype=torch.long) # Create a mask for bit extra | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| MEDIUM | README.md | 138 | # Define context window and prediction length | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| MEDIUM | finetune/dataset.py | 115 | # Apply normalization and robust clipping to the entire sequence | COMMENT |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | tests/test_kronos_regression.py | 36 | def set_seed(seed: int) -> None: | CODE |
| LOW | tests/data/generate_regression_output.py | 26 | def set_seed(seed: int) -> None: | CODE |
| Severity | File | Line | Snippet | Context |
|---|---|---|---|---|
| LOW | finetune_csv/finetune_base_model.py | 27 | CODE |