Logic-driven Indirect Supervision: An Application to Crisis Counseling
Year: 2023

Abstract:
Ensuring the effectiveness of text-based crisis counseling requires observing ongoing conversations and providing feedback, both labor-intensive tasks. Automatic analysis of conversations—at the full chat and utterance levels—may help support counselors and provide better care. While some session-level training data (e.g., rating of patient risk) is often available from counselors, labeling utterances requires expensive post hoc annotation. But the latter can not only provide insights about conversation dynamics, but can also serve to support quality assurance efforts for counselors. In this paper, we examine if inexpensive—and potentially noisy—session-level annotation can help improve label utterances. To this end, we propose a logic-based indirect supervision approach that exploits declaratively stated structural dependencies between both levels of annotation to improve utterance modeling. We show that adding these rules gives an improvement of 3.5% f-score over a strong multi-task baseline for utterance-level predictions. We demonstrate via ablation studies how indirect supervision via logic rules also improves the consistency and robustness of the system. Trigger warning: This paper discusses suicide in the context of crisis counseling and includes examples illustrating such conversations.

heading: 1 Introduction
text: Text-based crisis counseling services like Crisis Text Line1 and the 988 Suicide & Crisis Lifeline2 are increasingly adopted by people seeking confidential mental health support. They help thousands of texters every day. But the volume of users challenges the ability of crisis systems to provide consistently high-quality service. For example, in our experience with the regional suicide hotline,
1https://www.crisistextline.org 2https://988lifeline.org/
SafeUT,3 we found that counselors can have extended shifts involving up to eight conversations with potentially suicidal clients simultaneously! Figure 1a shows an illustrative anonymized example of such a session.
Addressing the twin problems of managing counselor workload and ensuring quality requires training new counselors and providing feedback to existing ones. In particular, understanding suicide risk in client utterances may help counselors learn to prioritize high-risk client situations, especially when dealing with multiple chats simultaneously or when fatigued. As Imel et al. (2017) note, scaling such efforts requires technological assistance. Previous work (e.g., Broadbent et al., 2023; GuzmanNateras et al., 2022; Shrestha et al., 2021; Haque et al., 2020) has shown that NLP models can reliably assess risk in crisis chats. Yet, building models for risk assessment at the utterance level is challenging because of the dearth of training data.
Utterance-level risk labeling requires post hoc annotation by experts who follow a coding manual; the process can be slow and expensive. In contrast, session-level risk data is relatively easier to obtain. At the end of a session, in their standard workflow, counselors can tag the risk level (e.g., low- or highrisk) for record keeping requirements. Sessionlevel assessments are undeniably useful (Xu et al., 2021; Bantilan et al., 2021); but the nuances of moment-to-moment situational judgments are also key for clinical training and supervision.
In this paper, we ask: Can the easy-to-obtain session-level risk data help improve utterance risk classifiers? These two tasks have structural dependencies between them: session-level classification of risk should be dependent on utterance-level classification, such that a session containing any highrisk utterances should be deemed high risk. This connection paves the way to extract auxiliary signal
3https://safeut.org. This work was conducted under IRB oversight. Appendix A has more details.
11704
I’ve been thinking of ending my life, my mental health is bad. I had an attempt [#DATE]. D1, D9 I am here for you. How can I help?
Hi. I feel I’m worthless and unhappy all the time. And I’m tired of being anxious. No-D I am sorry you feel that way. Have you talked to a therapist about your anxiety? I have. But I can’t work with my therapist anymore. I’m looking for a new one. No-D Have you ever tried things like the 5 senses grounding skill for your anxiety? I did. I tried so hard, and nothing worked. I’m just exhausted. Sometimes I feel like wanting to give it an end. D2b ...
1
(a)
risk chat
Risk assessed chats
Structural dependencies
LOGIC
Declarative learning loss for indirectly supervising utterance model using session data
Session labels
Utterance labels
Domain knowledge
Counselor Coding experts
Risk assessed utterances
Risk(chat,label) Risk(chat, Lower) ¬HasCode(utterance,high-risk-D-code) HasCode( ,label)
Higher
D1, D9
No-D
I've been thinking of ending my life, my mental health is bad. I had an attempt [#DATE]. I am here for you. How can I help? Hi. I feel I'm worthless and unhappy all the time. And I'm tired of being anxious. I am sorry you feel that way. Have you talked to a therapist about your anxiety?. . .
> >
(b)
Figure 1: (a) Example snippet of an anonymized Higher risk chat session with associated utterance-level labels for
client ( ) utterances. (b) Overview of the problem and our approach. We have two disjoint datasets of annotated crisis sessions: one set is labeled at the session level (with Higher or Lower risk) by the counselor immediately after the chat ends, the other set is labeled post hoc at the utterance level (with one or more risk status codes shown in Table 1) by coding experts. There are structural dependencies between the two levels of annotation. Our work proposes a framework that exploits these dependencies via a logic-guided declarative learning loss where the easy-to-obtain session data provides auxiliary supervision for the low-resource utterance classification task.
from the easily obtained session labels to indirectly supervise utterance models.
Prior work on indirect supervision with structured prediction (Chang et al., 2010a,b) focuses on feature-rich linear models. However, importing these ideas to the deep learning realm can be computationally untenable due to the discrete optimization step within the training loop. We propose a mechanism to instantiate this cross-task indirect supervision problem as a declarative learning objective encoded by logical constraints. For efficient training, these constraints are relaxed into differentiable losses (e.g., Richardson et al., 2022; Li et al., 2019; Rocktäschel et al., 2015). Figure 1b illustrates the approach. The flexibility of the framework allows us to incorporate further structural constraints inherent in the utterance-level task.
We show that the auxiliary supervision via constraints significantly improves utterance risk prediction over both direct supervision and strong multitask baselines. Our analysis reveals that the rules also improve model consistency and robustness.
In summary, our contributions are: We introduce a framework for indirect supervision that uses relaxed logic. We instantiate it to the problem of using cheap, abundant, but noisy annotation (sessionlevel risk labels) as auxiliary signal to improve the performance on a low-resource task (utterance-
level labels). We show that structural dependencies across tasks help outperform a directly supervised and a strong multi-task baselines.

heading: 2 Crisis Counseling and Coding
text: In text-based crisis intervention, a client starts a chat session (also called an encounter) by typing a message, and the first available counselor replies to it. The session goes on till either the client finishes the conversation, or a certain amount of time elapses with no client response.
The volume of messages to text-based crisis services presents quality assurance challenges and demands increased counselor training. NLP-based tools can help both with quality control and for counselor feedback during training (Sharma et al., 2021; Demasi et al., 2020, 2019; Dinakar et al., 2015). In particular, monitoring chat-level and also utterance (or message) suicide risk status can be critical to improve service effectiveness. To build such models, we need risk assessment annotation at two levels: at the session level and the utterance level. The former is easy to obtain, whereas the latter is not.
Once a session concludes, counselors tag the conversation as being higher or lower suicide risk as part of their routine reporting requirements. Consequently, we can organically obtain session-level
annotation, but perhaps with some noise due to provider fatigue.
In contrast, labeling the suicide risk status of client utterances needs careful post hoc analysis over the session. For this process, a group of expert annotators label each utterance using a standard coding system for risk. In this work, we use the crisis chat coding scheme of Lake et al. (2022).4 Specifically, the coders assign to each client utterance zero, one, or more suicide risk status codes from the section D of the coding manual. We refer to these labels as “D-codes” in this paper; Table 1 lists the eight codes used. Utterances for which no codes apply are labeled with a special No-D label. The right columns of the example chats in Figure 1a and Appendix B show the D-codes associated with the client utterances. The subtle differences between the label definitions make the utterance-level annotation an expensive and slow process. Consequently, only a limited amount of labeled data with utterance suicide risk status is available.
With these two types of counseling annotation— the cheap and noisy session-level data, and the expensive and slow utterance-level data—we seek to use the naturally occurring session risk assessment signal to improve an utterance risk status model.
Datasets. We use two datasets from the regional suicide crisis hotline SafeUT. Both contain encounters consisting of text messages between the client and possibly multiple counselors. Since they were created in different development stages of SafeUT, they are disjoint: one with client utterances labeled for risk status and the other with labeled encounters. No encounter is annotated at both levels.
The first dataset, denoted as U , contains 425 sessions labeled by seven annotators: six graduate
4Our SafeUT data uses a revised version of the Suicide Risk Factors in the Crisis Chat Transcript Abstraction.
students and a psychology professor. The average session has 23 utterances, with 13 from the client. Each annotator independently labeled client utterances with a nine-dimensional label indicating a no-code or a combination of risk status Dcodes (Table 1) and achieved a high 0.8 intra-class correlation coefficient. The set U contains 4912 client utterances, 688 of which are labeled with at least one D-code. The second dataset, denoted as E, contains 5990 encounters labeled by trained SafeUT counselors with binary risk assessment labels. They labeled 879 and 5111 encounters with higher and lower risk respectively.5
Problem statement. Previous research with similar kinds of data has used multi-task learning techniques to create joint representations of the input, successfully improving utterance-level prediction (Gibson et al., 2022; Cahn, 2021).
The two types of labels are tied by structural dependencies. From the definitions of the D-codes, and their associated coding manual (Lake et al., 2022), we observe that certain utterance D-codes suggest a higher risk session: an encounter containing a client utterance coded with Imminent risk (D2a), Attempt in progress (D3), Method chosen or considered (D6) or Availability of means (D6b) must be assessed as having higher risk. Conversely, a lower risk assessed encounter cannot contain an utterance coded with any high-risk D-code.
Beyond the cross-task dependencies, the definition of the D-codes also entails that the occurrence of certain labels logically necessitates the occurrence of certain others. For example, a client who has attempted suicide in the past had (at least) one lifetime suicide ideation. Hence, an utterance coded with Prior attempt(s) (D9) must also be coded with Lifetime ideation (D1).6 We list all the D-code dependencies in the appendix (Table 13).
The structural dependencies between the tasks open the possibility of using encounter-level annotation as indirect supervision for utterance-level risk status coding. Moreover, the dependencies between D-codes can be used to guide models to-
5The set E was previously used for session binary risk assessment by Broadbent et al. (2023).
6This dependency between the D9 and D1 labels is from the D-code annotation guidelines. However, we note that it is theoretically possible that one could make a suicide attempt without ideation. Indeed, since we are dealing with mental states of people, the dependencies between the D-codes are actually only highly probable rather than being inviolable mandates. But rule violations are psychologically improbable; so for this work, we can treat them as constraints.
wards more consistent and robust utterance risk status prediction despite the paucity of data.
We ask: Can we exploit the structural dependencies between the two kinds of annotation and within the D-codes to aid utterance-level prediction?

heading: 3 Indirect Supervision via Logic
text: In this work, we introduce a logic-guided indirect supervision framework that uses cross-task dependencies to transfer signal from the session data to the utterance models. The declarative nature of the structural dependencies between the two tasks allows us to express them as predicate logic rules.
The question of indirect supervision with structural constraints has been studied in the structured prediction literature (Chang et al., 2010a,b). However, instantiating these approaches for neural networks is computationally expensive because of the need to perform combinatorial inference in the innermost loop of the already slow training process.
Instead, we build on the approach presented in Li et al. (2019) and Medina Grespan et al. (2021) and relax the rules to define sub-differentiable losses that encourage utterance and session models to satisfy them. Doing so allows us to train a jointly constrained pair of models from the two data sources.
The rest of this section expands on this intuition to present a declarative formulation of the problem. The next section focuses on using the formulation to design a loss function for learning.

heading: 3.1 Notation
text: We denote by e = {m1,m2, . . . ,mn} an encounter with n utterances where each mi represents a client or a counselor utterance. We denote by R = {Lower,Higher} the set of risk labels at the session level, and by D the set of all risk status utterance labels in Table 1. Additionally, we denote the no-code label as No-D. We denote the subset of high-risk D-codes (bold rows in Table 1) by H.
We represent the fact that an encounter e has risk r ∈ R as the predicate Risk(e, r). Similarly, we define the predicates HasCode(m, d) to denote the fact that an utterance m has the label d ∈ D, and NoCode(m) to denote that the label of m is No-D.

heading: 3.2 Declarative Problem Formulation
text: For the declarative loss learning approach, we first need to represent the labeled data and structural constraints in predicate logic.
Data Constraints. The dataset of encounters E sets the Risk for each session it contains:
∀(e, r) ∈ E, Risk(e, r). (1) To represent the fact that a client utterance m is labeled with a set of D-codes D∗ ⊂ D, we need to ensure that (a) the labels of m are in D∗, and (b) neither the No-D, nor other D-codes should apply for the message. For notational convenience, we will call these M1 and M2 respectively.
M1(m,D∗) := ∧
d∈D∗ HasCode(m, d) (2)
M2(m,D∗) := ¬NoCode(m)∧∧
d∈D\D∗ ¬HasCode(m, d) (3)
Using these helper predicates, we can represent a session in the utterance labeled data U . Each client utterance in a session e ∈ U either has a set of D codes associated with it, or has the No-D label.
∀e ∈ U, ∀(m,D∗) ∈ e, M1(m,D∗) ∧ M2(m,D∗), ∀(m,No-D) ∈ e, NoCode(m). (4)
Joint constraint. A session assessed with Lower risk must not contain a client utterance with a high-risk D-code from the set H. This constraint applies for every utterance in the session. Importantly, the rule applies to all sessions, whether they are labeled or not, and in particular, to sessions in both datasets E and U . We can write:
∀e ∈ E ∪ U, ∀m ∈ e, ∀d ∈ H Risk(e,Lower) → ¬HasCode(m, d). (5)
D-Code constraints. For a set of pairs of Dcodes (di, dj), if the former applies to a message, so should the latter. We will refer to the full set of pairs (Table 13 in the appendix) as RULES. These label dependencies apply to every message in every encounter in both datasets E and U . We can write:
∀e ∈ E ∪ U, ∀m ∈ e, ∀(di, dj) ∈ RULES, HasCode(m, di) → HasCode(m, dj). (6)
NoCode constraint. Our final constraint enforces structural consistency among the utterance risk predictions. In the multi-label setting, every utterance either has the No-D label or a combination labels in D, but never both. The constraint holds for all encounters in our data. We write:
∀e ∈ E ∪ U, ∀m ∈ e, NoCode(m) ↔ ∧
d∈D ¬HasCode(m, d). (7)
Full declarative specification. We can state the desired properties involving our predicates as a formula composed by the conjunction of the expressions (1), (4)—representing the labeled datasets— and the expressions (5), (6), and (7)—representing the domain knowledge rules. Together, these can be thought of as “contracts” that any model for the tasks should seek to satisfy.

heading: 4 From Logic to Losses
text: In our declarative formulation, we have three atomic predicates: HasCode, NoCode and Risk. We model the truth value of these predicates as the output probabilities of a transformer-based classifier. We denote the relaxed truth value of the predicate classifiers with square brackets. For instance, given a session e, we denote the predicted probability that the fact Risk(e,Higher) holds as [Risk(e,Higher)].
All the constraints we have encountered will be relaxed into differentiable forms, such that the truth values of the atomic predicates define the truth value of the entire loss under the relaxation. Consequently, learning the three predicates will require optimizing their parameters to maximize the truth value of the relaxed declarative loss.

heading: 4.1 Multi-task Predicate Models
text: We use a joint neural model for the relaxed truth values of the predicates NoCode, HasCode and Risk. The network receives an input session and predicts the probabilities of risk for the entire session, and client risk status for each utterance.
Our models are based on RoBERTa (Liu et al., 2019). To make the embeddings domain-aware, following Gururangan et al. (2020), we adapted the RoBERTa-base model using a large corpus of 2 million fully unlabeled SafeUT utterances.
Given a session, we obtain representations for each utterance by averaging its token RoBERTa embeddings. We input the utterance representations into a 2-layer transformer encoder to obtain session-contextualized utterance embeddings. The average of the utterance embeddings is used to represent the entire session. The session embedding is the input of a linear layer with two outputs, whose softmaxed values serve as the Lower and Higher risk probabilities of the session. These probabilities model the truth values of the Risk predicate.
To each utterance embedding in the session, we apply a linear layer with |D|+ 1 outputs followed
by an element-wise sigmoid activation. These give us the utterance risk status probabilities and the No-D probability, which model the truth value of the HasCode and NoCode predicates.
Appendix C gives additional details about the model architecture. Note that since the output probabilities share a common session-contextualized embedding model, they represent a simple multitask model where each one task has the opportunity to influence and improve the other.

heading: 4.2 Losses
text: The key idea behind our relaxation approach is that each boolean operator can be softened into a sub-differentiable function. We follow the recommendations of Medina Grespan et al. (2021) and use the R-product t-norm relaxations of the logic operators to produce loss functions. Table 11 in the appendix shows the relaxations for each operator.
Applying the relaxation to rules in section 3.2, we can construct loss functions that we then optimize. In other words, every loss defined below has an analogue in section 3.2.
Data losses. The expression (1) requires all the predicates representing the labeled sessions in E should hold. This is equivalent to asking the conjunction of Risk(e, r) facts for all (e, r) pairs in E to hold, which is relaxed as the product of its conjuncts. Equivalently, we can minimize the negative log the expression, and recover the standard cross-entropy loss for encounter risk classification.
LE = ∑
(e,r)∈E − log [Risk(e, r)] (8)
Analogously, we can write the losses for the helper predicates in expressions (2) and (3), ℓM1(m,D∗) = ∑
d∈D∗ − log[HasCode(m, d)]
ℓM2(m,D∗) = log(1− [NoCode(m)])+∑
d∈D\D∗ log(1− [HasCode(m, d)])
These helper losses let us write the loss of the utterance labeled data U , thus relaxing the Boolean expression (4) to recover the binary cross entropy loss for multi-label classification: LU = ∑
e∈U
( ∑
(m,D∗)∈e
( ℓM1(m,D∗) + ℓM2(m,D∗) ) +
∑
(m,No-D)∈e − log[NoCode(m)]
) (9)
Joint constraint loss. For the joint constraint (5), using the R-Product definition of implication, we obtain a loss composed of the sum of ReLU functions:
LJoint = ∑
e∈U∪E
∑
m∈e
∑ d∈H ℓJ(e,m, d) (10)
where, ℓJ (e,m, d) = ReLU ( log[Risk(e, Lower)]−
log(1− [HasCode(m, d)]) )
(11)
D-Code constraints loss. In a similar fashion as above, we can derive the D-code dependencies (6).
LD = ∑
e∈U∪E
∑
m∈e
∑
(di,dj)∈RULES ℓI(m, di, dj) (12)
where,
ℓI (m, di, dj) = ReLU ( log[HasCode(m, di)]
− log[HasCode(m, dj)] )
NoCode constraint loss. Following the structure of the NoCode constraint (7), we can write the NoCode loss as
LNoCode = ∑
e∈U∪E
∑ m∈e ℓn(m, d) (13)
However, unlike the cases we have seen so far, naively applying the conversion rules gives us a loss that is not stable for learning. This was also observed by Li et al. (2020), who suggest that for stability, the conjunction of the negation on the right-hand side of the double implication be relaxed using the Gödel conjunction (which is the min of the conjuncts). Doing so and simplifying gives us:
ℓn(m, d) = ∣∣∣∣∣ log ([NoCode(m)])−
log ( 1−max
d∈D [HasCode(m, d)] ) ∣∣∣∣∣
(14)
Full logic-based loss. Just as the full declarative specification is the conjunction of individual components, the problem of learning the predicate models requires minimizing the total loss:
L =LU + λELE + λNoCodeLNoCode
+ λDLD + λJointLJoint (15)
Here, the λ’s are non-negative hyper-parameters that regulate the signal from each loss term. Importantly, the unsupervised losses LJoint, LD and LNoCode apply to encounters in both datasets E and U ; they are not defined over ground truth labels. The joint loss serves to transfer signal from the encounter data to the utterance predictors, while the other two unsupervised losses enforce structural consistency in the utterance predictors.

heading: 5 Experiments and Results

heading: 5.1 Experimental Setup
text: Data. We partition the utterance-level dataset U with stratified splits of 135, 144 and 146 encounters for training, development and testing respectively. We split the encounter-level dataset E into 5,393 encounters for training and 597 encounters for testing. Tables 2 and 3 provide summary statistics.
Baselines. Our proposed approach optimizes the total loss that includes all the relaxed rule components. We compare our system against two baselines with the same architecture but simplified rule-less losses: Lbaseline = LU and Lmulti-task = LU + LE . The first baseline is trained only on utterance D-coded data. The second baseline incorporates the labeled session-level data under a standard multi-task learning regime that shares representations.
Training details. We train all models on the U and E training splits. For each training epoch, we use a random combination of batches from U and E—respectively computing the truth values of the
predicates HasCode and NoCode, and Risk. Since our goal is to build a better utterance predictor, we use the development set from U for hyperparameter tuning and model selection using the microaverage of the F1 score in multi-label utterance classification. We train the models for 150 epochs with early stopping after 50 epochs using AdamW optimizer (Loshchilov and Hutter, 2019). We refer the reader to appendix C.4 for details.
Evaluation. For the utterance and chat labels, we report the precision, recall and F1 micro-averages. Further, we measure the consistency of model predictions by analyzing how much they violate the declarative rules we are incorporating. We report the average performance of the models on the test splits across five different training random seeds.

heading: 5.2 Main Results
text: Utterance results. Table 4 reports the utterance D-code classification results over utterances labeled with at least one D-code.
We expect the baseline to already have some domain tuning because the RoBERTa embeddings were additionally pre-trained on counseling text. Standard multi-task (MT) classification improves the F1 score by 3.3% with respect to the baseline, corresponding to a 6.1% increase in recall. We can attribute this improvement to the shared feature space in the transformer encoder layers becoming better from the encounter labeled data. Finally, we observe that introducing the relaxed rules loss components (MT+Rules) produces a F1 gain of 3.5% over the already improved multi-task system (corresponding to a 10.2% improvement in recall). Each subsequent F1 improvement is statistically significant at p < 0.05 using the paired t-test. Related to the recall increase, we observe that the F1 for the majority label No-D dropped. Compared to the baseline’s 95.2%, the full and multi-task systems’ scores dropped to 91.5% and 88.9% respectively. Importantly, in this domain, the recall improvements are desired. False positive D-code predictions are preferable to missing any important
suicide-related cues.
Session results. Table 5 reports F1, precision and recall scores for the Higher risk label.
The baseline is unsurprisingly as good as random; it does not have any access to session-level risk supervision. Compared to the multi-task baseline, we observe a drop in F1 performance in our system. We discover that this difference corresponds to a 10.7% drop in precision, but also to a significant gain of 23.5% in recall. These results show that incorporating indirect signal from the rules prioritizes recall which aligns with the goals of suicide risk detection application: Improved recall for the Higher risk label can help focus counselors attention to such clients.7
Constraint violations. Table 6 shows how often (on average across random seeds) the systems violate each of the declarative rules.
For the NoCode constraint, which introduces a mutual exclusion between the No-D label and any D-code for every utterance, we find that the multitask system has more violations than the baseline. This implies that multi-task model’s gain in utterance D-code recall over the baseline (Table 4) is related to errors where the system assigns utterances with the right D-codes but also the No-D label. Adding the rules mitigates this problem.
For the D-Code rules, which enforce dependencies between D-codes, even the baselines have only
7In this work, we do not consider encounter-only model training. Broadbent et al. (2023) showed that doing so—i.e., optimizing the loss LE alone—results in better session-level risk classification. Our focus here is the D-codes, and we tune our models and hyper-parameters for utterance-level predictions. However, we also note that our models, jointly trained with rules, improve recall over their reported performance.
few violations. Nevertheless, our system recovers perfect consistency with respect to these rules.
Lastly, the joint rule prohibits all client utterances from Lower risk encounters from having any high-risk D-code. Given that we have a random risk classifier in the baseline, we only compare system violation performance against the multi-task system for this rule. We observe that our system improves in terms of violations for the joint rule implying that it successfully incorporates the knowledge from the LJoint loss during training.

heading: 5.3 Ablation Analysis
text: To better understand the impact of each rule, we perform an ablation study with respect to the multitask baseline. Tables 7, 8 and 9 report the impact of each rule individually added during training.
Adding only NoCode rule. As expected, we see that NoCode rule violations drop when adding only the NoCode rule loss (Table 9). Furthermore, the NoCode rule loss by itself improves utterance F1 (1.2%) by reducing the precision and increasing the recall by 10% each (Table 7). This improvement indicates that the system is predicting more D-codes and fewer No-D. (As expected, the F1 score on the No-D label decreases from 91.5% for the multi-task baseline to 87.5%.)
counter risk classifier with a big improvement in recall at the cost of a significant drop in precision, resulting in an overall F1 drop of 4.8% (Table 8). In this case, updating the model weights to optimize the NoCode loss (LNoCode) defined at the utterance level makes the encounter-level risk assessment classifier to predict more Higher risk.
Adding only D-Code rules. For D-code classification, precision increases at the cost of recall (Table 7). In this case, the system incorrectly predicts messages without any label (No-D and D-codes) to trivially satisfy all the D-Code rules; hence, the reduced D-code recall.
The system has perfect consistency for the DCode rules as expected. Analyzing the effect of the D-Code loss on the risk classifier, we observe a similar behaviour as using only the NoCode loss. This similarity implies that adding constraints at the utterance level affects the weights in the shared feature space to make the risk classifier more sensitive to risk, i.e. more recall at the cost of precision.
Adding only the joint rule. We observe a significant 3.2% gain in F1 performance corresponding to precision and recall gains of 1.9% and 3.8% respectively (Table 7). We attribute this improvement to the indirect supervision coming from the risk classifier through the inter-label dependency encoded by the (relaxed) joint constraint.
Analyzing the performance on the risk classifier we observe a comparable F1 performance with respect to the multi-task baseline with a considerable 7.5% drop in precision offsetting a significant 17% gain in recall (Table 8). In this case, the signal from the utterance risk classifier on high-risk D-codes makes the encounter risk assessment model more sensitive to risk, which is a desirable behaviour. The classifier using only the joint rule loss, unsurprisingly, does not improve NoCode and D-Code rules violations as they are not part of the objective function during training, but it improves the joint rule violations (Table 9).

heading: 6 Error Analysis
text: We manually examined false positive and false negative predictions of the MT+Rules model on the development split of U . For this analysis, we used the model corresponding to the random seed that provided the best micro F1 performance on Table 4. We found four dominant kinds of errors, listed below.
Passive [D2b] vs Current [D2] Ideation. Confusion between passive and current ideation accounts for 27% of the total errors. We observe that half of these mistakes are edge cases which can be hard to discern even for a human. For example, the D2b utterance “I am having those thoughts again. Being better off dead” is classified with both D2b and D2.
Lifetime [D1] vs Current [D2] Ideation. The inability to distinguish lifetime and current suicidal ideation (perhaps related to deficiencies in temporal reasoning) accounts for 15% of the errors. For example, the D2 utterance “I’m worried. She has sent me a text saying she was going to commit suicide” is classified with both D2 and D1.
Excessive No-code [No-D]. Missing D-codes account for 20% of the errors. We observe that in almost all of this cases, the true label depends on previous context (e.g., “Yes...”,“Not really”).
Commonsense Knowledge. We observe that 4% of the errors come from poor commonsense reasoning. For example, our model does not predict D2 and D2b for the utterances “a kid on social media posted bloody cuts, the caption said bye bye!...”, and “I know I am only alive for my friends and food! LOL” respectively.
The table in Appendix E shows additional examples of these errors.

heading: 7 Related Work & Discussion
text: Mental Health NLP-based methods have proven useful to detect risk in mental health counseling. Benton et al. (2017) built a multi-task model to predict suicide risk on social media, and report improvements over single-task models trained on limited data. Gibson et al. (2022) developed a multi-task model to predict therapist use of psychological interventions for each talk turn. Like our multi-task model, their model simultaneously learned two different labeling schemes by building two separate encoders for respective tasks plus a shared encoder. Their multi-task model also outperformed single-task models. Our work goes beyond the multi-task approach and incorporates indirect supervision from structural dependencies between the two sources of annotation.
Indirect supervision. Our work is conceptually related to an indirect supervision joint inference paradigm (e.g., Roth, 2017) which leverages domain knowledge to enforce structural dependency
constraints. Other efforts also use indirect supervision paradigms (as presented in Wang and Poon (2018)) for biomedical and mental health domains. Cusick et al. (2021) use weak supervision from a regular-expression-based algorithm that successfully leverages noisy labels that improve suicidal ideation on clinical notes classification. Fu et al. (2021) use a suicide ontology-based knowledge graph for distant supervision in suicide risk detection on social comments.
Logic-driven learning. Among a variety of logic-driven learning approaches (e.g., Besold et al., 2017), our method is probably the closest to probabilistic soft logic of Kimmig et al. (2012). This approach softens booleans to the interval [0, 1] using the Lukasiewicz t-norm relaxation. This approach has shown promising results in several empirical studies, especially in low-data regimes. For example, Li et al. (2019) used the product t-norm to relax logic for entailment, while Wang et al. (2020) showed that by introducing logic constraints, their model outperformed benchmark models on the event-event relation data that lacked joint labels. Our work shows that the logic-driven learning framework can be used to transfer supervision signal between tasks with very different input (encounter vs. session) and output (binary vs. multilabel classification) characteristics.

heading: 8 Conclusion
text: In this work, we study the problem of predicting utterance-level labels in a suicide crisis chat with the goal of better understanding such sessions and providing better feedback to fatigued counselors. We propose a fully declarative framework that integrates different data sources with a logic-guided loss. We experiment with two text-based crisis counseling datasets from the same source, but with different and disjoint annotations. One level of annotation—the session level—occurs naturally but is noisy, while the other level of annotation— the utterance level—is expensive but precise. Our results show that exploiting the structural dependencies among the sources of annotations allows the session labels to help improve the utterance model.

heading: 9 Limitations
text: Our experiments reveal that simultaneously incorporating more rules into the loss produces better
performance in the task of interest (Table 4). These results indicate that rules working in tandem significantly complement supervision coming from both sources of direct annotation under a fully declarative loss. Nevertheless, controlling the influence of each term in the loss is crucial for training stability. We found that the system has different sensitivities to each term in the loss, requiring a full search over the λ hyper-parameters (15). From this perspective, the possible benefits of increasing the number of rules in the loss come at the cost of more difficult learning.
Due to hardware limitations of the protected environment server that stores the datasets we use, RoBERTa-base was the best model that could fit in the available GPUs. Although other pre-trained embeddings could provide better performance, we argue that this is orthogonal to our contribution of incorporating indirect supervision under a fully declarative learning framework. Moreover, integrating logic-driven frameworks and prompt-based models like T5 is an interesting future line of work.
Choosing RoBERTa as the underlying embedding foundation of our system introduces all the inherent limitations of large language models (Bender et al., 2021). From this standpoint, we envision the application of these sorts of systems as a humanguided tool used only for counselor training and quality assurance, and never for real counseling sessions.

heading: 10 Ethics Statement
text: Hovy and Spruit (2016) list several ethical issues in the study and application of natural language processing, and advocate increased awareness of possible adverse social impacts. This is especially true in mental health care in general, and in crisis services in particular. Linthicum et al. (2019) points out the latent bias in the demographic composition of a dataset, with the potential risk of excluding underrepresented populations. In addition, machines cannot understand the social meanings of some biased datapoints, such as particular language use that could be inappropriate or offensive to particular cultural groups. When picking up these biases, the model may run the risk of reinforcing these prejudices if no manual check is available (Lin et al., 2022). This is true not only for patients but equally for clinicians. Although our model was designed with a clinical application in mind, with no access to the demographic information of pa-
tients or clinicians due to confidentiality concerns, the current model should not be interpreted as a system that can be applied directly to local crisis services without manual supervision. Instead, this study should be seen as a test for the feasibility of multi-task learning in a particular clinical setting. If the model is ultimately applied to crisis services, it still should not be allowed to run on its own or override manual judgment, but should instead be used as an assisting tool to better inform clinicians in their clinical cases or training.

heading: 11 Acknowledgments and COI
text: The authors acknowledge the support of the Utah State Board of Education SafeUT Research and Quality Improvement Program Grant. This material is based in part upon work supported by the National Science Foundation under Grant #1822877. Any opinions, findings, and conclusions or recommendations expressed in this material are those of the authors and do not necessarily reflect the views of the National Science Foundation. We also thank the members of the Utah NLP group, and Tao Li for their feedback on previous iterations of this work, and the ACL reviewers for their valuable feedback.
Conflict of interest disclosure. Zac Imel is a cofounder and minority shareholder in Lyssn.io, a technology company focused on developing tools to improve the quality of behavioral healthcare.

heading: A Data Anonymization and Storage
text: The data was anonymized following HIPAA compliance guidelines. We use special mask tokens for identifiable information, including names, locations, ZIP codes, ages, phone numbers, related entities (e.g., school, hospital, etc.), and any other numbers. All the data are stored in a HIPAAcompliant cloud folder. Only staff signed under the IRB approval of this project (IRB_00131153) were allowed to have access to the folder. The staff have all been trained with basic knowledge on data confidentiality, privacy, and protection.

heading: B Anonymized examples of sessions
text: Figures 2 and 3 show example snippets of encounters with associated D-codes with Lower and Higher risk assessment respectively.
for client ( ) utterances.
codes) for client ( ) utterances.

heading: C Reproducibility
text: C.1 Encoding Model
We pre-process both datasets U and E by prepending special tokens indicating the originator of each utterance in a session: we added the token [#COUNSELOR] or [#CLIENT] to counselor and client utterances accordingly. Each utterance is then encoded with a domain-adapted RoBERTa model of 768-dimensional outputs.
Before the utterance encoding, we add the originator tokens to the matrix embedding of RoBERTa. We respectively initialize these tokens by averaging the pre-trained embeddings of the words “client”, “counselor” with corresponding direct synonyms
(e.g.,“patient”/“therapist”). Similarly, we add and initialize the special anonymization mask tokens (e.g., [#SCHOOL], [#ZIP-CODE], [#PERSON]). Following Gururangan et al. (2020), we adapt the RoBERTa-base from the hugginface library using 2 million general mental health counseling (crisis,tips,support) unlabeled utterances extracted from SafeUT. We continue training RoBERTa-base for 5 epochs with AdamW optimization, learning rate of 5e − 5, batch size 4, and using a mask language model head with masking probability of 0.15 (seed=1). To obtain the utterance RoBERTa encondings, we average the concatenation of the last four hidden states of the adapted RoBERTabase outputs from the truncated (max length 512) input utterance tokens. The resulting utterance encodings are 3072-dimensional vectors.
C.2 Architecture On top of the RoBERTa utterance embeddings, we use two trasformer encoder layers. Each transformer layer has 8 heads, 2048 feedforward dimension, ReLU activation on the intermediate layer and 1e-5 eps stability value at the normalization layer. We applied a positional encoding layer with dropout probability of 0.2 and a eps value of 1e-12 to the input utterance embeddings before the transformer block. In all, our system has 275 million parameters.
C.3 Full System Description Let e = {m1,m2, . . . ,mn} be an input session. For each utterance mi ∈ e, we denote as m∗i the corresponding utterance RoBERTa embedding obtained as described in C.1.
RoBERTa(mi) = m∗i
We input the encoded encounter e∗ = {m∗1,m∗2, . . . ,m∗n} into the transformer block to obtain a list of session-contextualized utterance embeddings {u1, u2, . . . , un}
Transformer(e∗) = {u1, u2, . . . , un} = u
To obtain an entire session embedding s we average (as described in C.1) the transformer utterance embeddings
average({u1, u2, . . . , un}) = s We apply a linear layer Pu of length 9 and an element-wise sigmoid activation to each client utterance uc ∈ u obtaining a nine-dimensional vector
σ(Pu(uc)). Each entry in σ(Pu(uc)) represents the probability that the utterance uc having each of the D-codes is True. For instance, the first and second coordinates of σ(Pu(uc)) are the probabilities that the facts NoCode(uc) and HasCode(uc,D1) respectively hold. This is,
σ(Pu(uc))[1] = [NoCode(uc)]
and
σ(Pu(uc))[2] = [HasCode(uc,D1)]
Similarly, we apply a linear layer Ps of length 2 and a softmax activation to the session embedding s obtaining a two-dimensional vector softmax(Ps(s)). Here, we have that
softmax(Ps(s))[1] = Risk(e,Lower)
and
softmax(Ps(s))[2] = Risk(e,Higher)
We use the relaxed truth-values in the utterance and encounter vectors—σ(Pu(uc)) and softmax(Ps(s))—to compute all the loss components in (15) using the R-product logic.
We do not fine-tune the underlying domain adapted RoBERTa model due to hardware limitations. The data for this project is housed in a secure compute infrastructure whose GPUs size do not allow us to load entire input sessions and their gradients in memory.
C.4 Experimental setting Multiple runs We train the system using the training splits of the utterance U and session E datasets using 5 different seeds (0,1,2,3,4).
Data Batching and optimization We randomly select batches from U (we denote BU ) and E (denoted BE) until completing each epoch. For BU batches we have the labels to compute the utterance multi-label loss LU and not the session binary loss LE , therefore the latter does not contribute during back-propagation. Similarly, input BE batches update the LE loss but not the LU loss. Importantly, the unsupervised losses LJoint, LD and LNoCode can be computed from both BU and BE batches. We use rescaling weights on LU and LE to compensate label imbalance. In this setting, the size of a batch is defined by the number of sessions, and sessions can have different sizes in terms of contained utterance. Hence, we normalize the loss for
BU batches (also for BE batches for implementation convenience) by averaging the utterance losses from all sessions in the batch. This strategy makes the system performance more stable across epochs.
Training with rules The MT+Rules system reported in the tables from section 5.2 is obtained from training the baseline Multi-Task (MT) system for 75 epochs until convergence and then continue training adding the rules for 75 epochs more. We found that this strategy mitigates high variance in performance across different runs.
Evaluation and model selection We run hyperparameter tuning for 75 epochs, and then train with the best combination for 150 epochs (using seed 1). We select the model from the epoch with best micro averaged F1 over the client utterances labeled with at least one D-code in the development split of the set U . We stop training after 50 epochs of nonincrease in F1 and keep the model from the latest best epoch.
Hyper-parameter tuning details The hyperparameter search space is the following:
• Learning rate (lr): 1e-4, 2e-4, 5e-4, 1e-5, 2e-5, 5e-5, 1e-6, 2e-6, 5e-6
• λ’s (eq. 15) : 0.0001, 0.001, 0.01, 0.1, 1, 5, 10
• Batch size (bs): 4, 8, 16
Due to the size of the search space we do not perform full grid hyper-parameter search for all the systems reported. We first select the best hyperparameters exploring the search space for the baseline models that only includes learning rate, batch size, and λE (for the multi-task baseline). From this process we discover values for which the baselines do not converge, and discard them for the subsequent search—when adding the rules into the system. For instance, we discard the learning rate values 1e − 4, 2e − 4, 5e − 4, 1e − 6, 2e − 6, 5e− 6, and the λE values 0.1, 1, 5, 10. We further reduce the search space by incrementally adding rules into the system and exploring the influence of different λ values. For instance, we observe that the multi-task baseline system trained using only the NoCode rule under-performs with λNoCode values smaller below 1. Due to the running time of each hyper-parameter combination, this aggressive pruning strategy was necessary to make the
experiments feasible. Table 10 shows the hyperparameter combinations used to train the models reported in section 5.2.
Running times We give an approximate estimated time for each stage of our experiments with significant running time:
1. Adapting RoBERTa with SafeUT utterances: 4 days
2. RoBERTa session encodings: 4 hours for the risk assessment set E, and 30 minutes for utterance risk status set U .
3. One training epoch: 1.2 hours for each hyperparameter combination including evaluation for development and rules violations.
Code and computing infrastructure We implemented all our experiments in Python, using the PyTorch, Pandas, and scikit-learn libraries. We used a server located in an IRB approved HIPAA protected environment with the following configuration:
• CPU: Intel (R) Xeon (R), E5-2640, 2.40 GHz
• GPU: NVIDIA TITAN X (Pascal)
• RAM 12GB

heading: D Logic Relaxations
text: D.1 Implementation details
As discussed in Xu et al. (2018) t-norm logic relaxations are syntactic, rather than semantic, representations of boolean statements. In our particular case, the relaxation of a predicate rule may produce a different loss than the relaxation of its contrapositive. From this perspective, to obtain signal from syntactically different but semantically identical representations of the constraints in our system,
we also add their respective contrapositive in the learning loss.
In the declarative definition of the loss, we can incorporate each constraint along its contrapositive in two logically equivalent ways – as a conjunction or as a disjunction. For instance, let F1 and F2 be Boolean formulas. A constraint of the form F1 → F2, can be added along its contrapositive into a declarative boolean statement as the conjunctive term (F1 → F2) ∧ (¬F2 → ¬F1) or as the disjunctive term (F1 → F2) ∨ (¬F2 → ¬F1). Although the latter equivalent expressions also generate different relaxation signals, we found through preliminary experiments that adding the constraintcontrapositive disjunction terms accelerates system convergence.
As an example, by adding the contrapositive to the joint constraint (5) we obtain:
∀e ∈ E ∪ U, ∀m ∈ e, ∀d ∈ H( Risk(e,Lower) → ¬HasCode(m, d)
) ∨(
HasCode(m, d) → Risk(e,Higher) ) (16)
We use the S-Gödel over the R-Product logic (Table 11) to relax the disjunction of the rule and its contrapositive. We encounter that taking the maximum of the disjuncts, as defined by S-Gödel,
provides better learning stability (the maximum function becomes the minimum after taking the negative logarithm for optimization). In this way, we implement the relaxation of the joint rule from equation (16) as:
∑
e∈U∪E
∑
m∈e
∑ d∈H min ( ℓJ (e,m, d) , ℓC (e,m, d) )
(17)
where, ℓJ (e,m, d) is defined in equation (11), and
ℓC (e,m, d) = ReLU ( log([HasCode(m, d)])− log[Risk(e,Higher)] )
(18)
The D-Code and NoCode constraints are implemented following an analogous strategy.

heading: E Error Analysis
text: Table 12 shows examples of the four types of errors discussed in the paper.

heading: F D-code rules
text: Table 13 shows the full set of dependencies between the D-codes.
ACL 2023 Responsible NLP Checklist

heading: A For every submission:
text: 3 A1. Did you describe the limitations of your work?
9
3 A2. Did you discuss any potential risks of your work? 9,10
3 A3. Do the abstract and introduction summarize the paper’s main claims? 1
7 A4. Have you used AI writing assistants when working on this paper? Left blank.
B 7 Did you use or create scientific artifacts? Left blank.
B1. Did you cite the creators of artifacts you used? No response.
B2. Did you discuss the license or terms for use and / or distribution of any artifacts? No response.
B3. Did you discuss if your use of existing artifact(s) was consistent with their intended use, provided that it was specified? For the artifacts you create, do you specify intended use and whether that is compatible with the original access conditions (in particular, derivatives of data accessed for research purposes should not be used outside of research contexts)? No response.
B4. Did you discuss the steps taken to check whether the data that was collected / used contains any information that names or uniquely identifies individual people or offensive content, and the steps taken to protect / anonymize it? No response.
B5. Did you provide documentation of the artifacts, e.g., coverage of domains, languages, and linguistic phenomena, demographic groups represented, etc.? No response.
B6. Did you report relevant statistics like the number of examples, details of train / test / dev splits, etc. for the data that you used / created? Even for commonly-used benchmark datasets, include the number of examples in train / validation / test splits, as these provide necessary context for a reader to understand experimental results. For example, small differences in accuracy on large test sets may be significant, while on small test sets they may not be. No response.
C 3 Did you run computational experiments? 5
3 C1. Did you report the number of parameters in the models used, the total computational budget (e.g., GPU hours), and computing infrastructure used? C
The Responsible NLP Checklist used at ACL 2023 is adopted from NAACL 2022, with the addition of a question on AI writing assistance.
3 C2. Did you discuss the experimental setup, including hyperparameter search and best-found hyperparameter values? 5,C
3 C3. Did you report descriptive statistics about your results (e.g., error bars around results, summary statistics from sets of experiments), and is it transparent whether you are reporting the max, mean, etc. or just a single run? 5,C
3 C4. If you used existing packages (e.g., for preprocessing, for normalization, or for evaluation), did you report the implementation, model, and parameter settings used (e.g., NLTK, Spacy, ROUGE, etc.)? 4, C
D 3 Did you use human annotators (e.g., crowdworkers) or research with human participants? We work with data about humans, but do not research with human subjects
D1. Did you report the full text of instructions given to participants, including e.g., screenshots, disclaimers of any risks to participants or annotators, etc.? Not applicable. We used annotated data. We did not annotate data in this project.
D2. Did you report information about how you recruited (e.g., crowdsourcing platform, students) and paid participants, and discuss if such payment is adequate given the participants’ demographic (e.g., country of residence)? Not applicable. Left blank.
D3. Did you discuss whether and how consent was obtained from people whose data you’re using/curating? For example, if you collected data via crowdsourcing, did your instructions to crowdworkers explain how the data would be used? Not applicable. Left blank.
3 D4. Was the data collection protocol approved (or determined exempt) by an ethics review board? A
D5. Did you report the basic demographic and geographic characteristics of the annotator population that is the source of the data? Not applicable. Left blank.

heading: Future Work
text: Moreover, integrating logic-driven frameworks and prompt-based models like T5 is an interesting future line of work. Choosing RoBERTa as the underlying embedding foundation of our system introduces all the inherent limitations of large language models (Bender et al. , 2021). From this standpoint, we envision the application of these sorts of systems as a humanguided tool used only for counselor training and quality assurance, and never for real counseling sessions