First, there needs to be a license violation.
The use of intellectual property in training AI/ML models is still an open legal question, at least in the United States. Historically, text and data mining has generally been seen as fair use. Although a case-by-case assessment may still be needed, it seems consistent to consider the use of protected works for the training of AI/ML models as text and data mining and, therefore, fair use. As such, copyright protections wouldn't apply.
Instead of intellectual property, you could consider this as a case of contract law. According to the University of Arkansas libraries, US federal courts have recognized CC licenses as legally binding contracts. If the license has been violated, then the contract has been broken.
Enforcement of intellectual property laws in the United States is difficult. All avenues require registration of the work with the Copyright Office. That is, you cannot go before the Copyright Claims Board or start a federal court case without first registering copyright as a prerequisite. This can get expensive, and depending on the age of the content, even registration may not allow you to recoup your legal fees if you win your case. Contract laws can be enforced through other courts, such as state courts. Since you aren't making intellectual property claims, you also do not necessarily need to register your work. This would depend on the exact strategies and you would need to consult a lawyer to determine which course is best.
Now, let's assume that you are going forward with one of these claims - either an intellectual property violation or a breach of contract. Either way, the next step will be to look at the specific terms of the license. In the case of the newest content on Stack Exchange, that is the Creative Commons Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license. Older content may be under an older license, but we'll focus on the 4.0 license to keep it simple. Similar concepts can be applied.
Stack Exchange has not violated the license, so you cannot take action. They are continuing to host the content. Each post is attributed to the original creator and the most recent editor (if any), the history page maintains the editors and their specific changes, the specific license each post is available under is displayed in the "share" menu. All of the elements of attribution are satisfied by Stack Exchange.
There's also an open question about if you are dual-licensing your content to SE. Some people interpret Section 6 of the Terms of Service to grant two licenses. They specifically point to the "Subscriber Content" which talks about the CC BY-SA 4.0 license and "the perpetual and irrevocable right and license to access, use, process, copy, distribute, export, display and to commercially exploit such Subscribe Content". Because these rights are inherently granted in CC BY-SA 4.0, I interpret this as an enumeration of the basic rights needed for the company to function should the public-facing license ever change, but this has never been addressed or tested.
Unless you can demonstrate that the company is sharing the content with other people and not maintaining these elements of attribution, then Stack Exchange is not in violation of the terms.
As the content creator, you would have to examine if the recipients of the content continue to follow the terms of the license agreement. Recipients, whether they receive the data by scraping the web pages, the API, the SEDE, or some other mechanism, all receive it under the CC BY-SA terms.
Unfortunately, there are ambiguities and open questions about the CC attribution clauses. In CC BY-SA, Section 3(a)(2) says that the person using the content may "satisfy the conditions ... in any reasonable manner based on the medium, means, and context" and it gives the example of "providing a URI or hyperlink to a resource that includes the required information". There may not be a need to explicitly attribute the individual posters - being able to draw a connection between a generated block of test and hyperlinks at the SE question level where the rest of the licensing and attribution data may be found may be enough.
If anyone, SE or otherwise, violates the license, the process would be:
- Follow the Creative Commons advice and send a request to either correct the violation or remove the content.
- If the content is not removed or there is a dispute, consult with a lawyer. They can review the situation and tell you what the next steps could be. This will likely cost money, although some lawyers do offer free consultations. There may be added expenses associated with filing court cases, documentation, copyright registration, and so on.