Alfaneo Generative AIML Case

While courtroom scenes in procedural dramas are riveting, they often overlook the intense effort behind the scenes: the rush to prepare documents. For law firms and legal professionals, drafting, reviewing, and managing critical documents for the judicial process poses significant challenges. Whether for court filings, appeals, or administrative proceedings, petitions require precision, clarity, and strict adherence to procedural requirements. Technical errors in petitions, such as improper citation of statutes or case law, can result in rejection by the court or regulatory body.

Given the high stakes involved, manual document generation processes are often time-consuming or rushed, leading to delays, inaccuracies, and additional filing fees.

About Alfaneo

Alfaneo, a legal tech startup, employs artificial intelligence (AI) to simplify its clients’ workload, primarily through automated document generation. Leveraging AI to streamline workflows, Alfaneo provides tailored tools that optimise day-to-day operations for law firms and legal departments, ultimately improving productivity and reducing client costs. 

By concentrating on process enhancements and productivity using AI, Alfaneo aims to enhance efficiency within its clients’ operations, establishing a notable presence in the competitive legal market. 

The Business Challenge

Alfaneo faced a crucial challenge: simplifying the creation of legal petitions, which traditionally demanded significant time and effort from both lawyers and clients. To confront this obstacle, Alfaneo turned to generative artificial intelligence (GenAI), aiming to craft tailored petitions grounded in legal principles like statutes and constitutional law, while learning from past petition drafting experiences. 

If the problem were not resolved, the manual and time-consuming work in drafting petitions would continue to negatively impact the experience and productivity of Alfaneo’s clients, potentially impacting their satisfaction. Recognising the necessity for an AI-driven approach, Alfaneo sought to modernise the petition creation process, aiming to expedite legal document generation and enhance client experiences by leveraging trusted legal sources.

Solution: Leveraging GenAI for automated legal document generation

AI offers significant potential for automating document generation, particularly in the legal sector, where precise and personalised documents are crucial. Leveraging AI-driven solutions, DNX enabled Alfaneo to streamline the production of legal petitions to enhance efficiency and reduce manual workload for its clients.

  • Optimised infrastructure for AI: Using Amazon Bedrock, a managed and serverless service, we relieve the client of infrastructure management concerns and ensure scalability.
  • Generative AI text generation: We utilised the Amazon Bedrock service from AWS for natural language processing, harnessing Language Model Models (LLMs) based on the client’s petition history. The selected model was Claude 2, proficient in the Portuguese language and with high performance.
  • Information flow management: Employing the LangChain framework, we orchestrated seamless tool communication, ensuring efficient data exchange across the workflow.
  • Document storage solution: Implementing the RAG methodology with ChromaDB to systematically store Alfaneo’s legal documents, including the Brazilian Constitution and legal precedents, allowed for quick and efficient queries.
  • Performance and quality evaluation: The generated responses were evaluated using tools like DeepEval and RAGAS, providing metrics such as relevance, semantic alignment, and customised KPIs, enabling numerical project guidance and continuous improvements
  • Scalable, secure, simple NLP: The adoption of Amazon Bedrock brought simplicity and scalability as a serverless service that charges only for usage.
  • Data security and governance: Through Amazon Bedrock, we also enabled Alfaneo to use third-party models such as Claude 2 from Anthropic without granting access to the data passing through. It keeps data within the AWS infrastructure, enhancing security and compliance.

Considering the above-mentioned points, the GenAI solution enabled by DNX aligns well with the pillars of the AWS Well-Architected Framework, particularly in terms of security, operational excellence, operational efficiency, cost optimisation, and sustainability.

Results and Benefits

Overall, the GenAI solution delivered positive results and received favourable feedback from the client, generating high-quality, completely automated petitions. This resulted in gains in productivity and scalability for the law firm.

  • Automation improvement: Alfaneo saw significant improvements in automating legal petition generation after implementing the GenAI solution on AWS.
  • Time savings: With advanced models like Claude 2 via Amazon Bedrock, Alfaneo clients reduced the time spent on each petition from hours to minutes.
  • Manual work reduction: This led to substantial savings in manual work hours per generated petition.
  • Relevance and accuracy: The solution achieved high levels of relevance in automatic generation of rights (97%) and requests (92%), with a comparison similarity of 41% for rights and 23% for requests.
  • Performance evaluation: Considering the cumulative nature of errors between the rights and requests stages, the performance can be considered good, addressing the client’s initial challenge effectively.

Finally, in the subjective evaluation by users, the generative AI solution proved to deliver relevant and aligned responses to expectations. This validates the tangible benefits brought by the partnership between Alfaneo and DNX and the use of innovative technologies such as GenAI on the AWS cloud. The implemented solution effectively addressed the client’s initial challenge.

Conclusion: The impact of GenAI on legal petition generation

The integration of GenAI on the AWS cloud to automate legal petition generation has been a pivotal undertaking for Alfaneo, significantly impacting its operations. DNX Solutions showcased not only the viability of an automated system but also the potential to alleviate the workload of legal professionals.

Moreover, this case study exemplifies the successful application of state-of-the-art technologies like GenAI within the Brazilian legal landscape. Moving forward, our focus shifts to deploying a robust and scalable infrastructure on AWS, seamlessly integrating the solution with Alfaneo’s existing systems. This holistic approach will ensure continuous monitoring and support through DNX  Managed Services.

Furthermore, ongoing enhancements are in sight to boost performance and response times, with the incorporation of additional metrics for enhanced user experience. The collaboration between Alfaneo and DNX, powered by innovative technologies such as generative AI on the AWS cloud, stands as a testament to our collective success and promises a bright future ahead.


Ready to harness the power of GenAi to boost productivity? Reach out to us today to discover how DNX can assist your organisation in achieving comparable success.