Arquitetura RAG Híbrida para Consulta em Linguagem Natural a Dados de Emendas Parlamentares Brasileiras
Resumo
A transparência na execução de emendas parlamentares brasileiras é limitada pela complexidade dos vocabulários orçamentários, fragmentação dos dados entre múltiplas fontes e ausência de interfaces acessíveis. Este trabalho propõe uma arquitetura RAG híbrida que combina busca SQL com recuperação vetorial semântica (pgvector/HNSW) via Reciprocal Rank Fusion (RRF) ponderada com gate de similaridade e estratégia adaptativa por consulta. Avaliada com 120 consultas em quatro níveis de complexidade, a abordagem híbrida alcançou P@5 de 73,33%, NDCG@5 de 64,55% e MRR de 75,00%, superando as abordagens SQL puro e vetorial puro nas principais métricas. Testes t pareados (n = 120, α = 0,05) confirmaram significância estatística para P@5, F1 e NDCG@5, com maior ganho em consultas semânticas (+15,7 pp NDCG@5). A acurácia de extração de entidades alcançou 95,4% no geral. O sistema opera com dados dos 27 estados brasileiros (2020–2024), totalizando 32.787 emendas, e encontra-se disponível como plataforma de código aberto.Referências
Anthropic (2024). The Claude 3 model family: Opus, sonnet, haiku. Model Card.
Biswal, A., Patel, L., Jha, S., Kamsetty, A., Liu, S., Gonzalez, J. E., Guestrin, C., and Zaharia, M. (2025). Text2SQL is not enough: unifying AI and databases with TAG. In Proceedings of the Conference on Innovative Data Systems Research (CIDR), Amsterdam, The Netherlands.
Brasil (2024). Lei complementar nº 210, de 25 de novembro de 2024: dispõe sobre a transparência e rastreabilidade das emendas parlamentares. Brasília: Diário Oficial da União.
Câmara dos Deputados (2025). Dados abertos da Câmara dos Deputados: documentação da API.
Controladoria-Geral da União (2025). Portal da transparência do Governo Federal: documentação da API de dados.
Cormack, G. V., Clarke, C. L., and Buettcher, S. (2009). Reciprocal rank fusion outperforms condorcet and individual rank learning methods. In Proceedings of the 32nd International ACM SIGIR Conference, pages 758–759. ACM.
Es, S., James, J., Espinosa-Anke, L., and Schockaert, S. (2024). RAGAS: automated evaluation of retrieval augmented generation. In Proceedings of the 18th Conference of the European Chapter of the Association for Computational Linguistics: System Demonstrations, pages 150–163. Association for Computational Linguistics.
Gao, Y. et al. (2024). Retrieval-augmented generation for large language models: a survey. arXiv preprint arXiv:2312.10997.
Hevner, A. R., March, S. T., Park, J., and Ram, S. (2004). Design science in information systems research. MIS Quarterly, 28(1):75–105.
Hong, Z. et al. (2025). Next-generation database interfaces: a survey of LLM-based text-to-SQL. IEEE Transactions on Knowledge and Data Engineering.
Kane, A. (2024). pgvector: open-source vector similarity search for PostgreSQL.
Lewis, P. et al. (2020). Retrieval-augmented generation for knowledge-intensive NLP tasks. Advances in Neural Information Processing Systems, 33:9459–9474.
Li, J. et al. (2023). Can LLM already serve as a database interface? A BIg bench for large-scale database grounded text-to-SQLs. In Advances in Neural Information Processing Systems, volume 36.
Li, Z. et al. (2024). StructRAG: boosting knowledge intensive reasoning of LLMs via inference-time hybrid information structurization. arXiv preprint arXiv:2410.08815.
Liu, X. et al. (2025). A survey of text-to-SQL in the era of LLMs: where are we, and where are we going? arXiv preprint arXiv:2408.05109. Revisado em dezembro de 2025.
Malkov, Y. A. and Yashunin, D. A. (2020). Efficient and robust approximate nearest neighbor search using hierarchical navigable small world graphs. IEEE Transactions on Pattern Analysis and Machine Intelligence, 42(4):824–836.
Michener, G., Contreras, E., and Niskier, I. (2018). From opacity to transparency? Evaluating access to information in Brazil five years later. Revista de Administração Pública, 52(4):610–639.
OECD (2017). OECD Budget Transparency Toolkit: practical steps for supporting openness, integrity and accountability in public financial management. OECD Publishing, Paris.
Op. Serenata de Amor (2016). Inteligência artificial para controle social dos gastos públicos.
Peffers, K., Tuunanen, T., Rothenberger, M. A., and Chatterjee, S. (2007). A design science research methodology for information systems research. Journal of Management Information Systems, 24(3):45–77.
Pourreza, M. and Rafiei, D. (2023). DIN-SQL: decomposed in-context learning of text-to-SQL with self-correction. In Advances in Neural Information Processing Systems, volume 36.
Santana, A. F., Sarkis, L. C., and Ferreira, R. S. (2026). FiscalIA: Plataforma de transparência fiscal com RAG híbrido. Repositório público contendo código-fonte completo da plataforma.
Supremo Tribunal Federal (2024). Decisão monocrática do min. flávio dino na ADPF 854: suspensão de emendas parlamentares por falta de transparência. Brasília: STF.
Supremo Tribunal Federal (2025). STF determina que TCU identifique e envie à PF lista com emendas parlamentares sem plano de trabalho. Decisão monocrática do Min. Flávio Dino na ADPF 854. Brasília: STF.
Tejedo-Romero, F., Araujo, J. F. F. E., and Ribeiro, M. J. G. (2025). The usability of Brazilian government open data portals: ensuring data quality. Humanities and Social Sciences Communications, 12.
Wang, L. et al. (2024). Multilingual E5 text embeddings: a technical report. arXiv preprint arXiv:2402.05672.
Yang, X. et al. (2024). CRAG – comprehensive RAG benchmark. In Advances in Neural Information Processing Systems, Datasets and Benchmarks Track.
Biswal, A., Patel, L., Jha, S., Kamsetty, A., Liu, S., Gonzalez, J. E., Guestrin, C., and Zaharia, M. (2025). Text2SQL is not enough: unifying AI and databases with TAG. In Proceedings of the Conference on Innovative Data Systems Research (CIDR), Amsterdam, The Netherlands.
Brasil (2024). Lei complementar nº 210, de 25 de novembro de 2024: dispõe sobre a transparência e rastreabilidade das emendas parlamentares. Brasília: Diário Oficial da União.
Câmara dos Deputados (2025). Dados abertos da Câmara dos Deputados: documentação da API.
Controladoria-Geral da União (2025). Portal da transparência do Governo Federal: documentação da API de dados.
Cormack, G. V., Clarke, C. L., and Buettcher, S. (2009). Reciprocal rank fusion outperforms condorcet and individual rank learning methods. In Proceedings of the 32nd International ACM SIGIR Conference, pages 758–759. ACM.
Es, S., James, J., Espinosa-Anke, L., and Schockaert, S. (2024). RAGAS: automated evaluation of retrieval augmented generation. In Proceedings of the 18th Conference of the European Chapter of the Association for Computational Linguistics: System Demonstrations, pages 150–163. Association for Computational Linguistics.
Gao, Y. et al. (2024). Retrieval-augmented generation for large language models: a survey. arXiv preprint arXiv:2312.10997.
Hevner, A. R., March, S. T., Park, J., and Ram, S. (2004). Design science in information systems research. MIS Quarterly, 28(1):75–105.
Hong, Z. et al. (2025). Next-generation database interfaces: a survey of LLM-based text-to-SQL. IEEE Transactions on Knowledge and Data Engineering.
Kane, A. (2024). pgvector: open-source vector similarity search for PostgreSQL.
Lewis, P. et al. (2020). Retrieval-augmented generation for knowledge-intensive NLP tasks. Advances in Neural Information Processing Systems, 33:9459–9474.
Li, J. et al. (2023). Can LLM already serve as a database interface? A BIg bench for large-scale database grounded text-to-SQLs. In Advances in Neural Information Processing Systems, volume 36.
Li, Z. et al. (2024). StructRAG: boosting knowledge intensive reasoning of LLMs via inference-time hybrid information structurization. arXiv preprint arXiv:2410.08815.
Liu, X. et al. (2025). A survey of text-to-SQL in the era of LLMs: where are we, and where are we going? arXiv preprint arXiv:2408.05109. Revisado em dezembro de 2025.
Malkov, Y. A. and Yashunin, D. A. (2020). Efficient and robust approximate nearest neighbor search using hierarchical navigable small world graphs. IEEE Transactions on Pattern Analysis and Machine Intelligence, 42(4):824–836.
Michener, G., Contreras, E., and Niskier, I. (2018). From opacity to transparency? Evaluating access to information in Brazil five years later. Revista de Administração Pública, 52(4):610–639.
OECD (2017). OECD Budget Transparency Toolkit: practical steps for supporting openness, integrity and accountability in public financial management. OECD Publishing, Paris.
Op. Serenata de Amor (2016). Inteligência artificial para controle social dos gastos públicos.
Peffers, K., Tuunanen, T., Rothenberger, M. A., and Chatterjee, S. (2007). A design science research methodology for information systems research. Journal of Management Information Systems, 24(3):45–77.
Pourreza, M. and Rafiei, D. (2023). DIN-SQL: decomposed in-context learning of text-to-SQL with self-correction. In Advances in Neural Information Processing Systems, volume 36.
Santana, A. F., Sarkis, L. C., and Ferreira, R. S. (2026). FiscalIA: Plataforma de transparência fiscal com RAG híbrido. Repositório público contendo código-fonte completo da plataforma.
Supremo Tribunal Federal (2024). Decisão monocrática do min. flávio dino na ADPF 854: suspensão de emendas parlamentares por falta de transparência. Brasília: STF.
Supremo Tribunal Federal (2025). STF determina que TCU identifique e envie à PF lista com emendas parlamentares sem plano de trabalho. Decisão monocrática do Min. Flávio Dino na ADPF 854. Brasília: STF.
Tejedo-Romero, F., Araujo, J. F. F. E., and Ribeiro, M. J. G. (2025). The usability of Brazilian government open data portals: ensuring data quality. Humanities and Social Sciences Communications, 12.
Wang, L. et al. (2024). Multilingual E5 text embeddings: a technical report. arXiv preprint arXiv:2402.05672.
Yang, X. et al. (2024). CRAG – comprehensive RAG benchmark. In Advances in Neural Information Processing Systems, Datasets and Benchmarks Track.
Publicado
19/07/2026
Como Citar
SANTANA, André Ferreira; SARKIS, Laura Costa; FERREIRA, Raoni Simões.
Arquitetura RAG Híbrida para Consulta em Linguagem Natural a Dados de Emendas Parlamentares Brasileiras. In: SEMINÁRIO INTEGRADO DE SOFTWARE E HARDWARE (SEMISH), 53. , 2026, Gramado/RS.
Anais [...].
Porto Alegre: Sociedade Brasileira de Computação,
2026
.
p. 108-119.
ISSN 2595-6205.
DOI: https://doi.org/10.5753/semish.2026.23972.
