АДРЕСНЫЙ РЕЖИМ - M2.3e: стабилизация address runtime парсинг периодов, LLM pre-decompose fallback и приоритет intent для банковских операций
This commit is contained in:
+59
@@ -0,0 +1,59 @@
|
||||
# Address Query Runtime V1 - M2.3e Stability Hardening (Noise + Account Query Scope)
|
||||
|
||||
Date: 2026-04-01 (updated)
|
||||
|
||||
## Goal
|
||||
|
||||
Finalize the stage before local LLM switch with production-safe stability:
|
||||
|
||||
- robust noisy phrase handling;
|
||||
- deterministic month/account filtering;
|
||||
- safer LLM pre-decompose integration without semantic drift.
|
||||
|
||||
## Implemented
|
||||
|
||||
1. Noise hardening for counterparty extraction:
|
||||
- slang/noise tails (`плс`, `pls`, profanity markers) are ignored as anchors;
|
||||
- free-text heuristic for counterparty in document/bank requests without strict `по <anchor>`.
|
||||
|
||||
2. Relaxed year extraction:
|
||||
- compact forms like `20 год` -> `2020-01-01..2020-12-31`;
|
||||
- standalone year mentions in noisy phrasing.
|
||||
|
||||
3. Month period hardening for balance intents:
|
||||
- equivalent mapping for:
|
||||
- `на май 2020`
|
||||
- `на 2020.05`
|
||||
- `на 2020 май`
|
||||
- all forms now converge to `period_from=2020-05-01`, `period_to=2020-05-31`, `as_of_date=2020-05-31`.
|
||||
|
||||
4. Account query scope hardening in recipe:
|
||||
- account condition injected into movements query using account code fields;
|
||||
- removed fragile presentation-based filtering path for account subaccounts.
|
||||
|
||||
5. LLM pre-decompose salvage path:
|
||||
- when strict normalized payload has no usable fragments, runtime now extracts a safe fragment from raw model JSON;
|
||||
- decomposition reason now can be `raw_fragment_applied` instead of always falling back to deterministic parsing.
|
||||
|
||||
6. Intent routing hardening against LLM drift:
|
||||
- `bank_operations_by_counterparty` has higher priority than generic account fallback when party/bank signals are present;
|
||||
- strengthened Russian phrasing detection for `documents_forming_balance` (including participle forms like `формирующие остаток`).
|
||||
|
||||
7. Test coverage expansion:
|
||||
- month parsing regressions (`на май 2020`, `на 2020.05`, `на 2020 май`);
|
||||
- bank-ops intent priority regression with injected account hints;
|
||||
- documents-forming-balance participle phrasing regression;
|
||||
- existing noisy-query and account-scope regressions retained.
|
||||
|
||||
## Verification
|
||||
|
||||
- `npx vitest tests/addressQueryRuntimeM23.test.ts` -> PASS (`46` tests)
|
||||
- `npx vitest tests/assistantAddressFollowupContext.test.ts` -> PASS (`1` test)
|
||||
- `npm run build` -> PASS
|
||||
|
||||
## Notes
|
||||
|
||||
- Architecture remains hybrid and stable: deterministic parser + guarded heuristics + optional LLM pre-decompose.
|
||||
- LLM pre-decompose is now resilient to schema drift in local model output.
|
||||
- No free-form query builder added.
|
||||
- No deep-analysis lane changes.
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
{
|
||||
"run_id": "2026-04-01_Address_Query_Runtime_V1_M2_3E_Stability_Hardening_AccountQueryScope",
|
||||
"comparison": {
|
||||
"baseline_ref": "2026-04-01_Address_Query_Runtime_V1_M2_3D_Query_Variants_Expansion",
|
||||
"current_ref": "workspace (after M2.3e stability update)"
|
||||
},
|
||||
"metrics": {
|
||||
"address_m23_test_cases": {
|
||||
"before": 39,
|
||||
"after": 46,
|
||||
"delta": 7
|
||||
},
|
||||
"address_m23_test_failures": {
|
||||
"before": 0,
|
||||
"after": 0,
|
||||
"delta": 0
|
||||
},
|
||||
"llm_predecompose_signal": {
|
||||
"before": "attempted_but_often_no_usable_fragment",
|
||||
"after": "raw_fragment_salvage_available",
|
||||
"delta": "stability_improved"
|
||||
}
|
||||
},
|
||||
"notes": [
|
||||
"delta includes month-format parsing regressions and intent-priority regressions",
|
||||
"added fallback extraction from raw local LLM JSON when strict normalized fragments are empty",
|
||||
"added regression checks for: 'на 2020.05', 'на 2020 май', bank ops with account hints"
|
||||
]
|
||||
}
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
llm_normalizer/backend/src/services/addressFilterExtractor.ts
|
||||
llm_normalizer/backend/src/services/addressIntentResolver.ts
|
||||
llm_normalizer/backend/src/services/addressRecipeCatalog.ts
|
||||
llm_normalizer/backend/src/services/assistantService.ts
|
||||
llm_normalizer/backend/tests/addressQueryRuntimeM23.test.ts
|
||||
|
||||
docs/ADDRESS/runs/2026-04-01_Address_Query_Runtime_V1_M2_3E_Stability_Hardening_AccountQueryScope/README.md
|
||||
docs/ADDRESS/runs/2026-04-01_Address_Query_Runtime_V1_M2_3E_Stability_Hardening_AccountQueryScope/run_summary.json
|
||||
docs/ADDRESS/runs/2026-04-01_Address_Query_Runtime_V1_M2_3E_Stability_Hardening_AccountQueryScope/before_after_metrics.json
|
||||
docs/ADDRESS/runs/2026-04-01_Address_Query_Runtime_V1_M2_3E_Stability_Hardening_AccountQueryScope/smoke_checks.md
|
||||
docs/ADDRESS/runs/2026-04-01_Address_Query_Runtime_V1_M2_3E_Stability_Hardening_AccountQueryScope/changed_files.txt
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
{
|
||||
"run_id": "2026-04-01_Address_Query_Runtime_V1_M2_3E_Stability_Hardening_AccountQueryScope",
|
||||
"date": "2026-04-01",
|
||||
"stage": "Address Query Runtime V1",
|
||||
"wave": "M2.3e",
|
||||
"goal": "Stability hardening before local LLM switch: noisy phrase robustness + account/query period determinism + LLM pre-decompose resilience",
|
||||
"status": "COMPLETED_UPDATED",
|
||||
"scope": {
|
||||
"new_intents": false,
|
||||
"deep_analysis_changes": false,
|
||||
"focus": [
|
||||
"noisy phrase anchor stability",
|
||||
"relaxed year extraction",
|
||||
"month format normalization (month-year/year-month/year month)",
|
||||
"account query scope in movements recipe",
|
||||
"LLM pre-decompose raw-fragment salvage",
|
||||
"intent priority hardening for bank ops vs account fallback",
|
||||
"regression/unit coverage expansion"
|
||||
]
|
||||
},
|
||||
"checks": {
|
||||
"test_command_primary": "npx vitest tests/addressQueryRuntimeM23.test.ts",
|
||||
"test_command_secondary": "npx vitest tests/assistantAddressFollowupContext.test.ts",
|
||||
"build_command": "npm run build",
|
||||
"tests_passed": 47,
|
||||
"tests_failed": 0
|
||||
},
|
||||
"guardrails": {
|
||||
"false_factual_rate_target": 0,
|
||||
"free_form_query_builder": "not_added",
|
||||
"whitelist_recipe_policy": "unchanged"
|
||||
},
|
||||
"key_changes": {
|
||||
"noise_tokens_not_used_as_anchor": true,
|
||||
"free_text_counterparty_heuristic": true,
|
||||
"compact_year_support": true,
|
||||
"month_year_variants_supported": true,
|
||||
"movements_query_account_condition_injected": true,
|
||||
"llm_predecompose_raw_salvage": true,
|
||||
"intent_priority_bank_ops_over_account_fallback": true,
|
||||
"documents_forming_balance_participle_detection": true
|
||||
}
|
||||
}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
# Smoke Checks
|
||||
|
||||
## Backend tests
|
||||
|
||||
- Command: `npx vitest tests/addressQueryRuntimeM23.test.ts`
|
||||
- Result: PASS
|
||||
- Details: `1 passed file`, `46 passed tests`, `0 failed`
|
||||
|
||||
- Command: `npx vitest tests/assistantAddressFollowupContext.test.ts`
|
||||
- Result: PASS
|
||||
- Details: `1 passed file`, `1 passed test`, `0 failed`
|
||||
|
||||
## Build
|
||||
|
||||
- Command: `npm run build`
|
||||
- Result: PASS
|
||||
- Details: TypeScript build completed without errors.
|
||||
|
||||
## Manual spot-check (address lane)
|
||||
|
||||
- File: `docs/ADDRESS/1.txt`
|
||||
- Result: month-variant account questions produce consistent May-2020 window.
|
||||
- Result: last bank-operations question now covered by intent-priority hardening (expected recipe: bank ops by counterparty).
|
||||
Reference in New Issue
Block a user